How to add a vertical resize bar for each TableRow in a TableView?

I am looking for a best approach / best practice to accomplish this task. I need to be able to implement, in the least, re-sizable (by dragging on a divider line) TableRows. I understand this to be a bit more difficult to retain the height of each individual TableRow because they are virtual and reused. My first goal is only to have all TableRows re-sized (eliminating the need to carry individual row sizes ).
I am able to implement my own TableRow by extending TableRow - and I was able to retrieve a reference to the TableRow's Skin and adding a divider line (Rectangle) and capturing the Mouse events to effectively re-size the height of the Row by dragging.
My Question is this: Without implementing a new TableRowSkin - how can I force the divider line to be at the bottom of the TableRow? Currently - I am just adding the Rectangle Node (Divider) to the TableRowSkin's children list - causing the divider line to be positioned at the top of the TableRow (This gives an odd feeling when resizing - the line should be on the bottom).
I feel like I am hacking at the issue without realizing the intent of the JavaFX developers. Is the intent for Row Height resizing to be implemented by providing a new Skin? There doesn't seem to be an easy way to accomplish this task using the existing TableRow or TableRowSkin.
I can post example code if requested - but I will need to condense the example to a small enough self-contained file.
If the answer is "Yes - implement a new skin" that is fine, but this task might be difficult without the source code for guidance :) [hint..hint..]

After attempting to override the TableRow itself - I ran into a bug in the underlying skin causing a ClassCastException when sorting on the headers - apparently the underlying TableRowSkin doesn't like it when you add anything other then a TableCell (I added a Rectangle in this case, could not be cast to a TableCell). The bug was filed in Jira and fixed for 2.1 - so in the mean time I took the individual TableCell approach - add a divider to the bottom of each tableCell.
The trick is not the the divider - but it is the other Control you have above the divider. I am using a TextArea, and you may generally want to override the PreferredHeight otherwise the height of the Control continues to extend. This behavior may be a result of using VBox to house the TextArea and the Rectangle vs your suggestion of a BorderPane.
I was able to get the aesthetic functionality working to my desire. NOTE: functionality needs to be added for the table to "remember" any change of tablerowheight for each associated data item - otherwise the TableRow with the differeing height will get recycled and used for a different data item later. This shouldn't be too hard to implement with a Map for every non-default tableRowHeight change with a key of the TableRow Data Item. (Perhaps a max memory of associations as to not use up all available memory if someone wanted to resize all rows, for instance. Or we could also apply a new default Row size as well. I'm thinking this functionality should be applied to a sub-classed TableView).
editThe posted code does not have a bug - it is placing the vertical resize divider in each cell, not each tablerow. Aesthiticaly - it will take some additional tweaking. You will notice the Textarea scroll bar "bleeds" into the other Transparent cells.. Not a critical bug, but an issue to deal with I will have to tackle later. If I can hack into the TableColumn resizing behavior - or set a minWidth on each Tablecolumn - that will be my approach to deal with it for now.--edit--
public class TextAreaCell<S> extends TableCell<S,String> {
        private TextArea textArea;
        private StringProperty boundToCurrently = null;
        private Rectangle r = new Rectangle(1,3,Color.TRANSPARENT);
        private VBox vbox = new VBox();
        public TextAreaCell() {
            this.getStyleClass().add("table-cell-for-controls");
            textArea = new TextArea();
            textArea.getStyleClass().add("table-cell-text-field");
            textArea.setWrapText(true);
            textArea.prefHeightProperty().set(5);
            textArea.minHeightProperty().set(0);
            vbox.getChildren().add(textArea);
            vbox.getChildren().add(r);
            vbox.setFillWidth(true);
            r.widthProperty().bind(vbox.widthProperty());
            r.setCursor(Cursor.V_RESIZE);
            r.setOnMouseDragged(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    TextArea y = TextAreaCell.this.textArea;
                    TextAreaCell.this.printTextAreaInfo(y, event);
                    TableRow tr = TextAreaCell.this.getTableRow();
                    double newHeight = tr.getHeight() + event.getY();
                    if (newHeight <= 24) {
                        newHeight = 24;
                    tr.setPrefHeight(newHeight);
                    tr.requestLayout();
            VBox.setVgrow(textArea, Priority.SOMETIMES);
            vbox.setMinWidth(1);
            this.setGraphic(vbox);
        @Override
        protected void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);           
            if(!empty) {
                // Show the Text Area
                this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
                // Retrieve the actual String Property that should be bound to the TextField
                // If the TextField is currently bound to a different StringProperty
                // Unbind the old property and rebind to the new one
                ObservableValue<String> ov = getTableColumn().getCellObservableValue(getIndex());
                SimpleStringProperty sp = (SimpleStringProperty)ov;
                if(this.boundToCurrently==null) {
                    this.boundToCurrently = sp;
                    this.textArea.textProperty().bindBidirectional(sp);
                else {
                    if(this.boundToCurrently != sp) {
                        this.textArea.textProperty().unbindBidirectional(this.boundToCurrently);
                        this.boundToCurrently = sp;
                        this.textArea.textProperty().bindBidirectional(this.boundToCurrently);
            else {
                this.setContentDisplay(ContentDisplay.TEXT_ONLY);
        private void printTextAreaInfo(TextArea t, MouseEvent e) {
            StringBuilder s = new StringBuilder();
            s.append(e.toString()).append("\n");
            s.append("\tTextArea.prefHeight:").append(t.getPrefHeight()).append("\n");
            s.append("\tTextArea.MinHeight:").append(t.getMinHeight()).append("\n");
            s.append("\tTextArea.MaxHeight:").append(t.getMaxHeight()).append("\n");
            s.append("\tTextArea.Height:").append(t.getHeight()).append("\n");
            s.append("------------------------------------------------------------------------------------------------------------------------");
            System.out.println(s.toString());
}And the Css
.table-cell-for-controls {
    -fx-skin: "com.sun.javafx.scene.control.skin.TableCellSkin";
    -fx-padding: 0; /* 2px, plus border adds 1px */
    -fx-background-color: transparent;
    -fx-border-color: -fx-table-cell-border-color -fx-table-cell-border-color -fx-table-cell-border-color -fx-table-cell-border-color;
    -fx-border-width: 0.083333em; /* 1 */
    -fx-cell-size: 2.0em; /* 24 */
.table-cell-text-field {
    -fx-background-color: transparent;/*-fx-control-inner-background;*/
    -fx-background-insets: 0;
    -fx-background-radius: 0;
    -fx-padding: 3 5 3 5;
    -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%);
    -fx-cursor: text;
}Edited by: jkaufmann on Nov 7, 2011 4:33 AM

Similar Messages

  • How can I display different error bars for each point on a scatter graph?

    I have a scatter chart in Numbers and I need to add error bars to the points along both the x and y axes, however, the size of the error bars for each point need to be of different sizes. Is there a way to accomplish this or is there some kind of work around to acheieve a similar result? So far the only way I can find to add error bars only allows a standard amount for each point.

    I found the answer here https://discussions.apple.com/message/16440653#16441393

  • How to add Google Page Rank bar to Firefox

    How to add Google Page Rank bar to Firefox? With Chrome I can add an extension but how to do this with FireFox? Please give me the simplest and easiest solution.

    You can search the Add-ons site for Firefox extensions and see whether you find one with good reviews.
    https://addons.mozilla.org/firefox/

  • How to add a standard tool bar in alv

    H i
    i am developing a custom report  in Alv interactive report for to dispaly MRP information.
    Can you sejjest me how to add  a standard tool bar in alv.
      i displayed one final alv grid display there i have to add standard tool bar and application tool bar.
    Thanks,
    Rams
    Edited by: Ramsoft on Oct 27, 2010 12:09 PM

    Hi,
    Give the PF ststus name in  the PF status parameter of ALV FM
    I_CALLBACK_PF_STATUS_SET          = ' PF_STATUS'. " this parameter of ALV FM
    FORM pf_status USING pt_extab TYPE slis_t_extab.
      SET PF-STATUS 'MAIN' .
    ENDFORM.                    "pf_status
    Then create a main PF status by double clicking on it , after this goto EXTRA in menu
    EXTRA>ADJUST TEMPLATE> then give program - SAPLSLVC and status - STANDARD this will give u standard toolbar of ALV ,
    THen add what ever button you require in application toolbar
    Regards,
    Madhukar Shetty

  • How can i install pagerank tool bar for my fire fox

    How can i install pagerank tool bar for my fire fox so that i can have an idea that which site holds what page rank during my SEO work
    Anjimile Mtila Oponyo

    Try with this Add-on
    *https://addons.mozilla.org/en-US/firefox/addon/seo-status-pagerankalexa-toolb/

  • How to add a new data element for existing table filed(Primary key field)

    Hi Experts,
    How to add a new data element for existing table field(Primary key field)
    For this filed ther is no foreign key relation ships and even check table.
    while activating table it is giving message like below.
    can you help any one to solve this and wil steps to add new dataelement for existing primary key filed of a table.
    Check table (NAMING SPACE/TABLE NAME(EX:/TC/VENDOR)) (username/19.02.10/03:29)           
    Primary key change not permitted for value table /TC/VENDOR
    Check on table  /TC/VENDOR resulted in errors              
    Thanks
    Ravi

    Hi,
    Easiest way is to download the table eg into an Excel table (if possible) or text table. Drop the table from the database. Build your table with the new key field. Build the database table again and fill it.
    You can do it also over the database into a new table. Drop the old one. Build the enhanced one and fill it. Afterwards drop your (temporary) table.
    Maybe there are other ways, but this works.
    Success,
    Rob

  • Vertical scroll bar for the table

    Hi,
    I have a table which will contain more than 100 rows. First Visible rows will be 10.
    i want a vertical scroll bar for the table, so that i can see all the rows using vertical scroll bar. While scrolling down, the header row, which contain names of the column should be static (ie visible even scroll down) and the footer of the table should be visible even goes up.
    If I use Scroll container, it will take whole table and the header row, row with name of column will move up invisible when i scroll down. So it is not useful if i use scroll contatiner.
    I need a fnctionality were table has a vertical scroll bar to it.
    Thanks
    Maha

    Hi,
    Your requirement is one of the default properties of the Table UI element in NWDS CE version.
    Regards,
    Alka.

  • Possible to have vertical scroll bar for a cell in ALV Grid (using methods)

    Hi All,
    I have a field with length 100 characters on a ALV Grid (using methods)..User doesn't want to scroll all the 100 characters horizontally to see the whole text rather he wants to have a vertical scroll bar for the cell so that he can scroll vertically.
    Is it possible to have split the cell text into lines and have a vertical scroll bar for a cell in ALV Grid?
    Regards
    Jaker.

    Thanks for the suggestion Balu.I tried this , but while scrolling,headers also getting scrolled.
    Becoz of this , if i scroll down to the last row,headers are getting hidden.
    Headers should always be static.only the data should scroll.
    Since h:datatable is being rendered as one table , i can div tag for this table alone.
    If i have seperate datatable for headers alone i can do this .But i should not use two datatables.

  • How to add silver front panel theme for labview 2010

    how to add silver front panel theme for labview 2010

    Mahisnair wrote:
    yes i had tried this way but the vi built with silver theme doesnt look good in 2010 :-(
    wish if there was a way to include silver theme in 2010
    The only way I see to make it like that would be to recreate the theme in LabVIEW 2010 with external bitmap objects. Unfortunately it won't be as functional as the silver controls in various terms such scaling (bitmaps scale very badly) or transparency and click through functionality (a bitmap assigned to a control part will always catch all clicks and never allow a click to pass through anywhere to a lower layered part).
    The silver controls are using special internal graphic objects that were added in LabVIEW 2011, so recreating silver controls with the same functionality in earlier LabVIEW versions is impossible.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to add entry to MEMSD_DEP (Packagesize for T51) second ;-)

    Hi,
    ok I posted the thread "How to add entry to MEMSD_DEP (Packagesize for T51)?" before and now I have created the view and I am able to add entries to the table....
    BUT:
    If I try to add the entry like they are described in the help.sap.com - search for "T51 MEMSD_DEP" - I get the following error:
    "Entry T51SYNCBOCONFIG does not exsist in MEMSD - check your entry."
    And it is right in the MEMSD there are all my applications and patches I have uploaded in the webconsole, but no T51SYNCBOCONFIG....
    Can you help me out?
    Greetings,
    Kai

    Hi Kai Meyer-Spradow,
    <<<<
    one main thing ..
    <b>In that documentation , they have specified that there is one MCD named T51SYNCBOCONFIG .. I think in that sense ,
    it written there as ,,</b>
    1. Start the transaction mi_mcd.
    2. Enter the application name and choose Display MCD.
    3. Choose Display <-> Change.
    4. Choose the SyncBO tab page.
    5. Enter the following settings for each SyncBO of type Back-End-Driven:
      The object ID in the SyncBO-ObjectID column.
    The delay with which the job is to be scheduled in the Interval column.
    6. Choose Save.
    just look at that ...
    >>>>>>>
    just do one think ..
    If that T51SYNCBOCONFIG is not there in ur MI server , create a new MCD with this name and include ur Back - end driven syncBo to this MCD. then proceed.
    These are the primary keys of the table MEMSD_DEP.
    Fields           Check Table
    NAMESPACE               TRNSPACET
    NAME               MEMSD
    VERSION               MEMSD
    TYPE               MEMSD_DEPTYPE
    TYPE_INDEX
    DEPENDENCY_NAME
    MEMSD
    This table is the Mobile Component Descriptor master table.
    This will contain the details of the created MCDs.
    Inorder to insert values in the fields on which we have assigned the check table,
    values must be present in this check table.
    That means , to insert a new value in the NAME field of the MEMSD_DEP table , that entered value must be present in the MEMSD table .
    If T51SYNCBOCONFIG is not in the MEMSD tabel , u cannot insert this value in the table MEMSD_DEP.
    Regards
    Kishor Gopinathan

  • How to add new tab after reason for rejection tab using tcode va01

    Hello,
    how to add new tab after reason for rejection tab using tcode va01.

    Hi,
    You can check this link...
    Hope it will be helpful to you.
    [https://forums.sdn.sap.com/click.jspa?searchID=23016273&messageID=6825861]
    [http://www.sapdevelopment.co.uk/enhance/fexits.htm]
    -Maharshi
    Edited by: Maharshi Vyas on Mar 3, 2009 12:45 PM

  • How do I get separate iCloud accounts for each family members device and still share iTunes?

    how do I get separate iCloud's for each family members iPhone, iPod and iPad and still share iTunes?

    Have everyone share the same iTunes store ID, but use separate IDs for iCloud.  The ID you use for iCloud does not have to be the same as the ID you use for the iTunes & App store.

  • How to get vertical scroll bars for a window?

    hi All,
    i have a window in my smart form ( not main window ) . it displays long text of a PO header. since user can enter huge amount of long text i want to enable vertical scroll bar in smart form window so that it shows all the long text.
    How to enable that for a window in smart form? any pointers would be highly appreciated.
    Thanks,
    Sreekanth.

    Hi
    Only the main window can have a dynamic heigh, all other windows have a static size: so u make sure the long text can be displayed in the window .
    Max

  • How to fix double vertical scroll bar in responsive output

    After implementing the solution provided for the question 'Responsive HTML5 Output: How to auto adjust the screen resolution for all devices?', the function bar in output does not appear and also another vertical scroll bar in the output. I edited the max-width value in the layoutfix.min.css file and fixed the function bar issue. How can I do away with the additional vertical scroll bar?

    I've looked into the issue.
    @Delennish: In your case, the size of the iframe is too large, or you have an extra empty element below the iframe. You can try 2 things:
    1. Best solution but may have side effects: In the main.css, add the following code:
    div.contentholder { overflow: hidden !important;}
    For this option, please check for undesired side effects.
    2. Works, but is ugly: In the main.css, add the following code:
    div.floatholder iframe.wTopic { height: 95% !important;}
    Try playing with the height setting until the 2nd scrollbar disappears.
    @CarolW: The layout you're using is very old. I've made a new responsive layout with TOC only. Please use that one instead: http://www.wvanweelden.eu/sites/default/files/attachments/Theme1_Standard_TOC_Only.zip (I'll update my site with this new version later.)

  • How to add text vertically into a Word margin with C# (using namespace: Microsoft.Office.Interop.Word)

    I need to add text vertically in a word document outside the margins.  How can I do this with Microsoft.Office.Interop.Word and C#?
    Leonard Swarczinski Software Developer Postal Center International

    Hi Leonard,
    According to your description, do you want to add text vertically into Page Header/Footer? I wrote a sample  for you.
    using Microsoft.Office.Core;
    using Microsoft.Office.Interop.Word;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace AddTextToWord
    class Program
    static void Main(string[] args)
    CreateNewDocument();
    Console.ReadLine();
    private static void CreateNewDocument()
    Object oMissing = System.Reflection.Missing.Value;
    Microsoft.Office.Interop.Word.Application oWord;
    Microsoft.Office.Interop.Word.Document oDoc;
    oWord = new Microsoft.Office.Interop.Word.Application();
    oWord.Visible = true;
    oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    String HeaderText = "Hello everyone!";
    WdParagraphAlignment wdAlign = WdParagraphAlignment.wdAlignParagraphCenter;
    AddHeader1(oWord, HeaderText, wdAlign);
    private static void AddHeader1(Application WordApp, string HeaderText, WdParagraphAlignment wdAlign)
    Object oMissing = System.Reflection.Missing.Value;
    WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;
    WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;
    Microsoft.Office.Interop.Word.Shape textBox = WordApp.ActiveDocument.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationVertical, 150, 10, 40, 40);
    textBox.TextFrame.TextRange.Text = HeaderText;
    WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;
    If I misunderstood or anything wrong, please let me know and you can get more information from below articles.
    Office development in Visual Studio
    http://msdn.microsoft.com/en-us/office/hh133430.aspx
    Abhout: AddTextbox Method
    http://msdn.microsoft.com/en-us/library/office/aa171543(v=office.11).aspx
    How to: Programmatically Insert Text into Word Documents
    http://msdn.microsoft.com/en-us/library/vstudio/6b9478cs.aspx

Maybe you are looking for