本文整理汇总了Java中javafx.collections.ObservableList.add方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.add方法的具体用法?Java ObservableList.add怎么用?Java ObservableList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableList
的用法示例。
在下文中一共展示了ObservableList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EditorDialog
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Instantiates a new Editor dialog.
*/
public EditorDialog() {
this.showedTime = LocalTime.now();
container = new VBox();
container.setAlignment(CENTER);
final EditorConfig editorConfig = EditorConfig.getInstance();
final CssColorTheme theme = editorConfig.getTheme();
final Scene scene = new Scene(container);
final ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.addAll(CSS_REGISTRY.getAvailableCssFiles());
stylesheets.add(theme.getCssFile());
createControls(container);
dialog = new Stage();
dialog.setTitle(getTitleText());
dialog.initStyle(StageStyle.UTILITY);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setResizable(isResizable());
dialog.setScene(scene);
configureSize(container);
}
示例2: mbushNgaStatusi
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public void mbushNgaStatusi(String emri){
try {
String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
Format format = new SimpleDateFormat("dd/MM/yyyy");
String s = "";
while (rs.next()) {
s = format.format(rs.getDate("data"));
data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
}
rs.close();
stmt.close();
conn.close();
table.setItems(data);
}catch (Exception ex){ex.printStackTrace();}
}
示例3: borrowTableData
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public ObservableList<Object> borrowTableData() {
final ObservableList<Object> boData = FXCollections.observableArrayList();
String sql = "SELECT * FROM Borrow_Summary";
try (Connection conn = connector();
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery(sql)) {
while (result.next()) {
boData.add(new BorrowTableDataModel(result.getString("boDate"), result.getString("boWhom"), result.getString("boExactTk")));
}
} catch (Exception e) {
e.printStackTrace();
}
return boData;
}
示例4: getChildren
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private ObservableList<Node> getChildren(Node node) {
if (node instanceof ButtonBar) {
return ((ButtonBar) node).getButtons();
}
if (node instanceof ToolBar) {
return ((ToolBar) node).getItems();
}
if (node instanceof Pane) {
return ((Pane) node).getChildren();
}
if (node instanceof TabPane) {
ObservableList<Node> contents = FXCollections.observableArrayList();
ObservableList<Tab> tabs = ((TabPane) node).getTabs();
for (Tab tab : tabs) {
contents.add(tab.getContent());
}
return contents;
}
return FXCollections.observableArrayList();
}
示例5: fill
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Fill the node.
*/
@FXThread
private void fill(@NotNull final TreeItem<ResourceElement> treeItem) {
final ResourceElement element = treeItem.getValue();
final Array<String> extensionFilter = getExtensionFilter();
if (!element.hasChildren(extensionFilter, isOnlyFolders())) return;
final ObservableList<TreeItem<ResourceElement>> items = treeItem.getChildren();
if (isLazyMode()) {
items.add(new TreeItem<>(LoadingResourceElement.getInstance()));
} else {
final Array<ResourceElement> children = element.getChildren(extensionFilter, isOnlyFolders());
children.sort(NAME_COMPARATOR);
children.forEach(child -> items.add(new TreeItem<>(child)));
items.forEach(this::fill);
}
}
示例6: getSelectedPrescriptionDrugs
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public ObservableList<PrescriptionDrug> getSelectedPrescriptionDrugs(int prescriptionId) {
ObservableList<PrescriptionDrug> listData = FXCollections.observableArrayList();
con = connection.geConnection();
try {
pst = con.prepareStatement("select * from prescription_drug where prescription_id=?");
pst.setInt(1, prescriptionId);
rs = pst.executeQuery();
while (rs.next()) {
listData.add(new PrescriptionDrug(
rs.getInt(1),
rs.getInt(2),
rs.getInt(3),
drugGetway.selectedDrug(rs.getInt(2)).getName(),
rs.getString(4),
rs.getString(5),
rs.getString(6),
rs.getString(7),
rs.getString(8)
));
}
} catch (SQLException ex) {
Logger.getLogger(PrescriptionGetway.class.getName()).log(Level.SEVERE, null, ex);
}
return listData;
}
示例7: setValue
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* 装载面板数据.
*
* @param key 数据库中的键
*/
@Override
public void setValue(String key) {
ObservableList<TableEntity> values = FXCollections.observableArrayList();
Map<String, String> maps = redisHash.getAllMap(key);
int i = 0;
for (Map.Entry<String, String> entry : maps.entrySet()) {
TableEntity value = new TableEntity("" + i, entry.getKey().trim(), entry.getValue());
values.add(value);
i++;
}
this.dataTable.setItems(values);
this.rowColumn.setCellValueFactory(cellData -> cellData.getValue().rowProperty());
this.keyColumn.setCellValueFactory(cellData -> cellData.getValue().keyProperty());
this.valueColumn.setCellValueFactory(cellData -> cellData.getValue().valueProperty());
}
示例8: populateComboBoxWithLanguages
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void populateComboBoxWithLanguages(ComboBox<LanguageList> listLanguages) {
final ObservableList<LanguageList> langList = FXCollections.observableArrayList();
final LanguageList[] valuesLang = LanguageList.values();
for (int i = 0; i < valuesLang.length; i++) {
langList.add(valuesLang[i]);
}
listLanguages.setItems(langList);
}
示例9: add
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public void add(VLToolBar toolbar) {
ObservableList<Node> children = getChildren();
if (children.size() > 0 && orientation == Orientation.LEFT) {
VLToolBar last = (VLToolBar) children.get(children.size() - 1);
HBox.setHgrow(last, Priority.NEVER);
HBox.setHgrow(toolbar, Priority.ALWAYS);
}
if (children.size() == 0 && orientation == Orientation.RIGHT) {
// YUK!!!
toolbar.getItems().add(0, createFiller());
HBox.setHgrow(toolbar, Priority.ALWAYS);
}
children.add(toolbar);
}
示例10: TimingDiagramController
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Instantiates a new Timing diagram controller with a category xAxis.
*
* @param commonXAxis the common x axis
* @param externalYAxis the external y axis
* @param spec the specification
* @param ioVariable the io variable
* @param selection the selection that should be updated
* @param activated property that indicates if the selection should be updated
*/
public TimingDiagramController(NumberAxis commonXAxis, CategoryAxis externalYAxis,
ConcreteSpecification spec, ValidIoVariable ioVariable, Selection selection,
BooleanProperty activated) {
this.activated = activated;
this.ioVariable = ioVariable;
this.selection = selection;
this.concreteSpec = spec;
this.commonXAxis = commonXAxis;
NumberAxis xaxis = new NumberAxis(0, 0, 1);
CategoryAxis yaxis = new CategoryAxis();
TimingDiagramView<String> view = new TimingDiagramView<>(xaxis, yaxis);
this.view = view;
XYChart.Series<Number, String> seriesData =
Plotable.toStringSeries(spec.getColumnByName(ioVariable.getName()).getCells());
ObservableList<XYChart.Series<Number, String>> data = FXCollections.observableArrayList();
data.add(seriesData);
view.getData().addAll(data);
externalYAxis.prefHeightProperty().bind(yaxis.heightProperty());
yaxis.setAutoRanging(true);
yaxis.setCategories(externalYAxis.getCategories());
xaxis.lowerBoundProperty().bind(commonXAxis.lowerBoundProperty());
xaxis.upperBoundProperty().bind(commonXAxis.upperBoundProperty());
initCommon();
}
示例11: pieChartData
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
ObservableList<PieChart.Data> pieChartData() {
ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
List<Supervisor> supervisors = supervisorMapper.readAll();
Integer timesWorkedUnderSupervisor;
for (Supervisor supervisor : supervisors) {
timesWorkedUnderSupervisor =
getNumberOfLogEntriesContainingSpecifiedDatabaseItem(supervisor.getSupervisorDisplayName());
data.add(new PieChart.Data(supervisor.getSupervisorDisplayName(), timesWorkedUnderSupervisor));
}
return data;
}
示例12: fillContextMenu
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
items.add(new RemoveLightAction(nodeTree, this));
items.add(new RenameNodeAction(nodeTree, this));
super.fillContextMenu(nodeTree, items);
}
示例13: fillContextMenu
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
@NotNull final ObservableList<MenuItem> items) {
if (!(nodeTree instanceof ModelNodeTree)) return;
final Menu changeMeshMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_PARTICLE_EMITTER_CHANGE_PARTICLES_MESH, new ImageView(Icons.MESH_16));
final ObservableList<MenuItem> subItems = changeMeshMenu.getItems();
subItems.add(new CreateQuadParticleMeshAction(nodeTree, this));
subItems.add(new CreatePointParticleMeshAction(nodeTree, this));
subItems.add(new CreateImpostorParticleMeshAction(nodeTree, this));
subItems.add(new LoadModelParticlesMeshAction(nodeTree, this));
final Menu jmePrimitivesMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE_PRIMITIVE, new ImageView(Icons.GEOMETRY_16));
final ObservableList<MenuItem> primitivesItems = jmePrimitivesMenu.getItems();
primitivesItems.add(new CreateBoxShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateCylinderShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateDomeShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateQuadShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateSphereShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateTorusShapeEmitterAction(nodeTree, this));
final Menu changeShapeMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_PARTICLE_EMITTER_CHANGE_SHAPE, new ImageView(Icons.GEOMETRY_16));
changeShapeMenu.getItems().addAll(new CreateTriangleShapeEmitterAction(nodeTree, this),
jmePrimitivesMenu,
new LoadModelShapeEmitterAction(nodeTree, this));
items.add(changeShapeMenu);
items.add(changeMeshMenu);
super.fillContextMenu(nodeTree, items);
}
示例14: getFilteredBooksList
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public ObservableList<BookEntity> getFilteredBooksList(String searchPhrase, String column) {
ResultSet rs = connector.executeSelectStatement("SELECT * FROM books WHERE books." + column + " COLLATE UTF8_GENERAL_CI LIKE '%" + searchPhrase + "%'");
try {
ObservableList<BookEntity> result = FXCollections.observableArrayList();
while (rs.next()) {
result.add(new BookEntity(rs.getInt("id"), rs.getString("title"), rs.getString("category"), rs.getString("author"), rs.getInt("isbn"), rs.getString("publisher"),
rs.getDate("pub_date"), rs.getInt("pages"), rs.getInt("quantity")));
}
return result;
} catch (SQLException ex) {
Logger.getLogger(Book.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
示例15: init
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void init(Stage stage, Scene scene, Pane pane) {
this.stage = stage;
//create list with all transition types
ObservableList<String> list = FXCollections.observableArrayList();
for (String typeName : Transition.listTransitionTypeNames()) {
list.add(typeName);
}
//set transition types to choice box
typeChoiceBox.setItems(list);
typeChoiceBox.getSelectionModel().select(0);
addTransitionButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
String selectedType = typeChoiceBox.getSelectionModel().getSelectedItem();
try {
addTransition(Transition.getTransitionByTitle(selectedType).getType());
} catch (Exception e) {
JavaFXUtils.showErrorDialog("Cannot create transition", "Cannot create transition, maybe transition isnt supported yet. Please contact developers!");
return;
}
}
});
Platform.runLater(() -> {
refreshListView();
});
}