当前位置: 首页>>代码示例>>Java>>正文


Java Callback类代码示例

本文整理汇总了Java中javafx.util.Callback的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Callback类属于javafx.util包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ComponentSelectorPane

import javafx.util.Callback; //导入依赖的package包/类
public ComponentSelectorPane(String listTitle, ObservableList<Class<? extends Component>> displayedData, SpriteDataPane infoPane) {
	this.infoPane=infoPane;
	this.setPrefWidth(PREF_WIDTH);
	ListView<Class<? extends Component>> componentDisplay = new ListView<>();
	componentDisplay.setItems(displayedData);

	componentDisplay.setCellFactory(
			new Callback<ListView<Class<? extends Component>>, ListCell<Class<? extends Component>>>() {
				@Override
				public ListCell<Class<? extends Component>> call(ListView<Class<? extends Component>> list) {
					return new ComponentCustomizerOption();
				}
			});

	Label title = new Label(listTitle);
	this.getChildren().addAll(title, componentDisplay);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:18,代码来源:ComponentSelectorPane.java

示例2: initListView

import javafx.util.Callback; //导入依赖的package包/类
private void initListView() {
    if (!doesAllowChildren) {
        fillUpChildren(fileChooserInfo.getRoot());
    }
    childrenListView.setCellFactory(new Callback<ListView<File>, ListCell<File>>() {
        @Override public ListCell<File> call(ListView<File> param) {
            return new ChildrenFileCell();
        }
    });
    childrenListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (fileChooserInfo.isFileCreation()) {
            return;
        }
        File selectedItem = childrenListView.getSelectionModel().getSelectedItem();
        if (selectedItem == null) {
            fileNameBox.clear();
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:MarathonFileChooser.java

示例3: initTreeView

import javafx.util.Callback; //导入依赖的package包/类
private void initTreeView() {
    parentTreeView.setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
        @Override public TreeCell<File> call(TreeView<File> param) {
            return new ParentFileCell();
        }
    });
    parentTreeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newVlaue) -> {
        TreeItem<File> selectedItem = parentTreeView.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            newFolderButton.setDisable(false);
            fileNameBox.setEditable(true);
            File selectedFile = selectedItem.getValue();
            fillUpChildren(selectedFile);
        } else {
            fileNameBox.setEditable(false);
            newFolderButton.setDisable(true);
            childrenListView.getItems().clear();
        }
    });
    File root = fileChooserInfo.getRoot();
    TreeItem<File> rootItem = new TreeItem<>(root);
    parentTreeView.setRoot(rootItem);
    rootItem.setExpanded(true);
    parentTreeView.getSelectionModel().select(0);
    populateChildren(root, rootItem);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:MarathonFileChooser.java

示例4: createTree

import javafx.util.Callback; //导入依赖的package包/类
private Node createTree() {
    VBox treeContentBox = new VBox();
    tree.setRoot(functionInfo.getRoot(true));
    tree.setShowRoot(false);
    tree.getSelectionModel().selectedItemProperty().addListener(new TreeViewSelectionChangeListener());
    tree.setCellFactory(new Callback<TreeView<Object>, TreeCell<Object>>() {
        @Override public TreeCell<Object> call(TreeView<Object> param) {
            return new FunctionTreeCell();
        }
    });
    filterByName.setOnAction((e) -> {
        tree.setRoot(functionInfo.refreshNode(filterByName.isSelected()));
        expandAll();
    });
    filterByName.setSelected(true);
    expandAll();
    treeContentBox.getChildren().addAll(topButtonBar, tree, filterByName);
    VBox.setVgrow(tree, Priority.ALWAYS);
    return treeContentBox;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:FunctionStage.java

示例5: initComponents

import javafx.util.Callback; //导入依赖的package包/类
private void initComponents() {
    optionBox.setItems(model);
    optionBox.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
        if (newValue != null) {
            updateTabPane();
        }
    });
    optionBox.setCellFactory(new Callback<ListView<PlugInModelInfo>, ListCell<PlugInModelInfo>>() {
        @Override public ListCell<PlugInModelInfo> call(ListView<PlugInModelInfo> param) {
            return new LauncherCell();
        }
    });
    optionTabpane.setId("CompositeTabPane");
    optionTabpane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
    optionTabpane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
    VBox.setVgrow(optionTabpane, Priority.ALWAYS);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:CompositeLayout.java

示例6: _getValue

import javafx.util.Callback; //导入依赖的package包/类
@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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:22,代码来源:JavaFXCheckBoxTreeTableCell.java

示例7: ModalDialog

import javafx.util.Callback; //导入依赖的package包/类
public ModalDialog(final Modal controller, URL fxml, Window owner, StageStyle style, Modality modality, ResourceBundle bundle) {
    super(style);
    initOwner(owner);
    initModality(modality);
    FXMLLoader loader = new FXMLLoader(fxml);
    loader.setResources(bundle);
    try {
        loader.setControllerFactory(new Callback<Class<?>, Object>() {
            public Object call(Class<?> aClass) {
                return controller;
            }
        });
        controller.setDialog(this);
        scene = new Scene((Parent) loader.load());
        setScene(scene);
    } catch (IOException e) {
        logger.error("Error loading modal class", e);
        throw new RuntimeException(e);
    }
}
 
开发者ID:stancalau,项目名称:springfx,代码行数:21,代码来源:ModalDialog.java

示例8: ListViewCellFactorySample

import javafx.util.Callback; //导入依赖的package包/类
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:ListViewCellFactorySample.java

示例9: PathSetter

import javafx.util.Callback; //导入依赖的package包/类
public PathSetter(ObservableList<Path> paths, String variableName){
	super(Path.class,variableName);
	this.myPaths=paths;		
	
	pathChoices= new ComboBox<>(myPaths);
	
	pathChoices.setCellFactory(new Callback<ListView<Path>, ListCell<Path>>(){
		@Override
		public ListCell<Path> call(ListView<Path> list){
			return new PathCell();
		}
	});
	pathChoices.setButtonCell(new PathButtonCell());
	
	this.getChildren().add(pathChoices);
	
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:18,代码来源:PathSetter.java

示例10: doAddEntryView

import javafx.util.Callback; //导入依赖的package包/类
private DayEntryView doAddEntryView(Entry<?> entry) {
    Callback<Entry<?>, DayEntryView> factory = getSkinnable().getEntryViewFactory();
    DayEntryView view = factory.call(entry);
    view.getProperties().put("control", getSkinnable()); //$NON-NLS-1$
    view.setManaged(false);

    int index = findIndex(entry);

    getChildren().add(index, view);

    if (!(entry instanceof DraggedEntry) && LoggingDomain.VIEW.isLoggable(Level.FINE)) {
        LoggingDomain.VIEW.fine("added entry view " + entry.getTitle() + ", day = " + getSkinnable().getDate());
    }

    return view;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:17,代码来源:DayViewSkin.java

示例11: initializeDatePickers

import javafx.util.Callback; //导入依赖的package包/类
/**
 * Ensures that the date pickers only allow selection of dates within the valid booking date
 * range, as defined in the specifications document.
 *
 * Chief among these rules is that bookings may not be placed more than one year in advance.
 */
private void initializeDatePickers() {
    Callback<DatePicker, DateCell> dayCellFactory =
        (final DatePicker datePicker) -> new DateCell() {
            @Override
            public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if(item.isAfter(LocalDate.now().plusYears(1))) {
                    setDisable(true);
                }
                if(item.isBefore(ChronoLocalDate.from(LocalDate.now()))) {
                    setDisable(true);
                }
            }
        };
    // Disable selecting invalid check-in/check-out dates
    checkInDatePicker.setDayCellFactory(dayCellFactory);
    checkOutDatePicker.setDayCellFactory(dayCellFactory);
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:26,代码来源:BrowseRoomsScreenController.java

示例12: addGroupParticipantList

import javafx.util.Callback; //导入依赖的package包/类
/** Add participant in group list */
public void addGroupParticipantList() {
	Platform.runLater(() -> {
		groupParticipantTable.setItems(groupParticipantList);

		// Nickname column setting
		groupPartiNicknameColumn.setCellValueFactory(cellData -> cellData.getValue().getNameProperty());
		groupPartiNicknameColumn.setCellFactory(new Callback<TableColumn<User, String>, TableCell<User, String>>() {
			@Override
			public TableCell<User, String> call(TableColumn<User, String> column) {
				TableCell<User, String> tc = new TableCell<User, String>() {
					@Override
					public void updateItem(String item, boolean empty) {
						if (item != null) {
							setText(item);
						}
					}
				};
				tc.setAlignment(Pos.CENTER);
				return tc;
			}
		});
	});
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-Client,代码行数:25,代码来源:MainScene.java

示例13: SpecificationRow

import javafx.util.Callback; //导入依赖的package包/类
/**
 * Create a SpecificationRow from a given number of cells and an extractor. The extractor is
 * required for "deep observing", i.e. the registering of change listeners on the contents of an
 * observable collection (here, the collection of cells - to fire change events not only when
 * cells are added or removed, but also when properties in the cells change). For more information
 * on extractors, see https://docs.oracle
 * .com/javase/8/javafx/api/javafx/collections/FXCollections.html.
 *
 * @param cells The initial cells of the row
 * @param extractor The extractor to be used for deep observing on the cells
 */
public SpecificationRow(Map<String, C> cells, Callback<C, Observable[]> extractor) {
  this.cells = FXCollections.observableMap(cells);
  this.cells.addListener(this::cellsMapChanged);
  this.listeners = new ArrayList<>();
  this.comment = new SimpleStringProperty("");
  this.extractor = extractor;

  this.cells.addListener(this::listenRowInvalidation);
  comment.addListener(this::listenRowInvalidation);
  cells.values().forEach(this::subscribeToCell);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:23,代码来源:SpecificationRow.java

示例14: setSentListView

import javafx.util.Callback; //导入依赖的package包/类
public void setSentListView(){
    sentMessageListView = new JFXListView<>();
    sentMessageListView.setItems(GmailMessages.sentMessages);
    sentMessageListView.setCellFactory(new Callback<ListView<FormattedMessage>, ListCell<FormattedMessage>>() {
        @Override
        public ListCell<FormattedMessage> call(ListView<FormattedMessage> param) {
            return new CustomListCell(currentFolderName);
        }
    });
    sentMessageListView.getStylesheets().add(String.valueOf(getClass().getResource("/listview.css")));
    sentMessageListView.setExpanded(true);
    sentMessageListView.depthProperty().set(1);

    sentMessageListView.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, sentMessageListView.getSelectionModel().getSelectedIndex());
                    setScreenComponent();
                }
                screenComponent.setInfo(newValue);
            }
        }
    });
    /*ScrollBar listViewScrollBar = getListViewScrollBar(sentMessageListView);
    listViewScrollBar.valueProperty().addListener((observable, oldValue, newValue) -> {
        double position = newValue.doubleValue();
        ScrollBar scrollBar = getListViewScrollBar(sentMessageListView);
        if (position == scrollBar.getMax()) {
            try {
                GmailMessages.sentMessages.addAll(GmailOperations.getSentMessages(10));
            } catch (IOException e) {
                e.printStackTrace();
                NotifyUser.getNotification("Internet connection has lost", "Please check your internet connection").showInformation();
            }
        }
    });*/
}
 
开发者ID:ashoknailwal,项目名称:desktop-gmail-client,代码行数:41,代码来源:MainUI3Controller.java

示例15: setTrashListView

import javafx.util.Callback; //导入依赖的package包/类
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();
            }
        }
    });*/
}
 
开发者ID:ashoknailwal,项目名称:desktop-gmail-client,代码行数:41,代码来源:MainUI3Controller.java


注:本文中的javafx.util.Callback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。