Staining of cells TableView (new)

Here is another question from staining of cells with a different plug.

You have a TableView with three columns - category, inside and out. You add a blank line and then you start to edit the category column. When you have added a category you want to see a change in the color of the other cells two columns in the same row as the value of the category.

Say if the category is "income" then the cell 'In' will become green and the 'Out' cell becomes red. The important point here is that these cells and the underlying domain object has not all the values associated with these columns again. The cells are empty and color change is to show the user where the value must be set for the category concerned (in the green cell ).

After that the category value is committed a 'message' must therefore being propagated in the category for the current line (or the entire table) column to extricate himself. I tried to call the following methods of method 'commit()' of the category column, but none of them does raise a repaint:

-getTableRow () .requestLayout ();

-getTableRow (.updateTableView) (getTableView ())

-getTableRow (.updateIndex) (getTableView () .selectionModelProperty () .get () .selectedIndexProperty () .get ());

Any suggestion of work would be more then welcomed.

Once paint it is triggered then incoming and outgoing of cells in a table column can take the current value of the underlying domain object category (say MyRecord) like this

Registration of MyRecord = getTableView () .getItems () .get (getTableRow () .getIndex ());

String category = row.getCategory ();

and call the setStyle ("...") on the cell to change the color.

Isn't time for a complete example now, but a strategy is:

Set a rowFactory on the table view that returns a table row that falls into the category for its corresponding article. Update the class style (in JavaFX 2.2) or a State of alright (in Java 8) for the row in the table according to the category.

Define a factory of cells for columns that statically defines a class on cells (for example 'in' and 'out').

Use an external style sheet that looks like this:

.table-row-cell.income .table-cell.in, .table-row-cell.expenditure .table-cell.out {
-fx-background-color: green ;
}

.table-row-cell.income .table-cell.out, .table-row-cell.expenditure .table-cell.in {
-fx-background-color: red ;
}

Here is an example of a row of table factory that manipulates the class style of the table cell. There is a link to a version that uses Java 8 alright States, that is much cleaner.

Tags: Java

Similar Questions

  • Cell TableView coloring on updates - realizing if sort happened

    I'm doing has highlighted cells (in color) in a TableView whenever they are updated. My solution is based on the implementation of cell factories and use Animation (mounting) control cell background opacity - it works very well: whenever a cell value is updated, the background changes color, then fades away well.

    The problem is, that if the table is sorted by clicking a column header, the underlying list is changed (of course), and the GUI level, it is also understood as a change and depending on the circumstances by cell (I flash a cell if its new value is different from the previous), several cells show an update unnecessarily (flashing).

    I wonder how I could eliminate if a cell has been updated due to a 'real' update (an element has been updated) of the case when the list sort column and/or the order has been changed? I thought to catch the event of sorting (by adding an InvalidationListener to the sort order list) and ignore the updates, while it is underway, but I can't really know when it's over. I bet at the GUI level, there is no way to determine the reason, so I need a deeper understanding...

    Thanks for the tips.

    Register a listener for change with the appropriate property to change the highlight color for the cell according to the case. You need to do a bit of work to make sure that the listener is registered and non-registered as appropriate that the cell is reused for the different table elements: the trick is to use

    Bindings.Select (tableRowProperty (), "point")

    to get an observable of the current value of the line.

    Update:

    Well, the previous example did not work. For reasons I can't understand, after sorting (or scroll, in fact), the evil cell became the property change notifications.

    So here's another strategy: keep track of the last known value of the cell line, and don't make the highlight is still called same rank value after the update. I prefer kind of the strategy described above, but I couldn't make it work.

    import java.text.NumberFormat;
    import java.util.Arrays;
    import java.util.List;
    import java.util.Random;
    
    import javafx.animation.FadeTransition;
    import javafx.animation.KeyFrame;
    import javafx.animation.Timeline;
    import javafx.application.Application;
    import javafx.beans.property.DoubleProperty;
    import javafx.beans.property.ReadOnlyStringProperty;
    import javafx.beans.property.ReadOnlyStringWrapper;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Pos;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.StackPane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    import javafx.util.Duration;
    
    public class TableChangeHighlightExample extends Application {
    
     @Override
      public void start(Stage primaryStage) {
        final Random rng = new Random();
      final TableView table = new TableView<>();
      table.getItems().addAll(createData(rng));
    
      TableColumn symbolColumn = new TableColumn<>("Symbol");
      TableColumn priceColumn = new TableColumn<>("Price");
      symbolColumn.setCellValueFactory(new PropertyValueFactory("symbol"));
      priceColumn.setCellValueFactory(new PropertyValueFactory("price"));
      priceColumn.setCellFactory(new Callback, TableCell>() {
          @Override
          public TableCell call(TableColumn table) {
            return new StockPriceCell();
          }
      });
      table.getColumns().addAll(Arrays.asList(symbolColumn, priceColumn));
    
      Timeline changeStockPricesRandomly = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler() {
        @Override
        public void handle(ActionEvent event) {
          StockValue stockToChange = table.getItems().get(rng.nextInt(table.getItems().size()));
          double changeFactor = 0.9 + rng.nextInt(200) / 1000.0 ;
          double oldPrice = stockToChange.getPrice();
          double newPrice = oldPrice * changeFactor ;
    //     System.out.println("Changing price for "+stockToChange+" to "+newPrice);
          stockToChange.setPrice(newPrice) ;
        }
      }));
      changeStockPricesRandomly.setCycleCount(Timeline.INDEFINITE);
      changeStockPricesRandomly.play();
    
      BorderPane root = new BorderPane();
      root.setCenter(table);
      primaryStage.setScene(new Scene(root, 300, 400));
      primaryStage.show();
      }
    
      private List createData(Random rng) {
        return Arrays.asList(
          new StockValue("ORCL", 20.0 + rng.nextInt(2000)/100.0),
          new StockValue("AAPL", 300.0 + rng.nextInt(20000)/100.0),
          new StockValue("GOOG", 500.0 + rng.nextInt(100000)/100.0),
          new StockValue("YHOO", 20.0 + rng.nextInt(2000)/100.0),
          new StockValue("FB", 20.0 + rng.nextInt(1000)/100.0)
        );
      }
    
      public static void main(String[] args) {
      launch(args);
      }
    
      public static class StockPriceCell extends TableCell {
        private static final Color INCREASE_HIGHLIGHT_COLOR = Color.GREEN ;
        private static final Color DECREASE_HIGHLIGHT_COLOR = Color.RED ;
        private static final Duration HIGHLIGHT_TIME = Duration.millis(500);
    
        private static final NumberFormat formatter = NumberFormat.getCurrencyInstance();
    
        private final Label priceLabel ;
        private final Rectangle overlayRectangle ;
        private StockValue lastRowValue ;
    
        public StockPriceCell() {
          overlayRectangle = new Rectangle();
          overlayRectangle.setFill(Color.TRANSPARENT);
          overlayRectangle.widthProperty().bind(this.widthProperty().subtract(8));
          overlayRectangle.heightProperty().bind(this.heightProperty().subtract(8));
          overlayRectangle.setMouseTransparent(true);
    
          this.priceLabel = new Label();
          priceLabel.setMaxWidth(Double.POSITIVE_INFINITY);
          priceLabel.setAlignment(Pos.CENTER_RIGHT);
          StackPane pane = new StackPane();
          pane.getChildren().addAll(overlayRectangle, priceLabel);
          setGraphic(pane);
        }
    
        @Override
        protected void updateItem(Double price, boolean empty) {
          Double oldPrice = getItem();
          super.updateItem(price, empty);
          StockValue currentRowValue = null ;
          if (getTableRow()!=null) {
            currentRowValue = (StockValue) getTableRow().getItem();
          }
          if (empty) {
            priceLabel.setText(null);
          } else {
            priceLabel.setText(formatter.format(price));
            if (price != null && oldPrice != null && currentRowValue == lastRowValue) {
              if (price.doubleValue() > oldPrice.doubleValue()) {
                overlayRectangle.setFill(INCREASE_HIGHLIGHT_COLOR);
              } else if (price.doubleValue() < oldPrice.doubleValue()) {
                overlayRectangle.setFill(DECREASE_HIGHLIGHT_COLOR);
              }
              FadeTransition fade = new FadeTransition(HIGHLIGHT_TIME, overlayRectangle);
              fade.setFromValue(1);
              fade.setToValue(0);
              fade.play();
            }
          }
          lastRowValue = currentRowValue ;
        }
      }
    
     public static class StockValue {
        private final ReadOnlyStringWrapper symbol ;
        private final DoubleProperty price ;
        public StockValue(String symbol, double price) {
          this.symbol = new ReadOnlyStringWrapper(this, "symbol", symbol);
          this.price = new SimpleDoubleProperty(this, "price", price);
        }
        public final ReadOnlyStringProperty symbolProperty() {
          return symbol.getReadOnlyProperty();
        }
        public final String getSymbol() {
          return symbol.get();
        }
        public final DoubleProperty priceProperty() {
          return price ;
        }
        public final double getPrice() {
          return price.get();
        }
        public final void setPrice(double price) {
          this.price.set(price);
        }
        @Override
        public String toString() {
          return symbol.get() + " : " + price.get() ;
        }
      }
    }
    

    Post edited by: James_D

  • TableView containing the format of table TextFieldTableCells

    Hello

    I have a TableView consisting of columns of TextFieldTableCells and I would format a cell based on another cell in the same row value. As the CellFactory is fixed for each of the TableColumns use a TextFieldTableCell.forColumn (), how can I optimize both the cell formatting and access to the row in the same call updateItem object?

    IM really stuck thereby and would appreciate pointers.

    See you soon

    Andy

    It has much in common with the cell TableView coloring updates - realizing if sort arrived: you might want to take a look at the response to this first.

    How can I get both the cell formatting

    TextFieldTableCell subclass and override the updateItem() method to do the formatting. If you format conditionally other properties (for example other columns) which can change, you will need to listen to these properties for changes. You must handle the listener carefully that the cell can be reused for different elements in the table. This part is similar to the above thread.

    and access to the line in the same call updateItem object

    Use getTableRow () .getItem () to access the value of the row in the table. You can also use table.getItems () .get (getIndex). Both methods require audits: getTableRow() does not return null, which the getIndex() return a value in the range.

    My Canon, revised example for this question:

    import java.util.Arrays;
    import java.util.List;
    
    import javafx.application.Application;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableRow;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.CheckBoxTableCell;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.control.cell.TextFieldTableCell;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    import javafx.util.StringConverter;
    
    public class FormattedTableWithTextFields extends Application {
    
      @Override
      public void start(Stage primaryStage) {
        final BorderPane root = new BorderPane();
        final TableView table = new TableView();
        table.setItems(createData());
        final TableColumn firstNameColumn = new TableColumn<>("First Name");
        final TableColumn lastNameColumn = new TableColumn<>("Last Name");
        final TableColumn injuredColumn = new TableColumn<>("Injured");
        firstNameColumn.setCellValueFactory(new PropertyValueFactory("firstName"));
        lastNameColumn.setCellValueFactory(new PropertyValueFactory("lastName"));
        injuredColumn.setCellValueFactory(new PropertyValueFactory("injured"));
        injuredColumn.setCellFactory(CheckBoxTableCell.forTableColumn(injuredColumn));
        injuredColumn.setEditable(true);
    
        installCustomTextFieldCellFactory(firstNameColumn);
        installCustomTextFieldCellFactory(lastNameColumn);
    
        table.setEditable(true);
        table.getColumns().addAll(firstNameColumn, lastNameColumn, injuredColumn);
    
        root.setCenter(table);
    
        Button button = new Button("Dump info");
        button.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            for (Player p : table.getItems()) {
              System.out.println(p);
            }
            System.out.println();
          }
        });
        root.setBottom(button);
        final Scene scene = new Scene(root, 400, 600);
        scene.getStylesheets().add(getClass().getResource("formattedTableWithTextFields.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      private void installCustomTextFieldCellFactory(TableColumn column) {
        column.setCellFactory(new Callback, TableCell>() {
    
          @Override
          public TableCell call(TableColumn column) {
            return new StyledTextFieldTableCell();
          }
    
        });
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    
      private ObservableList createData() {
        List players = Arrays.asList(
            new Player("Hugo" ,"Lloris", false),
            new Player("Brad", "Friedel", false),
            new Player("Kyle", "Naughton", false),
            new Player("Younes", "Kaboul", true),
            new Player("Benoit", "Assou-Ekotto", false),
            new Player("Jan", "Vertonghen", false),
            new Player("Michael", "Dawson", false),
            new Player("William", "Gallas", true),
            new Player("Kyle", "Walker", false),
            new Player("Scott", "Parker", false),
            new Player("Mousa", "Dembele", false),
            new Player("Sandro", "Cordeiro", true),
            new Player("Tom", "Huddlestone", false),
            new Player("Gylfi","Sigurdsson", false),
            new Player("Gareth", "Bale", false),
            new Player("Aaron", "Lennon", false),
            new Player("Paulinho", "Maciel", false),
            new Player("Jermane", "Defoe", false),
            new Player("Emmanuel", "Adebayor", true)
        );
    
        return FXCollections.observableArrayList(players);
      }
    
      private static class StyledTextFieldTableCell extends TextFieldTableCell {
    
        private final ChangeListener injuredListener ;
        private Player previousPlayer ;
    
        StyledTextFieldTableCell() {
          // Seems we have to set a trivial string converter:
          super(new StringConverter() {
            @Override
            public String fromString(String string) {
              return string;
            }
            @Override
            public String toString(String object) {
              return object;
            }
          });
    
          injuredListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue observable,
                Boolean oldValue, Boolean newValue) {
              if (newValue) {
                ensureInjuredStyleClass();
              } else {
                ensureNoInjuredStyleClass();
              }
            }
          };
        }
    
        @Override
        public void updateItem(String item, boolean empty) {
          super.updateItem(item, empty);
          Player currentPlayer = null ;
          TableRow tableRow = getTableRow();
          if (tableRow != null) {
            currentPlayer = tableRow.getItem();
          }
          if (previousPlayer != currentPlayer) {
            if (previousPlayer != null) {
              previousPlayer.injuredProperty().removeListener(injuredListener);
            }
            if (currentPlayer != null) {
              currentPlayer.injuredProperty().addListener(injuredListener);
              if (currentPlayer.isInjured() ) {
                ensureInjuredStyleClass();
              } else if (! currentPlayer.isInjured()) {
                ensureNoInjuredStyleClass();
              }
            }
            previousPlayer = currentPlayer ;
          }
        }
    
        private void ensureNoInjuredStyleClass() {
          while (getStyleClass().contains("injured")) {
            getStyleClass().remove("injured");
          }
        }
        private void ensureInjuredStyleClass() {
          if (! getStyleClass().contains("injured")) {
            getStyleClass().add("injured");
          }
        }
      }
    
      public static class Player {
        private final StringProperty firstName ;
        private final StringProperty lastName ;
        private final BooleanProperty injured ;
        Player(String firstName, String lastName, boolean international) {
          this.firstName = new SimpleStringProperty(this, "firstName", firstName);
          this.lastName = new SimpleStringProperty(this, "lastName", lastName);
          this.injured = new SimpleBooleanProperty(this, "injured", international);
        }
        public String getFirstName() { return firstName.get(); }
        public void setFirstName(String firstName) { this.firstName.set(firstName);}
        public StringProperty firstNameProperty() { return firstName ; }
        public String getLastName() { return lastName.get(); }
        public void setLastName(String lastName) { this.lastName.set(lastName); }
        public StringProperty lastNameProperty() { return lastName ; }
        public boolean isInjured() { return injured.get(); }
        public void setInjured(boolean international) { this.injured.set(international); }
        public BooleanProperty injuredProperty() { return injured ; }
        @Override
        public String toString() {
          return firstName.get() + " " + lastName.get() + (injured.get()?" (injured)":"");
        }
      }
    }
    

    And the css (formattedTableWithTextFields.css):

    @CHARSET "US-ASCII";
    .table-cell.injured .text-field, .table-cell.injured .label {
     -fx-text-fill: red ;
    }
    .table-cell.injured .text {
      -fx-fill: red ;
    }
    

    Post edited by: James_D (slight refactor code, added css)

  • ComboBox is updated inside a TableView

    I'm having a problem that while scrolling the TableView the ComboBox values are updated. How can I avoid this behavior.

    import javafx.application.Application;
     
    import javafx.scene.Group;
     
    import javafx.scene.Scene;
     
    import javafx.stage.Stage;
     
    import javafx.beans.property.BooleanProperty;
     
    import javafx.beans.property.SimpleBooleanProperty;
     
    import javafx.beans.property.StringProperty;
     
    import javafx.beans.property.SimpleStringProperty;
     
    import javafx.beans.value.ChangeListener;
     
    import javafx.beans.value.ObservableValue;
     
    import javafx.collections.FXCollections;
     
    import javafx.collections.ObservableList;
     
    import javafx.event.EventHandler;
     
    import javafx.geometry.Pos;
     
    import javafx.scene.control.CheckBox;
    import javafx.scene.control.ComboBox;
     
    import javafx.scene.control.TableCell;
     
    import javafx.scene.control.TableColumn;
     
    import javafx.scene.control.TableColumn.CellEditEvent;
     
    import javafx.scene.control.TableView;
     
    import javafx.scene.control.TextField;
     
    import javafx.scene.control.cell.PropertyValueFactory;
     
    import javafx.scene.input.KeyCode;
     
    import javafx.scene.input.KeyEvent;
    import javafx.scene.layout.VBox;
     
    import javafx.util.Callback;
     
     
     
    /**
    
     * A simple table that uses cell factories to add a control to a table
    
     * column and to enable editing of first/last name and email.
    
     *
    
     * @see javafx.scene.control.TableCell
    
     * @see javafx.scene.control.TableColumn
    
     * @see javafx.scene.control.TablePosition
    
     * @see javafx.scene.control.TableRow
    
     * @see javafx.scene.control.TableView
    
     */
     
    public class Experiment extends Application {
         ObservableList<Person> data = null ;
         static CheckBox checkBox;
         static ComboBox comboBox;
     
     
        @SuppressWarnings({ "unchecked", "rawtypes" })
         private void init(Stage primaryStage) {
     
            Group root = new Group();
     
            primaryStage.setScene(new Scene(root));
            
           checkBox = new CheckBox();
           comboBox = new ComboBox();
     
            data = FXCollections.observableArrayList(
                    new Person(true, "Jacob", "Smith", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Isabella", "Johnson", "[email protected]"),
                    new Person(true, "Ethan", "Williams", "[email protected]"),
                    new Person(true, "Emma", "Jones", "[email protected]"),
                    new Person(false, "Michael", "Brown", "[email protected]"));
     
            //"Invited" column
     
            TableColumn invitedCol = new TableColumn<Person, Boolean>();
            invitedCol.setText("Invited");
            invitedCol.setMinWidth(50);
            invitedCol.setCellValueFactory(new PropertyValueFactory("invited"));
            invitedCol.setCellFactory(new Callback<TableColumn<Person, Boolean>, TableCell<Person, Boolean>>() {
     
     
     
                public TableCell<Person, Boolean> call(TableColumn<Person, Boolean> p) {
                    return new CheckBoxTableCell<Person, Boolean>();
                }
     
            });
            
          
     
            //"First Name" column
     
            @SuppressWarnings("rawtypes")
              TableColumn firstNameCol = new TableColumn();
     
            firstNameCol.setText("First");
     
            firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
     
            //"Last Name" column
     
            TableColumn lastNameCol = new TableColumn();
     
            lastNameCol.setText("Last");
     
            lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
     
            //"Email" column
     
            TableColumn emailCol = new TableColumn();
     
            emailCol.setText("Email");
     
            emailCol.setMinWidth(200);
     
            emailCol.setCellValueFactory(new PropertyValueFactory("email"));
     
     
     
            //Set cell factory for cells that allow editing
     
            Callback<TableColumn, TableCell> cellFactory =
     
                    new Callback<TableColumn, TableCell>() {
     
     
     
                        public TableCell call(TableColumn p) {
     
                            return new EditingCell();
     
                        }
     
                    };
     
            emailCol.setCellFactory(cellFactory);
     
            firstNameCol.setCellFactory(cellFactory);
     
            lastNameCol.setCellFactory(cellFactory);
     
     
     
            //Set handler to update ObservableList properties. Applicable if cell is edited
     
            updateObservableListProperties(emailCol, firstNameCol, lastNameCol);
     
     
     
            TableView tableView = new TableView();
     
            tableView.setItems(data);
     
            //Enabling editing
            
            VBox vb = new VBox();
     
            tableView.setEditable(true);
     
            tableView.getColumns().addAll(invitedCol, firstNameCol, lastNameCol, emailCol);
            
            
        CheckBox cb =  new CheckBox("Select all");
        cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
            public void changed(ObservableValue<? extends Boolean> ov,
                Boolean old_val, Boolean new_val) {
                if (new_val) {
                  for (  Person p : data ) {
                     p.invited.set(true);
                  } 
                
                }
        
                    
            }
        });
     
            
            vb.getChildren().addAll(cb, tableView);      
            root.getChildren().addAll(vb); 
     
        }
     
     
     
      @SuppressWarnings("unchecked")
    private void updateObservableListProperties(TableColumn emailCol, TableColumn firstNameCol,
     
                TableColumn lastNameCol) {
     
            //Modifying the email property in the ObservableList
     
            emailCol.setOnEditCommit(new EventHandler<CellEditEvent<Person, String>>() {           
     
                @Override public void handle(CellEditEvent<Person, String> t) {
     
                    ((Person) t.getTableView().getItems().get(
     
                            t.getTablePosition().getRow())).setEmail(t.getNewValue());
     
                }
     
            });
     
            //Modifying the firstName property in the ObservableList
     
            firstNameCol.setOnEditCommit(new EventHandler<CellEditEvent<Person, String>>() {          
     
                @Override public void handle(CellEditEvent<Person, String> t) {
     
                    ((Person) t.getTableView().getItems().get(
     
                            t.getTablePosition().getRow())).setFirstName(t.getNewValue());
     
                }
     
            });
     
            //Modifying the lastName property in the ObservableList
     
            lastNameCol.setOnEditCommit(new EventHandler<CellEditEvent<Person, String>>() {           
     
                @Override public void handle(CellEditEvent<Person, String> t) {
     
                    ((Person) t.getTableView().getItems().get(
     
                            t.getTablePosition().getRow())).setLastName(t.getNewValue());
     
                }
     
            });
     
        }    
     
         
     
        //Person object
     
        public static class Person {
     
            private BooleanProperty invited;
     
            private StringProperty firstName;
     
            private StringProperty lastName;
     
            private StringProperty email;
     
             
     
            private Person(boolean invited, String fName, String lName, String email) {
     
                this.invited = new SimpleBooleanProperty(invited);
     
                this.firstName = new SimpleStringProperty(fName);
     
                this.lastName = new SimpleStringProperty(lName);
     
                this.email = new SimpleStringProperty(email);
     
                this.invited = new SimpleBooleanProperty(invited);
     
                 
     
                this.invited.addListener(new ChangeListener<Boolean>() {
     
                    public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
     
                        System.out.println(firstNameProperty().get() + " invited: " + t1);
     
                    }
     
                });            
     
            }
     
     
     
            public BooleanProperty invitedProperty() { return invited; }
     
      
     
            public StringProperty firstNameProperty() { return firstName; }
     
     
     
            public StringProperty lastNameProperty() { return lastName; }
     
      
     
            public StringProperty emailProperty() { return email; }
     
     
     
            public void setLastName(String lastName) { this.lastName.set(lastName); }
     
      
     
            public void setFirstName(String firstName) { this.firstName.set(firstName); }
     
       
     
            public void setEmail(String email) { this.email.set(email); }
     
        }
     
     
     
        //CheckBoxTableCell for creating a CheckBox in a table cell
     
        public static class CheckBoxTableCell<S, T> extends TableCell<S, T> {
     
           private final ComboBox comboBox;
           private final  ObservableList<String> data4 =  FXCollections.observableArrayList("Fun", "Ball", "Bat", "Car");
           
     
            private ObservableValue<T> ov;
     
     
     
            public CheckBoxTableCell() {
     
                this.comboBox = new ComboBox();
    
                comboBox.setItems(data4);
     
     
     
                setAlignment(Pos.CENTER);
     
                setGraphic(comboBox);
            } 
     
             
     
            @Override public void updateItem(T item, boolean empty) {
     
                super.updateItem(item, empty);
                
                
     
                if (empty) {
     
                    setText(null);
     
                    setGraphic(null);
     
                } else {
     
                             setGraphic(comboBox);
                          
      
                    if (ov instanceof BooleanProperty) {
     
                        checkBox.selectedProperty().unbindBidirectional((BooleanProperty) ov);
     
                    }
     
                    
                    ov = getTableColumn().getCellObservableValue(getIndex());
                   
                    if (ov instanceof BooleanProperty) {
     
                        checkBox.selectedProperty().bindBidirectional((BooleanProperty) ov);
     
                    }
     
                }
     
            }
     
        }
     
     
     
        // EditingCell - for editing capability in a TableCell
     
        public static class EditingCell extends TableCell<Person, String> {
     
            private TextField textField;
     
     
     
            public EditingCell() {
     
            }
     
            
     
            @Override public void startEdit() {
     
                super.startEdit();
     
     
     
                if (textField == null) {
     
                    createTextField();
     
                }
     
                setText(null);
     
                setGraphic(textField);
     
                textField.selectAll();
     
            }
     
            
     
            @Override public void cancelEdit() {
     
                super.cancelEdit();
     
                setText((String) getItem());
     
                setGraphic(null);
     
            }
     
            
     
            @Override public void updateItem(String item, boolean empty) {
     
                super.updateItem(item, empty);
     
                if (empty) {
     
                    setText(null);
     
                    setGraphic(null);
     
                } else {
     
                    if (isEditing()) {
     
                        if (textField != null) {
     
                            textField.setText(getString());
     
                        }
     
                        setText(null);
     
                        setGraphic(textField);
     
                    } else {
     
                        setText(getString());
     
                        setGraphic(null);
     
                    }
     
                }
     
            }
     
     
     
            private void createTextField() {
     
                textField = new TextField(getString());
     
                textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
     
                textField.setOnKeyReleased(new EventHandler<KeyEvent>() {                
     
                    @Override public void handle(KeyEvent t) {
     
                        if (t.getCode() == KeyCode.ENTER) {
     
                            commitEdit(textField.getText());
     
                        } else if (t.getCode() == KeyCode.ESCAPE) {
     
                            cancelEdit();
     
                        }
     
                    }
     
                });
     
            }
     
     
     
            private String getString() {
     
                return getItem() == null ? "" : getItem().toString();
     
            }
     
        } 
     
     
     
        @Override public void start(Stage primaryStage) throws Exception {
     
            init(primaryStage);
     
            primaryStage.show();
     
        }
     
        public static void main(String[] args) { launch(args); }
     
    }
     

    I think you should start by defining your model; simply copy the class Person here is obviously not going to work. It is difficult to incorporate the ComobBox until you have data to define this option is selected. Once you have defined your data model, which is a class whose instances represent each row in the table, then it should be much easier to understand how to write the updateItem (...) method.

  • Anyone can focus a TableView element properly?

    Run the following code:

    It's a simple TableView... now, try without clicking with the mouse or by using the cursor keys to navigate this TableView using nothing more than the page - up and page-down keys. It does not work. After you select an item with the mouse, or navigate once with the cursor, THEN pg-up/page-down keys work also.

    How can I fix these keys work early?
    package hs.javafx;
    
    import javafx.application.Application;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.scene.Scene;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TablePosition;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class PgDownTableViewTest extends Application {
    
      public static void main(String[] args) {
        Application.launch(args);
      }
    
      @Override
      public void start(Stage primaryStage) throws Exception {
        VBox vbox = new VBox();
        final TableView<Person> tableView = new TableView<>();
    
        for(int i = 0; i < 100; i++) {
          tableView.getItems().add(new Person("John" + i, "Hendrikx" + i));
        }
    
        TableColumn<Person, String> firstColumn = new TableColumn<>("First name");
        TableColumn<Person, String> secondColumn = new TableColumn<>("Last name");
        firstColumn.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName"));
        secondColumn.setCellValueFactory(new PropertyValueFactory<Person, String>("lastName"));
        tableView.getColumns().add(firstColumn);
        tableView.getColumns().add(secondColumn);
    
        final TextField textField1 = new TextField();
        final TextField textField2 = new TextField();
    
        vbox.getChildren().addAll(tableView, textField1, textField2);
    
        Scene scene = new Scene(vbox);
    
    //    scene.focusOwnerProperty().addListener(new ChangeListener() {
    //      @Override
    //      public void changed(ObservableValue arg0, Object arg1, Object arg2) {
    //        System.out.println(">>> focus : " +arg2);
    //      }
    //    });
    
        primaryStage.setScene(scene);
    
        primaryStage.show();
    
        // attempts at given proper focus...
        tableView.requestFocus();
        tableView.focusModelProperty().get().focus(new TablePosition(tableView, 0, firstColumn));
        tableView.focusModelProperty().get().focusBelowCell();
      }
    
      public class Person {
        private StringProperty firstName;
    
        public Person(String firstName, String lastName) {
          setFirstName(firstName);
          setLastName(lastName);
        }
    
        public void setFirstName(String value) {
          firstNameProperty().set(value);
        }
    
        public String getFirstName() {
          return firstNameProperty().get();
        }
    
        public StringProperty firstNameProperty() {
          if(firstName == null) {
            firstName = new SimpleStringProperty(this, "firstName");
          }
          return firstName;
        }
    
        private StringProperty lastName;
    
        public void setLastName(String value) {
          lastNameProperty().set(value);
        }
    
        public String getLastName() {
          return lastNameProperty().get();
        }
    
        public StringProperty lastNameProperty() {
          if(lastName == null) {
            lastName = new SimpleStringProperty(this, "lastName");
          }
          return lastName;
        }
      }
    }

    Select any line by program. Add the following line:

    tableView.getSelectionModel().select(0);
    
  • an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    Hi mdsavol,

    Your observations are accurate. The 'suggestions' are previous entries in the same column that correspond to what has been entered so far in the active cell. The only direct user control is to activate the function turn on or off in numbers preferences > general.

    There are other ways to include or exclude items of suggestions:

    • To remove typos in the suggestions list, the user must correct the typos in the cell above the active cell. If they are more in the list, they won't be presented as suggestions.
    • To include selections added to the list, the user must enter these suggestions in the individual cells above the active cell and column where they are wanted as suggestions.

    There was a request here a while there is a list of suggestion 'live' similar to those of some websites, which offers a descending list of possible entries as a type in an input box.

    The only way I see to reach a solution similar to what you have asked is to use as many lines at the top of the non-en-tete of the table section to list the items likely to repeat in your table, and then hide the lines. You'll need a list for each column where you want to use this feature with a list previously planted. Existing items will then require a likely hit up to three, then a click to choose from a list small enough to enter a value into a cell. News he will need to enter in full the first time, but after that it will be put on the list and answer the same thing as the terms preseeded.

    While your setting upward (or decide not to do), consider going on the menu of number (in numbers), choosing to provide feedback from numbers and writing a feature in Apple request. Describe what you want. Explain how he could help the average user numbers, and then hope for the best.

    Kind regards

    Barry

  • Creating a TableView with a component, problem with my lines.

    I am trying to create a table in a pane. Each row in the table will have three columns. I found an example of code to create the table, but I'm getting additional lines that I don't want.

    I want only lines with 3 columns but I have extra lines, including the content of the last column see image.

    Is someone can you please tell me what is wrong with my code?

        private Pane createPane(String category) {
    
            VerticalFieldManager vfm = new VerticalFieldManager();
    
            vfm.add(new LabelField("Add Task:", Field.FOCUSABLE | LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
    
            // Initialize the model if it has not yet been loaded
            _tableModel = new SortedTableModel(StringComparator.getInstance(true), 2);
    
            // Populate the list
            for (int i = 0; i < 3; i++) {
    
                String col1 = i + " 1";
                String col2 = i + " 5";
                String col3 = i + " 3";
    
                _tableModel.addRow(new Object[]  {col1, col2, col3});
            }
    
            // Create and apply style
            RegionStyles style = new RegionStyles(BorderFactory.createSimpleBorder(new XYEdges(1, 1, 1, 1), Border.STYLE_SOLID), null, null,
                null, RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_TOP);
    
            // Create the view and controller
            TableView tableView = new TableView(_tableModel);
            TableController tableController = new TableController(_tableModel, tableView);
    
            // Set the controller focus policy to highlight rows
            tableController.setFocusPolicy(TableController.ROW_FOCUS);
    
            // Set the behaviour of the controller when a table item is clicked
            tableController.setCommand(new CommandHandler()
            {
                /**
                 * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
                 */
                public void execute(ReadOnlyCommandMetadata metadata, Object context)
                {
                    Dialog.alert("Command Executed");
                }
    
            }, null, null);
    
            tableView.setController(tableController);
    
            // Create a DataTemplate that suppresses the third column
            DataTemplate dataTemplate = new DataTemplate(tableView, 1, 3)
            {
                /**
                 * @see DataTemplate#getDataFields(int)
                 */
                public Field[] getDataFields(int modelRowIndex)
                {
                    Object[] data = (Object[]) ((TableModel) getView().getModel()).getRow(modelRowIndex);
    
                    Field[] fields = new Field[3];
                    fields[0] = new LabelField(data[0], Field.FOCUSABLE);
                    fields[1] = new LabelField(data[1], Field.FOCUSABLE | DrawStyle.HCENTER);
                    fields[2] = new LabelField(data[2], Field.FOCUSABLE);
    
                    return fields;
                }
            };
    
            // Set up regions
            dataTemplate.createRegion(new XYRect(0, 0, 1, 1), style);
            dataTemplate.createRegion(new XYRect(1, 0, 1, 1), style);
            dataTemplate.createRegion(new XYRect(2, 0, 1, 1), style);
    
            // Specify the size of each column by percentage, and the height of a row
            dataTemplate.setColumnProperties(0, new TemplateColumnProperties(15, TemplateColumnProperties.PERCENTAGE_WIDTH));
            dataTemplate.setColumnProperties(1, new TemplateColumnProperties(15, TemplateColumnProperties.PERCENTAGE_WIDTH));
            dataTemplate.setColumnProperties(2, new TemplateColumnProperties(70, TemplateColumnProperties.PERCENTAGE_WIDTH));
            dataTemplate.setRowProperties(0, new TemplateRowProperties(ROW_HEIGHT));
    
            // Apply the template to the view
            tableView.setDataTemplate(dataTemplate);
            dataTemplate.useFixedHeight(true);
    
            vfm.add(tableView);
    
            // Pane's title
            LabelField iconTextLabelField = new LabelField(category, Field.FOCUSABLE | Field.FIELD_HCENTER);
            return (new Pane(iconTextLabelField, vfm));
        }
    

    Thanks in advance.

     _tableModel = new SortedTableModel(StringComparator.getInstance(true), 2); <-- "2" sorts it by the object at index 2, which is your "col3". The extra rows you see are like headers for the sorting. I think you should use a different Table Model.
    
            // Populate the list
            for (int i = 0; i < 3; i++) {
    
                String col1 = i + " 1";
                String col2 = i + " 5";
                String col3 = i + " 3";
    
                _tableModel.addRow(new Object[]  {col1, col2, col3});
            }
    
  • Find/replace style cell with GREP

    Hi all, (my first post here)

    I found a script very useful on this forum to find/replace cell styles in an array. I adapted the script using Peter Kahrel ebook for use with a GREP query.

    I've linked to a spreadsheet in InDesign CC 2014 I want to highlight the cell of new products that contain the value [Y].

    When I run the script below, I get random results.

    myDoc = app.activeDocument var

    app.findGrepPreferences = app.changeGrepPreferences = null

    app.findGrepPreferences.findWhat = "\[\u\"]

    var myFound = myDoc.findGrep)

    for (i = 0; i < myFound.length; i ++)

    {

    If (. parent.constructor.name myFound [i] == "Cell")

    {

    . parent.appliedCellStyle myFound [i] = "New_Product_Cell".

    }

    }

    Modify the script that I wrote above.

    Otherwise your discovery is just '[u]' ==> multi-ad found is--> Direct manufacturer name


    Jarek

  • new positioning

    Hi guys,.

    Please check the code below
     public VBox getVBox() {
            VBox myBox = new VBox();
            myBox.setSpacing(20);
            myBox.setLayoutX(20);
            myBox.setLayoutY(20);
          
    
            TableView<Person> tableView = new TableView<Person>();
            TableColumn firstNameCol = new TableColumn("First Name");
            firstNameCol.setProperty(firstName);
            firstNameCol.setMaxWidth(100);
            
    
            TableColumn lastNameCol = new TableColumn("Last Name");
            lastNameCol.setProperty(lastName);
            lastNameCol.setMaxWidth(100);
    
            TableColumn cityNameCol = new TableColumn("city");
            cityNameCol.setProperty(addName);
            cityNameCol.setMaxWidth(100);
    
            TableColumn addNameCol = new TableColumn("Address");
            addNameCol.setMaxWidth(100);
            addNameCol.setProperty(cityName);
    
            TableColumn postNameCol = new TableColumn("PostCode");
            TableColumn notesNameCol = new TableColumn("Street");
            TableColumn tableNameCol = new TableColumn("Notes");
            tableView.getColumns().addAll(firstNameCol, lastNameCol, cityNameCol, addNameCol, postNameCol, notesNameCol, tableNameCol);
            myBox.getChildren().addAll(tableView);
            return myBox;
    
        }  
    The person object is composed of various getter, setter methods and get the full result of database. But how to assign them to the corresponding columns of the table? any example sample to provide data in the table?
    Thanks in advance.

    Published by: 809387 on June 7, 2011 04:03

    Published by: 809387 on June 7, 2011 04:05

    Published by: 809387 on June 9, 2011 09:50

    Here is an example:

    Person.Java

    import javafx.beans.property.*;
    public class Person {
         private StringProperty firstName = new StringProperty();;
    
         public Person(String fName, String lName) {
    
           setFirstName(fName);
           setLastName(lName);           
    
         }
         public void setFirstName(String value) { firstName.set(value); }
         public String getFirstName() { return firstName.get(); }
         public StringProperty firstNameProperty() {
             if (firstName == null) firstName = new StringProperty();
             return firstName;
         }
    
         private StringProperty lastName = new StringProperty();
         public void setLastName(String value) { lastName.set(value); }
         public String getLastName() { return lastName.get(); }
         public StringProperty lastNameProperty() {
             if (lastName == null) lastName = new StringProperty();
             return lastName;
         }
     }
    

    TableV.java

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.scene.control.*;
    import javafx.collections.*;
    import java.util.*;
    
    /**
     *
     * @author gusaros
     */
    public class TableV extends Application {
    
        public static void main(String[] args) {
            Application.launch(TableV.class, args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
            TableView table = new TableView();
            // Data could come  from DB
    
            ObservableList teamMembers = FXCollections.observableArrayList(new Person("Diego", "Maradona"), new Person("Mishel", "Platini"));
            table.setItems(teamMembers);
    
            TableColumn firstNameCol = new TableColumn("First Name");
            firstNameCol.setProperty("firstName");
            TableColumn lastNameCol = new TableColumn("Last Name");
            lastNameCol.setProperty("lastName");
    
            table.getColumns().setAll(firstNameCol, lastNameCol);
            root.getChildren().add(table);
            primaryStage.setScene(scene);
            primaryStage.setVisible(true);
        }
    }
    

    For more information, take a look at http://download.oracle.com/javafx/2.0/api/index.html

  • How to use CheckBoxTableCell

    Hi all

    I would like to have editable box in a table.

    That's what I have now.

    TableColumn selectCol = new TableColumn ("Select");
    selectCol.setEditable (true);
    () selectCol.setCellValueFactory
    new PropertyValueFactory < OrderCheck, Boolean >("selected"));
    selectCol.setCellFactory (CheckBoxTableCell.forTableColumn (selectCol));

    Questions
    (1) it still shows the box unchecked regardless of the "selected" in the object value
    (2) how does the 'selected' value has updated after checkbox is selected or deselected?

    Thank you.

    Published by: ericC on 27 December 2012 22:06

    Assuming that the property selected in the OrderCheck class is a ObservableValue (for example, a BooleanProperty), I think that your code should work. Updates occur when selected the checkbox property is bound in both directions to the property "selected" in your class (passing in the selectCol to the CheckBoxTableCell.forTableColumn method).

    This example works for me:

    import javafx.application.Application;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.collections.FXCollections;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.CheckBoxTableCell;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.stage.Stage;
    
    public class CheckBoxTableCellTest extends Application {
    
      @Override
      public void start(Stage primaryStage) {
        final TableView tableView = new TableView();
        tableView.setItems(FXCollections.observableArrayList(
            new Person("Robert", "Plant"),
            new Person("Neil", "Young"),
            new Person("Willie", "Nelson"),
            new Person("Natalie", "Merchant")
        ));
        tableView.getItems().get(3).setVegetarian(true);
        final TableColumn firstNameCol = new TableColumn("First Name");
        final TableColumn lastNameCol = new TableColumn("Last Name");
        final TableColumn vegetarianCol = new TableColumn("Vegetarian");
        tableView.getColumns().addAll(firstNameCol, lastNameCol, vegetarianCol);
        firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
        lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
        vegetarianCol.setCellValueFactory(new PropertyValueFactory("vegetarian"));
        vegetarianCol.setCellFactory(CheckBoxTableCell.forTableColumn(vegetarianCol));
        vegetarianCol.setEditable(true);
        tableView.setEditable(true);
    
        final BorderPane root = new BorderPane();
        root.setCenter(tableView);
    
        final HBox controls = new HBox(5);
        final Button infoButton = new Button("Show details");
        infoButton.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            for (Person p : tableView.getItems())
              System.out.printf("%s %s (%svegetarian)%n", p.getFirstName(),
                  p.getLastName(), p.isVegetarian() ? "" : "not ");
            System.out.println();
          }
        });
        controls.getChildren().add(infoButton);
        root.setBottom(controls);
    
        Scene scene = new Scene(root, 300, 400);
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    
      public static class Person {
        private StringProperty firstName;
        private StringProperty lastName;
        private BooleanProperty vegetarian;
    
        public Person(String firstName, String lastName) {
          this.firstName = new SimpleStringProperty(firstName);
          this.lastName = new SimpleStringProperty(lastName);
          this.vegetarian = new SimpleBooleanProperty(false);
        }
    
        public String getFirstName() {
          return firstName.get();
        }
    
        public String getLastName() {
          return lastName.get();
        }
    
        public boolean isVegetarian() {
          return vegetarian.get();
        }
    
        public void setFirstName(String firstName) {
          this.firstName.set(firstName);
        }
    
        public void setLastName(String lastName) {
          this.lastName.set(lastName);
        }
    
        public void setVegetarian(boolean vegetarian) {
          this.vegetarian.set(vegetarian);
        }
    
        public StringProperty firstNameProperty() {
          return firstName;
        }
    
        public StringProperty lastNameProperty() {
          return lastName;
        }
    
        public BooleanProperty vegetarianProperty() {
          return vegetarian;
        }
      }
    }
    
  • Is no longer possible to publish a stream in iTunes you and in the podcast store

    Just a heads up-

    We spent several years some of our streams iTunes U published in the regular iTunes podcast store often use the same RSS feed for both. Since the recent launch of iTunes Connect (the new quote and service management of content from the iTunes store), however, it seems that it is possible to submit an RSS feed in iTunes you and the iTunes podcast store. I get a message that says "status: Validation failure ' and 'cannot submit your feed. Your feed had already been submitted. »

    I submitted a ticket to Apple support, but some trial and error tests suggests that there is a workaround. If you have already submitted your feed to iTunes U, you can submit it to the iTunes podcast store but you need to replace the feed URL and the title of the podcast. I don't know if cela a new policy from Apple or a glitch in the new iTunes Connect service.

    Another work around could be to send the stream to the podcast to iTunes store first and then submit to iTunes U public site manager using-, but I have tested this theory yet.

    Tom

    Hi Tom,

    As I KNOW you're not supposed to do this in the first place. (It's what we were told in 2009).

    I guess Apple is simply start applying this restriction.

    Best, Erik

  • Someone please send me an example how to implement the sublayout method

     public void displist(StringTokenizerDemo refdata)
       {
    
           /*while(refdata.hasMoreTokens())
           {
               refdata.nextToken(); // Consume unwanted input
               String modelName = refdata.nextToken().trim();
               refdata.nextToken();
               refdata.nextToken();
                listField.add(modelName);
    
           }*/
    
           while(refdata.hasMoreTokens())
           {
               String temp = refdata.nextToken().trim();
               String pressure = refdata.nextToken().trim();
               Object[] row = {temp, pressure};
               _tableModel.addRow(row);          
    
           }
           TableView tableView = new TableView(_tableModel);
           tableView.setDataTemplateFocus(BackgroundFactory.createLinearGradientBackground(Color.PURPLE, Color.PINK, Color.YELLOW, Color.RED));
           TableController tableController = new TableController(_tableModel, tableView);
           tableController.setFocusPolicy(TableController.ROW_FOCUS);
           tableView.setController(tableController);
    
           DataTemplate dataTemplate = new DataTemplate(tableView, NUM_ROWS, NUM_COLUMNS)
           {
               /**
                * @see DataTemplate#getDataFields(int)
                */
               public Field[] getDataFields(int modelRowIndex)
               {
    
                   Object[] data = (Object[]) (_tableModel.getRow(modelRowIndex));
                   Field[] fields = { new LabelField((String) data[0]), new LabelField((String) data[1])};
                   return fields;
               }
           };
    
           dataTemplate.useFixedHeight(false);
    
           // Define regions and row height
           dataTemplate.setRowProperties(0, new TemplateRowProperties(ROW_HEIGHT));
           for(int k = 0; k < NUM_COLUMNS; k++)
           {
               dataTemplate.createRegion(new XYRect(k,0,1,1));
               dataTemplate.setColumnProperties(k, new TemplateColumnProperties(Display.getWidth()/NUM_COLUMNS));
           }
    
           // Apply the template to the view
    
           tableView.setDataTemplate(dataTemplate);
           vfm.add(tableView);
           filteredList.addDataSet(0, temperature, "Temperature", BasicFilteredList.COMPARISON_IGNORE_CASE);         
    
           // Create AutoCompleteFields
    
           AutoCompleteField autoCompleteField = new AutoCompleteField(filteredList, AutoCompleteField.LIST_STATIC | AutoCompleteField.LIST_DROPDOWN);
    
           // Add the AutoCompleteFields to the screen           
    
           //add(new LabelField("Choose a Value"));
           vfm.add(autoCompleteField);
    
       }
    

    In my application I am stretching from Verticalmanager to my class and display data in tableview.

    but the problem is that all the data is displayed with the scroll bar. To get the scroll for the tableview bar

    I sends you only (code tableview) if someone meets me, I want to paste all of the code.

    Please answer

    Please stand to be corrected if I'm wrong, you want to set the height of a manager who is unscrollable, in a Manager, a list field must be added, which is scrollable. First make the screen unscrollable by great call (Manager.No_VERTICAL_SCROLL); Then create a handler, override its methods getPreferredWidth(), getPreferredHeight() and sublayout(), as below:

    mainManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL){
                public int getPreferredWidth()
                {
                    return super.getPreferredWidth();
                }
                public int getPreferredHeight()
                {
                                    // fixed height
                    return height;
                }
                protected void sublayout( int maxWidth, int maxHeight )
                {
                    super.sublayout(getPreferredWidth(),getPreferredHeight());
                    setExtent(getPreferredWidth(),getPreferredHeight());
                }
            };
    

    mainmanager add to your list.

  • exporting data to Excel using XSSFWorkbook

    Hi everyone export data to Excel using XSSFWorkbook

    having error javax.el.ELException: means: lots of Java space now I need to change my code to BigGridDemo.java

    http://www.Docjar.org/HTML/API/org/Apache/POI/xssf/userModel/examples/BigGridDemo.Java.html

    http://Apache-POI.1045710.N5.Nabble.com/HSSF-and-XSSF-memory-usage-some-numbers-td4312784.html

    How can I change my code for BigGridDemo.java

    This is my code

    import com.bea.common.security.xacml.context.Result;

    import com.sun.jmx.snmp.Timestamp;

    to import java.io.FileNotFoundException;

    import java.io.IOException;

    import java.io.OutputStream;

    import java.util.HashMap;

    to import java.util.Iterator;

    import java.util.Map;

    Org.apache.poi.ss.usermodel import. *;

    Import javax.faces.context.FacesContext;

    Import org.apache.poi.hssf.usermodel.HSSFCell;

    Import org.apache.poi.hssf.usermodel.HSSFCellStyle;

    Import org.apache.poi.hssf.usermodel.HSSFDataFormat;

    Import org.apache.poi.hssf.usermodel.HSSFRow;

    Import org.apache.poi.hssf.usermodel.HSSFSheet;

    Import org.apache.poi.hssf.usermodel.HSSFWorkbook;

    Org.apache.poi import. *;

    Import org.apache.poi.hssf.util.HSSFColor;

    Import oracle.adf.model.BindingContainer;

    Import oracle.adf.model.BindingContext;

    Import oracle.adf.model.binding.DCBindingContainer;

    Import oracle.adf.model.binding.DCIteratorBinding;

    Import oracle.adf.view.rich.component.rich.data.RichTable;

    Import org.apache.poi.POIDocument;

    import org.apache.poi

    Import org.apache.poi.xssf.usermodel.XSSFWorkbook;

    Org.apache.poi.hssf.usermodel import. *;

    Import oracle.jbo.Row;

    Import oracle.jbo.RowSetIterator;

    Import oracle.jbo.ViewObject;

    Import org.apache.myfaces.trinidad.model.CollectionModel;

    Import org.apache.myfaces.trinidad.model.RowKeySet;

    Import org.apache.myfaces.trinidad.model.RowKeySetImpl;

    Import org.apache.poi.hssf.usermodel.HSSFRichTextString;

    Import org.apache.poi.ss.usermodel.Workbook;

    Import org.apache.poi.POIXMLDocumentPart;

    Import org.apache.poi.POIXMLDocument;

    Import org.apache.poi.hssf.usermodel.HSSFRow;

    Import org.apache.poi.hssf.usermodel.HSSFSheet;

    Import org.apache.poi.hssf.usermodel.HSSFWorkbook;

    public class PoiBean {}

    RicheTableau CustomTable;

    public PoiBean() {}

    }

    public static BindingContainer {} getBindingContainer()

    return (BindingContainer) JSFUtils.resolveExpression("#{bindings}");

    return (BindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    }

    public static DCBindingContainer getDCBindingContainer() {}

    return (DCBindingContainer) getBindingContainer ();

    }

    ' Public Sub generateExcel (FacesContext facesContext, OutputStream outputStream) throws IOException {}

    try {}

    Workbook = new XSSFWorkbook();  or new HSSFWorkbook();

    Spreadsheet sheet = workbook.createSheet("Fonts");

    Get all lines of an iterator

    /////////////////////////////////////////////////////////////////////////////////////////////////////

    Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("CustomClientView1Iterator");

    Line rowss = worksheet.createRow (0);

    ViewObject yourVO = dcIteratorBindings.getViewObject ();

    Get all the lines of a ViewObject

    RowSetIterator iter = yourVO.createRowSetIterator ("CustomClient");

    ITER. Reset();

    int rowCounter = 0;

    While (iter.hasNext ()) {}

    A cell = null;

    line oracle.jbo.Row = iter.next ();

    print header on the first line in excel

    If (rowCounter == 0) {}

    rowss = worksheet.createRow (rowCounter);

    int cellCounter = 0;

    {for (String colName: {row.getAttributeNames ())}

    cell = rowss.createCell (cellCounter);

    cellA1.setCellValue (colName);

    cellCounter ++;

    }

    }

    print the data from the second row in excel

    rowCounter ++;

    //////////////////////////////////////////////////////////////

    short j = 0;

    int cellCounter = 0;

    excelrow = (HSSFRow) worksheet.createRow ((int) i);

    rowss = worksheet.createRow (rowCounter);

    {for (String colName: {row.getAttributeNames ())}

    System.out.println ("Hello" + row.getAttribute (colName));

    System.out.println ("Hello" + name of column);

    cell = rowss.createCell (cellCounter);

    rowCounter ++;

    cell.setCellValue (new HSSFRichTextString (rs.getS));

    {if (! isBlank (colname))}

    If (colName.equalsIgnoreCase ("CcnCode")) {}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    System.out.println ("column name" + colName + "row.getAttribute (colName) m:System.NET.SocketAddress.ToString ()" + row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }

    }

    logic for the cell formatting

    ElseIf (colName.equalsIgnoreCase ("CcnName")) {}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }

    make double if you want to convert as a result

    ElseIf (colName.equalsIgnoreCase ("CcnRegDate")) {}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }

    ElseIf (colName.equalsIgnoreCase ("CcnCancelDate")) {}

    {if (null! = Row.GetAttribute (colname))}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }

    } ElseIf (colName.equalsIgnoreCase ("CcnUndertaking")) {}

    {if (null! = Row.GetAttribute (colname))}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }

    }

    ElseIf (colName.equalsIgnoreCase ("CcnCode8")) {}

    {if (null! = Row.GetAttribute (colname))}

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    }                                                                                                            }

    on the other

    cell.setCellValue (row.getAttribute (colName) m:System.NET.SocketAddress.ToString ());

    cellCounter ++;

    }

    worksheet.createFreezePane (0, 1, 0, 1);

    }

    Workbook.Write (OutputStream);

    outputStream.flush ();

    }

    //}

    catch (Exception e) {}

    e.printStackTrace ();

    }

    }

    The demo "big grid" is obsolete and has been replaced by SXSSF, which is compatible with XSSF (seehttp://poi.apache.org/spreadsheet/how-to.html#sxssfthe new Halloween Document) API.

    Theoretically, all you need to do is replace "new XSSFWorkbook()" by "new org.apache.poi.xssf.streaming.SXSSFWorkbook ()" in your program.

    You better post any specific questions of POI on the forum of the user Apache POI (see mailing lists , Apache POI)

    Kind regards

    Alex

  • Import/coupling of spreadsheet calculation + updated data in the form

    This is an import/formatting of the data that I'm working on. http://imgur.com/a/fr0C1 [1]

    When I sections are looking exactly how I would like it, I'm creating table styles, cell and new paragraph. When the linked spreadsheet is updated it loses formatting. When I reapply all styles, he will eventually justify the Centre 2 data columns to the right, rather than centered & left.

    Thanks for the idea!

    Answered in another forum:

    ElectricCharlie

    To do this, I'll make sure that your table style specifies "[None]" to all of your cell styles. I create a cell for each column style and create the corresponding paragraph for each paragraph style styles. Within each cell style, specify the desired paragraph style. (This should tumble down the styles correctly.)

    I don't directly apply paragraph for text styles, because that can be reset to re - import. And I'll make sure that in your desired result, that there is no overridden style. Substitutions might be getting dropped when you change the text.

    I have not mocked this scenario on my end, but I think it will solve the problem.

  • LifeDrive

    According to your instructions for the error (error Sys0505) (0.841), I deleted the following files of my LifeDrive: MY PALM ACCOUNT; MY HEEL PALM BEAM; MY TREO ACCOUNT; AND MY TREO SYNC. However, when I sync with the "office crush unit", these files reappear. When I sync once more with the "device replaces the office", I can not sync at all. By the way, this am I ordered a Palm Treo 800W from Sprint and I'm worried that I might have the same questions cela this new device.

    The best way is to delete these files again and go to start my computer C:------drive - program files and look for Palm or PalmSource. Then look for the name of your profile and rename the backup folder Backup.Old

    When you hotsync, none of the items in the backup folder will be synchronized to your handheld.

Maybe you are looking for

  • Modem does not not after installing XP Pro

    I just installed XP PRO, including service pack 2, from scratch, on a Satellite Pro A10. I downloaded the latest drivers for modem from this site and install them. (several times). All anything will do, when querying the modem diagnostics tab all tha

  • How to insert a scatter diagram in MS word

    Does anyone know how to insert a diagram of dispersion in a MS word document?  I'm developing an application using c# and Measurement Studio and my request is a report in MS word.  I just need to add a diagram of dispersion in the same document. Than

  • Memory of the PXI - 6562 Max per channel

    I have two questions. I have a PXI - 6562 and a data set is 256 MB (32 MB). I want to send the data in this dataset on a single axis of I/O serial. basically, I would like to spend my little of a set of data at the same time on both edges of the cloc

  • Is it safe to keep a photocopy of his passport on Skydrive?

    I heard that if you lose your Passport on holiday for example, if you have a copy somewhere, it is acceptable for the time.

  • Need settings for Services for Vista Home Premium, 32-bit SP2, Server 2008

    Several problems.  I know that I have too many services running that shouldn't be and need to put them back where they should be. In other words please. Auto, delayauto, etc manually. My pc has little memory left. I can't save anything as it says tha