How to make table column with formula

Hi all..
This is my class
public class MyNumber{
     private int num;
     public int getNum(){
          return num;
     public void setNum( int num){
          this.num = num;
}Consider I design a table with FXML editor ( Scene Builder in this case )
and these are some of my codes
private TableView tab;
private TableColumn<MyNumber, Integer> tabColInput;
private TableColumn tabColOutput;
tab.setEditable(true);
tabColInput.setEditable(true);
tabColInput.setCellValueFactory( new PropertyValueFactory<Person,Integer>("num") );
tabColInput.setCellFactory(TextFieldTableCell.forTableColumn());
tabColInput.setOnEditCommit(
    new EventHandler<CellEditEvent<MyNumber, Integer>>() {
        @Override
        public void handle(CellEditEvent<MyNumber, Integer> t) {
            ((MyNumber) t.getTableView().getItems().get(
                t.getTablePosition().getRow())
                ).setNum(t.getNewValue());
);Problem:
I want to make tabColOutput to always show the result for tabColInput times 2
eg:
When I change a row in tabColInput to 10, tabColOutput will show 20
When I change a row in tabColInput to 3, tabColOutput will show 6
Could anyone advice me how to do this?
Ps: I am not english native speaker, so I am sorry if I am saying it wrong ^^

I just give it a try and it works like magic
Here is how I do it (change a cell from a table by code)
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class TableViewSample extends Application {
    public static final String Column1MapKey = "A";
    public static final String Column2MapKey = "B";
    public static void main(String[] args) {
        launch(args);
    @Override
    public void start(Stage stage) {
        List<MyTableData> listData = new ArrayList<MyTableData>();
        listData.add(new MyTableData("A", 21) );
        listData.add(new MyTableData("B", 24) );
        listData.add(new MyTableData("C", 23) );
        listData.add(new MyTableData("D", 21) );
        listData.add(new MyTableData("E", 22) );
        ObservableList<MyTableData> tableData = FXCollections.observableArrayList(listData);
        Scene scene = new Scene(new Group());
        stage.setTitle("Table View Sample");
        stage.setWidth(300);
        stage.setHeight(500);
        final Label label = new Label("Student IDs");
        label.setFont(new Font("Arial", 20));
        TableColumn<MyTableData, String> firstDataColumn = new TableColumn<MyTableData, String>("NAME");
        TableColumn<MyTableData, Integer> secondDataColumn = new TableColumn<MyTableData, Integer>("AGE");
        firstDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, String>("name"));
//        firstDataColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<MyTableData, String>, ObservableValue<String>>(){
//            @Override
//            public ObservableValue<String> call(CellDataFeatures<MyTableData, String> p) {
//                return p.getValue().nameProperty();
        firstDataColumn.setMinWidth(130);
        secondDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, Integer>("age"));
        secondDataColumn.setMinWidth(130);
        TableView<MyTableData> table_view = new TableView<MyTableData>();
        table_view.setItems(tableData);
        table_view.getColumns().setAll(firstDataColumn, secondDataColumn);
        final VBox vbox = new VBox();
        vbox.setSpacing(5);
        vbox.setPadding(new Insets(10, 0, 0, 10));
        vbox.getChildren().addAll(label, table_view);
        ((Group) scene.getRoot()).getChildren().addAll(vbox);
        stage.setScene(scene);
        stage.show();
        //(this is where I change my table content with code)
        tableData.get(0).setName("xx Gargoyle xx");
        System.out.println("Testing Done");
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class MyTableData{
    private final SimpleStringProperty name;
    private int age;
    public MyTableData(String name, int age) {
        this.name = new SimpleStringProperty(name);
        this.age = age;
    public String getName() {
        return name.get();
    public StringProperty nameProperty(){
        return name;
    public void setName(String name) {
        this.name.set(name);
    public int getAge() {
        return age;
    public void setAge(int age) {
        this.age = age;
}And thank you very much

Similar Messages

  • How to make text columns with adobe muse

    Hi,How to make text columns with adobe muse (like InDesign)?

    Multiple columns can be acheived with CSS - http://www.w3schools.com/css/css3_multiple_columns.asp
    div
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;
    I'm surprised that Muse does not support text columns yet, but perhaps the custom CSS can be added in style tags on page properties. Haven't tried it, but don't see why it wouldn't work.

  • How to make table column of the webdynpro application scrollable??

    Hi all,
    I want to make some columns of my table to be fixed and some to be scrollable...
    So if anybody know how to do it..
    Please do let me know...
    Thanks and regards..

    Shruti,
    If you are using NW 7.0 (NW04s) then check properties:
    -- Table.scrollableColCount
    -- Column.fixedPosition
    Both let you define number of of "fixed" columns at left/right and number of scrollable columns in between.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • How to make tables move with text

    In Pages '09 and Pages 5.0, tables that I set to move with text do not move with text. They overlap text. That is, the table and non-table text occupy the same space, which does not seem to be the intention behind "move with text". In Pages 5.0, I try to fix the problem by selecting a text wrap option such as "Above and below", since I do want text above my table and below my table and I want the table to move with the text when the text changes. But choosing "Above and below" automatically changes the object placement option from "Move with Text" to "Stay on Page", so the table does not move with the text. Re-choosing "Move with Text" once again makes the table and the text overlap, which renders the document unusable.
    I have been frustrated with this behavior for years. I got around it in Pages '09 by using linked text boxes and putting tables outside the text boxes or by putting multi-page tables in their own text boxes without any other text. Since Pages 5.0 does not have linked text boxes, my old work-arounds are no longer possible.
    I must be missing something simple here. What is it?
    Thanks for any help.
    Rick

    If the Table is an inline object then it follows the rules of the text it is sitting in.
    ie Line Spacing, Space Before and Space After.
    The Line Spacing is the crucial specification. The Table should be in its own paragraph and have Line Spacing Multiple set, usually to 1, with before and after spacing to set it off from surrounding text.
    Inline Objects are one case where you should use Multiple Line Spacing because they vary in size and it is best to let Pages work out what space to give them.
    Peter

  • How to make a column in Table popin read only

    Hi Everyone
    Could anyone let me know how to make a column in table popin read only.
    Regards

    if you ar eusing an ALV table
    try this
      DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
            r_table TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
    * get reference to ALV component interface
      lr_salv_wd_table = wd_this->wd_cpifc_alvmain( ).
    * get ConfigurationModel from ALV Component
      wd_this->r_table = lr_salv_wd_table->get_model( ).
    * init ColumnSettings
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_col_header TYPE REF TO cl_salv_wd_column_header.
      lr_column_settings ?= wd_this->r_table.
    * get table of column settings - each line one column
      DATA: lt_columns TYPE salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
    * loop over table - in each loop another column can be modified
      DATA: ls_column TYPE salv_wd_s_column_ref.
    * define visible columns (fields) by naming them,
    * exclude others by setting visibility to none
      DATA: ls_tooltip TYPE string.
      LOOP AT lt_columns INTO ls_column.
        " get header of column
        lr_col_header = ls_column-r_column->get_header( ).
        " do settings here
    ENDLOOP.
    Or see this document for more tips.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4</a>
    regards,
    Joris

  • How to make few columns of single record inactive in Table conrol?

    Hi all,
    Scenario is like this : i have one table control , it is displaying 10 records , in that first four columns are editable. Now my requirement is, whenever record having intial values( suppose one record having initial values among ten) except key field , we need to deactive that particular  record , now table control  should contain ten records , but nine records are in editable state and one record in non editable state .
    How to make few columns of single record inactive in Table conrol?
    Thanks in advance.

    hi there...
    select the column that u want to convert to non editable mode in the screen layout. then double click on it. go to the attributes tab and uncheck the input chk box. the check box will become disabled for input. u can do this for any number of columns.
    if u want to do it dyanamically, loop at screen. check for the screen element's name. when itmatches the column u want to disable, simply set the input value as 0.
    dont forget to modify sscreen after setting the attribute values.
    i hope this helps.
    do reward if helpful.

  • How to make the calculation or formula in bottom of the coloum

    How to make the calculation or formula in bottom of the coloum in Discoverer report.
    Regadrs
    Manikandan

    Hi Ros
    You have a couple of issues, one that is simple to resolve and one that is not so simple.
    First, the simple one - the word TOTAL. To alter the word that Discoverer inserts next to a total, or to even remove the word altogether, use this workflow:
    1. Right-click on the total and from the pop-up menu select Edit Total
    2. At the bottom right-hand corner of the Edit Total dialog box is the area where the label is maintained. You will see a checkbox for the label
    3. If you uncheck the label you can change the label to anything you like, including nothing
    4. After you have set the label, click OK and close the Edit Total dialog box
    Note: In Desktop, this is done via a drop-down from the Total dialog box. If you click the drop-down, the last item in the list is called Generate Label Automatically. If you uncheck this you can create your own label.
    Your second issue concerning the non-totaling of the grand total on some items means that there is something preventing one or more of the totals from calculating. First of all, try to determine which item or items is causing the problem by adding individual totals to each of the desired columns. You will eventually find the column which has the culprit. If you use the above workflow to suppress the display of any labels your total line will look as though you have totaled all items.
    Next, having found the column that will not total, try to figure out why the values will not add up. Could the column be a calculated item? If so, it is possible that you have used SUM on the outside of the calculation, like this:
    SUM(some item - some other item) - this will not total if the original items themselves are in the query and are also being summed. This is because you are mixing aggregate and detail items within the total.
    Try changing the formula like this:
    SUM(some item) - SUM(some other item) and see if this helps.
    If this is not the cause then try changing the formula for that column's total to CELL SUM instead of SUM. This causes Discoverer to literally add the values in the column.
    If this is not the cause, could you possibly be trying to total repeated values? By default, this is disabled in the later versions of Discoverer. The repeated values will be caused if you have multiple joins in your query and the item that you are totaling is from the many end of a one to many relationship. Suppose you had items from a header table and line table in the same worksheet with there being multiple lines for the same header, and now let's say you have a column which is returning something from the header. That value will get repeated and if you try to total it would generate the wrong answer, hence out of the box Discoverer is trying to protect you from yourself.
    However, it could be that the column really should be totaled but because Discoverer has detected a one to many join it will not total that column. To prove that this is the reason, change the join from a one to many to a one to one. Don't worry, this won't stop the query from working. If this allows the total to work then you can either leave the join as it is with a one to one, which won't harm Discoverer or you can edit the pref.txt on the server and change one of the preferences.
    The preference I would change is called AllowAggregationOverRepeatedValues. By default this is disabled and will be set to 0. Changing this to a 1 will now tell Discoverer that repeated values can now be totaled. Don't forget to apply the preferences correctly by execiting applypreferences.bat, on Windows or applypreferences.sh, in Linux or Unix, and then stopping and restarting the Discoverer server.
    I hope this helps
    Best wishes
    Michael Armstrong-Smith
    URL: http://learndiscoverer.com
    Blog: http://learndiscoverer.blogspot.com

  • How to make table as "editable false"

    Dear Forum,
    i am user of jDeveloper jClient/Swing .jpr.
    cutomer table having following attributes-
    1.cust_id (primary key)
    2.cust_name
    3.cust_add
    Suppose customerview bind with jTable1.
    Using ViewObjectEditor, i set "updateable never" for all fields.
    This show error, when data insert into table " cust_id as
    read only".
    Help me, Using jClient Binding how to make Table as "editable false".

    Overriding method prepareEditor() for new table:
    private JTable tableList = new JTable(){
    public Component prepareEditor(TableCellEditor editor, int row, int column) {
    // 1 and 2 column is not editable
    if(column == 0 || column == 1){ return null; }
    return super.prepareEditor(editor, row, column);

  • HOW TO MAKE TABLE CONTROL NON EDITABLE

    hi all
    how to make table control non editable
    Thanks & Regards
    harsha

    Hi,
    Try this code in the PBO inside the module in the LOOP...ENDLOOP.
       IF SY-TCODE EQ 'ZEMPLDISPLAY'.
        LOOP AT SCREEN.
         if screen-name eq 'column1' or screen-name eq 'column2'.  "Give the names of the columns in the table control
          SCREEN-INPUT = '0'.
          MODIFY SCREEN.
        endif.
        ENDLOOP.
      ENDIF.
    Or you can go the Layout of the table control in Change mode and for every column's attributes, make it 'Output' only field. Check  'Output only' field.

  • How to make table that will include controls such as drop list?

    How to make table that will include controls such as drop list?
    I need to create table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...

    Hi Nadav,
    I figured out where I missed your point. When you wrote
    table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...
    I was thinking mixed data-types in a [2d] table!
    Looking at the property browser again it looks like no single LV function can do all of that. It can be developed as a pop-up (like the browser is set-up) and then code all of the elegance using an event structure to control the background color of a string indicator while controling the visability of rings that are only made visable when a mouse down is detected. That will get you pretty close.
    So no, my previous response ws not correct for what you are trying to do if you want to duplicate all of the wistles and bells of the property browser pop-up window.
    Please forgive my distraction.
    Ben 
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to make a column as command link

    hi,
    how to make a column as command link.i want to make a table column as a command link so that a popup will come.please let me know.
    thanks in advance

    JDeveloper 10.1.3 does not have a popup but a dialog framework that opens a dialog in a separate browse window. As Chris pointed out, the developer guide contains a section about how to launch the dialog. To programmatically launch the dialog from a command link use its action listener property
        public void commandButton_action2(ActionEvent event) {
    // make the clicked row the current
      //Get access to the value binding
       ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{bindings.DepartmentsView1Iterator}");
       DCIteratorBinding dciter = (DCIteratorBinding) vb.getValue(FacesContext.getCurrentInstance());
      //the command link is a child of af:column, which is a child of af:table
      CoreTable ct = (CoreTable)actionEvent.getComponent().getParent().getParent();
      //access the row data, to obtain the Row object and the formatted key string
      JUCtrlValueBindingRef juctrlref = (JUCtrlValueBindingRef) ct.getRowData();
      String rowKey = juctrlref.getRow().getKey().toStringFormat(true);
    //set the current row in the binding
      dciter.setCurrentRowWithKey(rowKey);
    // open dialog
            FacesContext fctx = FacesContext.getCurrentInstance();
            AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
            UIViewRoot viewRoot = new UIViewRoot();
            viewRoot.setViewId("/yourDialogPage.jspx");
            HashMap properties = new HashMap();
            properties.put("width",300);
            properties.put("height",200);       
            adfFacesCtx.launchDialog(viewRoot,properties,(CoreCommandLink)event.getSource(),true,null);
      }If the dialog is based on the same VO then the current row is selected. If not then you may want to pass the value ofthe rowKey in a HashMap as the last argument to open dialog
    Frank

  • How to make 1st column as header in ALV grid

    Hi Experts,
    How to make 1st column as header in ALV grid as attached. Please help.
    Thanks in advance.

    Hi manoj,
    Try with,
    FM REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Regards,
    Venkat.

  • Move Table Column with AppleScript in Microsoft Word

    Microsoft Word has a flaw (in my opinion) with tables in that it aligns the left and right text with the margins rather than aligning the table columns with the margins. This results in sloppy tables, because the left and right borderlines lie outside the margins.
    I would like to fix the word tables by
    calculating the left cell padding and right cell padding in points and setting them to variables {left_pad,right_pad} respectively
    move left column by left_pad to the right
    move right column by right_pad to the left
    The script I was working on does not work, but I will post it to show my thought process as I hone in on my solution.
    tell application "Microsoft Word"
        --595 points is width of A4 paper
        -- Set page margin in points to variables
        set {l_margin, r_margin, t_margin, b_margin} to {(get left margin of page setup of active document), get (right margin of page setup of active document), get (top margin of page setup of active document), get (bottom margin of page setup of active document)}
        get {l_margin, r_margin, t_margin, b_margin}
        -- Set specific Paragraph margins
        -- NOTE: If you select a table thinking you wish to drag just the left margin to the right, or the right margin to the left, this code does not accomplish this because each cell has its own paragraph formatting. This code will set the margin for every single cell, because each cell has its own margins! (separate from padding).
        set para_sel to paragraph format of selection
        set paragraph format left indent of para_sel to (centimeters to points centimeters 0.5)
        -- Aligning left and right columns of table with the margins
        -- NOTE: There is a command to set left row indent, but not right row indent (very stupid of Microsoft)
    end tell

    I have worked up something that seems to work (although I cannot promise it is the best way). Hope it helps anyone else who has this need.
    tell application "Microsoft Word"
    activate
    set findRange to find object of selection
    clear formatting findRange -- clear any previous formatting used in a find operation
    set forward of findRange to true -- find forward
    set style of findRange to "List Bullet" -- the style to look for
    tell findRange
    set gotIt to execute find find text "" -- do the search w/o matching any text
    end tell
    if gotIt is true then -- if a match was found
    copy object selection -- copy it to the clipboard
    set mySelection to (the clipboard) -- then put clipboard into a variable
    set myOffset to ¬
    (get selection information selection information type ¬
    (horizontal position relative to page)) -- now put selection info into a variable
    display dialog mySelection & return & (myOffset as text) -- then display it
    end if
    end tell

  • Hiding Table Columns with the Spry Element Selector

    I am trying to set up a toggle button that will show/hide
    rows >1 when clicked. I've used Adobe's
    "Hiding
    Table Columns with the Spry Element Selector" example and it
    worked fine with an HTML list, until I linked to actual XML data.
    Now it works in reverse. What gives?
    Here's the example:
    http://a44.awardspace.com/testing/toggleShowHideRows.htm

    That's what I started with. Same result:
    http://a44.awardspace.com/testing/toggleShowHideRows.htm

  • How to make turning page with ibooks author?

    How to make turning page with ibooks author?

    This question has been answered on this thread
    https://discussions.apple.com/message/17981772#17981772#17981772
    Best regards.
    Alex

Maybe you are looking for

  • Manually and quickly updating smart playlists with 'Live Updating' off?

    Hi, I have a quite large music library (13,000 songs) and use a multitude of nested smart playlists that change often because I don't want to listen to the same song every day and I want to listen to good songs more often than bad songs. I'm also spl

  • Displaying a link to a file

    Hi, I have a page with an Item Region containing a series of File items. From a PL/SQL Portlet, I want to be able to retrieve details of those files (which I can do from WWSBR_ALL_ITEMS) and show a link to each file, so that when I click, the file op

  • Change font size? - NEED ANSWER

    I've scanned this discussion and see many people asking the same question but no answers: Is it possible to change the displayed font size in the calendar view? If it simply isn't possible please be kind enough to tell us. Thank you.

  • Regarding app store in the older iphone

    i use my 1st generation iphone and i havent updated it. does the app store work in the 1st generation iphone? or is there any other way to get the other applications. do i have to update my iphone's software to make the app store work. please help..

  • Elements 12 organizer error bec. Mac osx is 10.6.8 latest version available from MAC

    Process:         Adobe Elements 12 Organizer [17765] Path:            /Applications/Adobe Elements 12 Organizer.app/Contents/MacOS/Adobe Elements 12 Organizer Identifier:      com.adobe.ElementsOrganizer12 Version:         ??? (???) Code Type: