Java 类javafx.beans.value.ObservableValue 实例源码

项目:Squid    文件:IsotopesManagerController.java   
private void createTextField() {
    textField = new TextField(getString());
    textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
    textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> arg0,
                Boolean arg1, Boolean arg2) {
            if (!arg2) {
                commitEdit(textField.getText());
            }
        }
    });

    textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent ke) {
            KeyCode kc = ke.getCode();
            if ((kc.equals(KeyCode.ENTER) || kc.equals(KeyCode.UP) || kc.equals(KeyCode.DOWN) || kc.equals(KeyCode.LEFT) || kc.equals(KeyCode.RIGHT))) {
                commitEdit(textField.getText());
            }
        }
    });
}
项目:OftenPorter    文件:MenuItemBinder.java   
public MenuItemBinder(MenuItem menuItem)
{
    super(menuItem);
    actionHandler = new EventHandler<ActionEvent>()
    {
        @Override
        public void handle(ActionEvent event)
        {
            onOccur();
        }
    };
    menuItem.addEventHandler(ActionEvent.ACTION,actionHandler);
    changeListener = new ChangeListener<String>()
    {
        @Override
        public synchronized void changed(ObservableValue<? extends String> observable, String oldValue,
                String newValue)
        {
            doOnchange(oldValue,newValue);
        }
    };
    menuItem.textProperty().addListener(changeListener);
}
项目:ABC-List    文件:CheckBoxListCell.java   
public CheckBoxListCell(
        final Callback<T, ObservableValue<Boolean>> getSelectedProperty, 
        final BooleanProperty disableProperty,
        final StringConverter<T> converter
) {
    this.getStyleClass().add("check-box-list-cell");
    setSelectedStateCallback(getSelectedProperty);
    setConverter(converter);

    checkBox = new CheckBox();
    checkBox.disableProperty().bind(disableProperty);

    setAlignment(Pos.CENTER_LEFT);
    setContentDisplay(ContentDisplay.LEFT);

    // by default the graphic is null until the cell stops being empty
    setGraphic(null);
}
项目:LivroJavaComoProgramar10Edicao    文件:TipCalculatorController.java   
public void initialize() 
{
   // 0-4 rounds down, 5-9 rounds up 
   currency.setRoundingMode(RoundingMode.HALF_UP);

   // listener for changes to tipPercentageSlider's value
   tipPercentageSlider.valueProperty().addListener(
      new ChangeListener<Number>() 
      {
         @Override
         public void changed(ObservableValue<? extends Number> ov, 
            Number oldValue, Number newValue) 
         {
            tipPercentage = 
               BigDecimal.valueOf(newValue.intValue() / 100.0);
            tipPercentageLabel.setText(percent.format(tipPercentage));
         }
      }
   );
}
项目:Dr-Assistant    文件:PatientsController.java   
/**
 * Initializes the controller class.
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    scrollPan.viewportBoundsProperty().addListener((ObservableValue<? extends Bounds> observable, Bounds oldValue, Bounds newValue) -> {
        flowPane.setPrefWidth(newValue.getWidth());
    });

    lblTotalPatient.setText("Loading..........");

    Platform.runLater(() -> {
        totalPatient = patientGetway.totalPatient();
        loadPatients();
        lblTotalPatient.setText("Total :" + totalPatient);
        lblShowingPatient.setText("Showing " + paginate.getStart() + " To " + paginate.getEnd());
        if (totalPatient == 0) {
            lblTotalPatient.setText("No patient found");
            lblShowingPatient.setVisible(false);
        }
    });

}
项目:Money-Manager    文件:TransactionHistoryController.java   
@FXML
    private void btnGo(ActionEvent event) {
        historyByDate = new HistorySearchByDate(datePicker.getValue());

        webEngine.getLoadWorker().stateProperty().addListener(
                new ChangeListener<Worker.State>() {
                    @Override
                    public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
                        if (newValue == Worker.State.SUCCEEDED) {
                            JSObject windowObject = (JSObject) webEngine.executeScript("window");
                            windowObject.setMember("HistorySearchByDate", historyByDate); // insert object
                            windowObject.call("searchHistoryByDate"); // execute callback
                        }
                    }
                }
            );
        URL url = getClass().getResource("/html/index.html");
        webEngine.load(url.toString());

//        String url = getClass().getResource("../html/index.html").toExternalForm();
//        webEngine.load(url);
    }
项目:twichat    文件:Controller.java   
@Override
  public void initialize(URL location, ResourceBundle resources) {
    Main.bot.currentChannel = Main.bot.getChannels().get(0);
vbox.setSpacing(30);

      System.out.println("initialized");
      updateViewCount();

      new Timer().schedule(new TimerTask() {

    @Override
    public void run() {
        Platform.runLater(() -> { Controller.controller.viewCount
            .setText("Viewers: " + Main.bot.getChannels().get(0).getViewersNum()); });

    }
}, 0, 10000);

      vbox.heightProperty().addListener(new ChangeListener<Number>() {
    @Override
    public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
        scrollPane.setVvalue(1.0);
    }
});

  }
项目:marathonv5    文件:JavaFXCheckBoxTreeTableCell.java   
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public String _getValue() {
    CheckBoxTreeTableCell cell = (CheckBoxTreeTableCell) node;
    Callback selectedStateCallback = cell.getSelectedStateCallback();
    String cbText;
    if (selectedStateCallback != null) {
        ObservableValue<Boolean> call = (ObservableValue<Boolean>) selectedStateCallback.call(cell.getItem());
        int selection = call.getValue() ? 2 : 0;
        cbText = JavaFXCheckBoxElement.states[selection];
    } else {
        Node cb = cell.getGraphic();
        JavaFXElement comp = (JavaFXElement) JavaFXElementFactory.createElement(cb, driver, window);
        cbText = comp._getValue();

    }
    String cellText = cell.getText();
    if (cellText == null) {
        cellText = "";
    }
    String text = cellText + ":" + cbText;
    return text;
}
项目:CSS-Editor-FX    文件:StatusBarManager.java   
private static <T> StringBinding mapString(ObservableValue<T> v, Function<T, String> func) {
  return new StringBinding() {
    {
      bind(v);
    }

    @Override
    protected String computeValue() {
      if (v.getValue() == null) {
        return "";
      } else {
        return func.apply(v.getValue());
      }
    }
  };
}
项目:GazePlay    文件:ConfigurationContext.java   
private static ChoiceBox<EyeTracker> buildEyeTrackerConfigChooser(Configuration configuration,
        ConfigurationContext configurationContext) {
    ChoiceBox<EyeTracker> choiceBox = new ChoiceBox<>();

    choiceBox.getItems().addAll(EyeTracker.values());

    EyeTracker selectedEyeTracker = findSelectedEyeTracker(configuration);
    choiceBox.getSelectionModel().select(selectedEyeTracker);

    choiceBox.setPrefWidth(prefWidth);
    choiceBox.setPrefHeight(prefHeight);

    choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<EyeTracker>() {
        @Override
        public void changed(ObservableValue<? extends EyeTracker> observable, EyeTracker oldValue,
                EyeTracker newValue) {
            final String newPropertyValue = newValue.name();
            ConfigurationBuilder.createFromPropertiesResource().withEyeTracker(newPropertyValue)
                    .saveConfigIgnoringExceptions();
        }
    });

    return choiceBox;
}
项目:dragdropfx    文件:DnDPrepare.java   
public static void tableColumns(final Visitor v, List<? extends TableColumn<?, ?>> addedSubList) {
    for(int i = 0; i < addedSubList.size(); i++){
        final TableColumn<?,?> col = addedSubList.get(i);

        col.setCellFactory(new DnDTableCellFactory(v, col.getCellFactory()));
        col.cellFactoryProperty().addListener(new ChangeListener<Callback>() {
            @Override
            public void changed(ObservableValue<? extends Callback> observable, Callback oldValue,
                    Callback newValue) {
                if(!(newValue instanceof DnDTableCellFactory)){
                    col.setCellFactory(new DnDTableCellFactory(v, col.getCellFactory()));
                }
            }
        });
    }
}
项目:dss-demonstrations    文件:TypedToggleGroup.java   
public TypedToggleGroup() {

        this.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            @Override
            @SuppressWarnings("unchecked")
            public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
                if (newValue != null) {
                    T obj = (T) newValue.getUserData();
                    selectedValueProperty.setValue(obj);
                } else {
                    selectedValueProperty.setValue(null);
                }
            }
        });

    }
项目:JavaFX-Web-Browser    文件:WebBrowserTabController.java   
@Override
        public void changed(ObservableValue<? extends State> observable, State oldState, State newState) {
            if (newState == Worker.State.CANCELLED) {
            // download detected
            String url = webEngine.getLocation();
            logger.info("download url: "+url);
//             try{
//                 Download download = new Download(webEngine.getLocation());
//                 Thread t = new Thread(download);
//                 t.start();
//             }catch(Exception ex){
//                 logger.log(Level.SEVERE, "download", ex);
//             }
            }
        }
项目:Suji    文件:GameListController.java   
private void spectateGame(GameList.Game game) {
    SpectatorGameHandler handler = new SpectatorGameHandler(game.getId());
    BoardController controller = new BoardController(handler, "/fxml/localGame.fxml", false);

    PlayerPaneController playerInfo = new PlayerPaneController(game);
    controller.addToSideBar(playerInfo.getRoot());

    DockNode node = controller.getDockNode();
    node.closedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if ( newValue ) {
                handler.disconnect();
                observable.removeListener(this);
            }
        }
    });
    node.setTitle(game.getGameName());
    node.dock(Main.instance.dockPane, DockPos.CENTER);
}
项目:Dr-Assistant    文件:NewTemplateController.java   
private void loadDrug() {
    drugs = drugGetway.allDrugs();
    comboBoxDrug.getItems().addAll(drugs);
    comboBoxDrug.setConverter(new StringConverter<Drug>() {
        @Override
        public String toString(Drug object) {
            return object.getName();
        }

        @Override
        public Drug fromString(String string) {
            return comboBoxDrug.getItems().stream().filter(ap -> ap.getName().equals(string)).findFirst().orElse(null);
        }
    });
    comboBoxDrug.getSelectionModel().selectFirst();
    comboBoxDrug.setOnKeyReleased((KeyEvent event) -> {
        drugs.forEach((drug) -> {
            if (String.valueOf(event.getText()).matches(Character.toString(drug.getName().charAt(0)))) {
                comboBoxDrug.setValue(drug);
            }
        });
    });
    comboBoxDrug.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends Drug> observable, Drug oldValue, Drug newValue) -> {
        System.out.println("Selected drug id : " + newValue.getId() + " Name : " + newValue.getName());
    });
}
项目:SnapDup    文件:TableViewSelection.java   
@Override
public void changed(ObservableValue<? extends DupData> observable, DupData oldValue, DupData newValue)
{
    if(newValue != null)
    {
        Platform.runLater(() -> {
            txtArea.selectRange(newValue.getStartOffset(), newValue.getEndOffset());
        });
    }
}
项目:OftenPorter    文件:TextBinder.java   
public TextBinder(final TextInputControl view)
{
    super(view);

    changeListener = new ChangeListener<String>()
    {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue)
        {
            doOnchange(oldValue,newValue);
        }
    };
    view.textProperty().addListener(changeListener);
}
项目:desktop-gmail-client    文件:MainUI3Controller.java   
public void setDraftListView(){
    draftMessageListView = new JFXListView<>();
    draftMessageListView.setItems(GmailMessages.draftMessages);
    draftMessageListView.setCellFactory(new Callback<ListView<FormattedMessage>, ListCell<FormattedMessage>>() {
        @Override
        public ListCell<FormattedMessage> call(ListView<FormattedMessage> param) {
            return new CustomListCell(currentFolderName);
        }
    });
    draftMessageListView.getStylesheets().add(String.valueOf(getClass().getResource("/listview.css")));
    draftMessageListView.setExpanded(true);
    draftMessageListView.depthProperty().set(1);

    draftMessageListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<FormattedMessage>() {
        @Override
        public void changed(ObservableValue<? extends FormattedMessage> observable, FormattedMessage oldValue, FormattedMessage newValue) {
            if (newValue != null) {
                if (!componentFlag) {
                    componentFlag = true;
                    screenComponent.setScreenComponent(currentFolderName);
                    setScreenComponent();
                }
                screenComponent.setInfo(newValue);
            }
        }
    });
}
项目:desktop-gmail-client    文件:MainUI3Controller.java   
public void setTrashListView(){
    trashMessageListView = new JFXListView<>();
    trashMessageListView.setItems(GmailMessages.trashMessages);
    trashMessageListView.setCellFactory(new Callback<ListView<FormattedMessage>, ListCell<FormattedMessage>>() {
        @Override
        public ListCell<FormattedMessage> call(ListView<FormattedMessage> param) {
            return new CustomListCell(currentFolderName);
        }
    });
    trashMessageListView.getStylesheets().add(String.valueOf(getClass().getResource("/listview.css")));
    trashMessageListView.setExpanded(true);
    trashMessageListView.depthProperty().set(1);

    trashMessageListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<FormattedMessage>() {
        @Override
        public void changed(ObservableValue<? extends FormattedMessage> observable, FormattedMessage oldValue, FormattedMessage newValue) {
            if (newValue != null) {
                if (!componentFlag) {
                    componentFlag = true;
                    screenComponent.setScreenComponent(currentFolderName);
                    setScreenComponent();
                }
                screenComponent.setInfo(newValue);
            }
        }
    });
    /*ScrollBar listViewScrollBar = getListViewScrollBar(trashMessageListView);
    listViewScrollBar.valueProperty().addListener((observable, oldValue, newValue) -> {
        double position = newValue.doubleValue();
        ScrollBar scrollBar = getListViewScrollBar(trashMessageListView);
        if (position == scrollBar.getMax()) {
            try {
                GmailMessages.trashMessages.addAll(GmailOperations.getTrashMessages(10));
            } catch (IOException e) {
                e.printStackTrace();
                NotifyUser.getNotification("Internet connection has lost", "Please check your internet connection").showInformation();
            }
        }
    });*/
}
项目:Quantify    文件:MultiTabsDialogController.java   
public void setTabs(List<Data> data) {

        // add tabs
        for (int i = 1; i <= data.size(); i++) {
            Tab tab = new Tab("case " + i);
            tab.setClosable(false);
            tabPane.getTabs().add(tab);
        }

        // clear tabs
        tabPane.getSelectionModel().clearSelection();

        tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
            @Override
            public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
                if (null == newValue.getContent()) {
                    try {
                        FXMLLoader loader = new FXMLLoader();
                        loader.setLocation(getClass().getResource("../view/QuantifyStatistics.fxml"));
                        Parent root = loader.load();
                        newValue.setContent(root);

                        QuantifyStatisticsController controller = loader.getController();
                        int index = tabPane.getSelectionModel().getSelectedIndex();
                        controller.setQuantifyData(data.get(index));

                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }
项目:PearPlanner    文件:TaskController.java   
/**
 * Creates a Task selection window.
 *
 * @param list List of Tasks to be put into the window.
 * @return A list of selected Tasks
 */
protected static ObservableList<Task> taskSelectionWindow(ObservableList<Task> list)
{
    // Layout:
    VBox layout = new VBox();
    layout.setSpacing(10);
    layout.setAlignment(Pos.BOTTOM_RIGHT);
    // =================

    // Tasks columns:
    TableColumn<Task, String> nameColumn = new TableColumn<>("Task");
    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));

    TableColumn<Task, String> assignmentColumn = new TableColumn<>("Assignments");
    assignmentColumn.setCellValueFactory(new PropertyValueFactory("assignments")
    {
        @Override public ObservableValue call(TableColumn.CellDataFeatures param)
        {
            SimpleStringProperty value = new SimpleStringProperty("");
            for (Assignment a : ((Task) param.getValue()).getAssignmentReferences())
                value.set(value.getValue() + a.getName() + "\n");
            return value;
        }
    });

    TableColumn<Task, String> deadlineColumn = new TableColumn<>("Deadline");
    deadlineColumn.setCellValueFactory(new PropertyValueFactory<>("deadline"));
    deadlineColumn.setStyle("-fx-alignment: CENTER-RIGHT;");
    // =================

    // Create a table:
    TableView<Task> tasks = new TableView<>();
    tasks.setItems(list);
    tasks.getColumns().addAll(nameColumn, assignmentColumn, deadlineColumn);
    tasks.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    // =================

    // Table attributes:
    tasks.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    GridPane.setHgrow(tasks, Priority.ALWAYS);
    GridPane.setVgrow(tasks, Priority.ALWAYS);
    // =================

    // Set click event:
    tasks.setRowFactory(TaskController::taskRowFactory);
    // =================

    // Button:
    Button OK = new Button("OK");
    OK.setOnAction(e -> {
        Stage current = (Stage) OK.getScene().getWindow();
        current.close();
    });
    VBox.setMargin(OK, new Insets(5));
    OK.setDefaultButton(true);
    // =================

    layout.getChildren().addAll(tasks, OK);

    // Set a new scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(layout, 550, 300));
    stage.setTitle("Select dependencies");
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
    // =================

    return tasks.getSelectionModel().getSelectedItems();
}
项目:GameAuthoringEnvironment    文件:FacebookListener.java   
/**
 * Method to overwrite to listen to changes in the web browser
 */
@Override
public void changed (ObservableValue<? extends State> ov, State oldState, State newState) {
    if (newState == Worker.State.SUCCEEDED) {
        String newURL = myEngine.getLocation();
        checkForLogin(newURL);

    }
}
项目:incubator-netbeans    文件:HtmlComponent.java   
private void initFX() {
    Platform.setImplicitExit(false);
    v = new WebView();
    BorderPane bp = new BorderPane();
    Scene scene = new Scene(bp, Color.ALICEBLUE);

    class X implements ChangeListener<String>, Runnable {

        private String title;

        public X() {
            super();
        }

        @Override
        public void changed(ObservableValue<? extends String> ov, String t, String t1) {
            title = v.getEngine().getTitle();
            EventQueue.invokeLater(this);
        }

        @Override
        public void run() {
            if (title != null) {
                HtmlComponent.this.setDisplayName(title);
            }
        }
    }
    final X x = new X();
    v.getEngine().titleProperty().addListener(x);
    Platform.runLater(x);
    bp.setCenter(v);
    p.setScene(scene);
}
项目:incubator-netbeans    文件:WebViewBrowser.java   
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
项目:plep    文件:ChangeListenerWithBlocker.java   
/**
 * Execute the listener passed in the constructor only of not blocked.
 * @param observable ObservableValue to add listener to?
 * @param oldValue The old value that has been changed.
 * @param newValue The new value the old value has been changed to.
 */
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean
        oldValue, Boolean newValue) {
    if(!block) {
        decoratedListener.changed(observable, oldValue, newValue);
    }
}
项目:OftenPorter    文件:CheckBoxBinder.java   
public CheckBoxBinder(CheckBox view)
{
    super(view);
    changeListener = new ChangeListener<Boolean>()
    {
        @Override
        public synchronized void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue)
        {
            doOnchange(oldValue,newValue);
        }
    };
    view.selectedProperty().addListener(changeListener);
}
项目:marathonv5    文件:ProductFetcherTask.java   
public ProductFetcherTask(final TableView products) {
    valueProperty().addListener(new ChangeListener<ObservableList<FullProductListing>>() {
        @Override public void changed(ObservableValue<? extends ObservableList<FullProductListing>> ov, 
                ObservableList<FullProductListing> oldValues, ObservableList<FullProductListing> newValues) {
            // insert results into table
            products.setItems(newValues);
            // remove progress indicator
            products.setPlaceholder(null);
        }
    });
}
项目:waterrower-workout    文件:HyperlinkRedirectListener.java   
@Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
    if (SUCCEEDED.equals(newValue)) {
        Document document = webView.getEngine().getDocument();
        NodeList anchors = document.getElementsByTagName(ANCHOR_TAG);
        for (int i = 0; i < anchors.getLength(); i++) {
            Node node = anchors.item(i);
            EventTarget eventTarget = (EventTarget) node;
            eventTarget.addEventListener(CLICK_EVENT, this, false);
        }
    }
}
项目:FlashLib    文件:LogWindow.java   
private Scene loadScene(){
    BorderPane root = new BorderPane();

    textArea = new TextArea();
    textArea.setEditable(false);
    textArea.setPrefSize(300, 200);
    root.setCenter(textArea);
    BorderPane.setAlignment(root, Pos.CENTER);

    tabs = new TabPane();
    for (RemoteLog remoteLog : logs) {
        Tab tab = new Tab(remoteLog.getName());
        tab.setClosable(false);
        tabs.getTabs().add(tab);
    }
    if(tabs.getTabs().size() > 0){
        tabs.getSelectionModel().select(0);
        selectLog(0);
    }
    tabs.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>(){
        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            selectLog(newValue.intValue());
        }
    });
    root.setTop(tabs);


    return new Scene(root, 450, 300);
}
项目:javafx-qiniu-tinypng-client    文件:ObservableRules.java   
public static ObservableBooleanValue notEmpty(ObservableValue<String> source) {
    return Bindings.createBooleanBinding(() -> {
        final String s = source.getValue();

        return s != null && !s.trim().isEmpty();
    }, source);
}
项目:CNU_TermProject_SoftwareEngineering    文件:ItemManagementController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    backBtn.setOnAction(this::backButtonAction);
    registerBtn.setOnAction(this::registerButtonAction);
    modifyBtn.setOnAction(this::modifyButtonAction);
    deleteBtn.setOnAction(this::deleteButtonAction);
    itemName.setCellValueFactory(cellData -> cellData.getValue().itemNameProperty());
    category.setCellValueFactory(cellData -> cellData.getValue().categoryProperty());
    price.setCellValueFactory(cellData -> cellData.getValue().priceProperty().asObject());
    itemListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TableRowDataModel>() {
        @Override
        public void changed(ObservableValue<? extends TableRowDataModel> observable, TableRowDataModel oldValue, TableRowDataModel newValue) {
            if (itemList.isEmpty())
                return;
            TableRowDataModel model = itemListView.getSelectionModel().getSelectedItem();
            System.out.println(model.itemName);
            System.out.println(model.price);
            System.out.println(model.category);
            ItemNameTF.setText(String.valueOf(model.itemName.getValue()));
            PriceBox.setText(String.valueOf(model.price.getValue()));
            ChoiceCategory.getSelectionModel().select(categoryList.indexOf(model.category.getValue()));
        }
    });
    loadCategoryList();
    loadItemList();
    itemListView.getSelectionModel().selectFirst();
}
项目:marathonv5    文件:TextValidatorSample.java   
public TextInputValidatorPane() {
    contentProperty().addListener(new ChangeListener<C>() {                
        @Override public void changed(ObservableValue<? extends C> ov, C oldValue, C newValue) {
            if (oldValue != null) oldValue.textProperty().removeListener(textListener);
            if (newValue != null) newValue.textProperty().addListener(textListener);
        }
    });
}
项目:Coconut-IDE    文件:CreateProjectPresenter.java   
private void computePropertyProjectName(ObservableValue<? extends String> observable, String oldValue, String newValue) {
    if (!wasChanged && pathStartsWithPathOfProjects()) {
        projectPath.setText(projects.getCorePathString() + newValue);
        wasChanged = false;
    } else {
        wasChanged = true;
    }
}
项目:marathonv5    文件:ToggleButtonSample.java   
public ToggleButtonSample() {
    // create label to show result of selected toggle button
    final Label label = new Label();
    label.setStyle("-fx-font-size: 2em;");
    // create 3 toggle buttons and a toogle group for them
    final ToggleButton tb1 = new ToggleButton("Cat");
    final ToggleButton tb2 = new ToggleButton("Dog");
    final ToggleButton tb3 = new ToggleButton("Horse");
    ToggleGroup group = new ToggleGroup();
    tb1.setToggleGroup(group);
    tb2.setToggleGroup(group);
    tb3.setToggleGroup(group);
    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        @Override public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle selectedToggle) {
            if(selectedToggle!=null) {
                label.setText(((ToggleButton) selectedToggle).getText());
            }
            else {
                label.setText("...");
            }
        }
    });
    // select the first button to start with
    group.selectToggle(tb1);
    // add buttons and label to grid and set their positions
    GridPane.setConstraints(tb1,0,0);
    GridPane.setConstraints(tb2,1,0);
    GridPane.setConstraints(tb3,2,0);
    GridPane.setConstraints(label,0,1,3,1);
    GridPane grid = new GridPane();
    grid.setVgap(20);
    grid.setHgap(10);
    getChildren().add(grid);
    grid.getChildren().addAll(tb1, tb2, tb3, label);
}
项目:ABC-List    文件:TopicPresenter.java   
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
    if (
            topic != null
            && !topic.isMarkAsChanged()
    ) { 
        topic.setMarkAsChanged(Boolean.TRUE);
    }
}
项目:WebPLP    文件:OnLoadListener.java   
public void changed(ObservableValue<? extends State> value, State oldState,
        State newState)
{
    if (newState == State.SUCCEEDED)
    {
        onLoadFunction.perform();

        if (observable != null)
            observable.removeListener(this);
    }
}
项目:marathonv5    文件:HyperlinkRedirectListener.java   
@Override public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
    if (State.SUCCEEDED.equals(newValue)) {
        Document document = webView.getEngine().getDocument();
        NodeList anchors = document.getElementsByTagName(ANCHOR_TAG);
        for (int i = 0; i < anchors.getLength(); i++) {
            Node node = anchors.item(i);
            EventTarget eventTarget = (EventTarget) node;
            eventTarget.addEventListener(CLICK_EVENT, this, false);
        }
    }
}
项目:JavaFX-EX    文件:BeanUtil.java   
public static <F, T> ListProperty<T> nestListProp(ObservableValue<F> pf, Function<F, ListProperty<T>> func) {
  ListProperty<T> current = func.apply(pf.getValue());
  ListProperty<T> nestProp = new SimpleListProperty<>();
  CacheUtil.set(BeanUtil.class, nestProp, current);
  nestProp.bindBidirectional(current);
  pf.addListener((ob, o, n) -> {
    CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContentBidirectional(p));
    ListProperty<T> pt = func.apply(n);
    CacheUtil.set(BeanUtil.class, nestProp, pt);
    nestProp.bindContentBidirectional(pt);
  });
  return nestProp;
}
项目:CBM-Changes-Explorer    文件:Controller.java   
@Override
public void changed(ObservableValue<? extends String> observable, String oldId, String newId) {
  if (null == newId) return;

  Map properties = db.getDocument(newId).getProperties();

  try {
    String json = mapper.writeValueAsString(properties);

    contentsText.setText(prettyText(json));
  } catch (JsonProcessingException ex) {
    ex.printStackTrace();
    Dialog.display(ex);
  }
}
项目:alchem    文件:InventoryController.java   
public void onChangingSearchOption() {
    searchGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov,
                            Toggle old_toggle, Toggle new_toggle) {
            if (searchGroup.getSelectedToggle() != null) {
                searchField.setText("");
            }
        }
    });

}