本文整理汇总了Java中javafx.collections.ObservableList.size方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.size方法的具体用法?Java ObservableList.size怎么用?Java ObservableList.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableList
的用法示例。
在下文中一共展示了ObservableList.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marathon_select
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override public boolean marathon_select(String tab) {
Matcher matcher = CLOSE_PATTERN.matcher(tab);
boolean isCloseTab = matcher.matches();
tab = isCloseTab ? matcher.group(1) : tab;
TabPane tp = (TabPane) node;
ObservableList<Tab> tabs = tp.getTabs();
for (int index = 0; index < tabs.size(); index++) {
String current = getTextForTab(tp, tabs.get(index));
if (tab.equals(current)) {
if (isCloseTab) {
((TabPaneSkin) tp.getSkin()).getBehavior().closeTab(tabs.get(index));
return true;
}
tp.getSelectionModel().select(index);
return true;
}
}
return false;
}
示例2: notifyChangeProperty
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Notify about changed property.
*/
@FXThread
public void notifyChangeProperty() {
final ListView<TextureLayer> listView = getListView();
final ObservableList<TextureLayer> items = listView.getItems();
final int maxLevels = getMaxLevels() - 1;
int newCount = 0;
for (int i = 0; i < maxLevels; i++) {
final float scale = getTextureScale(i);
if (scale == -1F) continue;
newCount++;
}
if (newCount != items.size()) {
refresh();
} else {
getCells().forEach(TextureLayerCell::refresh);
}
}
示例3: launch
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public static SecondScreen launch() {
ObservableList<Screen> screens = Screen.getScreens();
if (screens.size() < 2)
return null;
Screen screen1 = screens.get(0);
Screen screen2 = screens.get(1);
log.info("screen1.getBounds() = " + screen1.getBounds());
log.info("screen2.getBounds() = " + screen2.getBounds());
Stage stage2 = new Stage();
stage2.setScene(new Scene(new Label("primary")));
stage2.setX(screen2.getVisualBounds().getMinX());
stage2.setY(screen2.getVisualBounds().getMinY());
stage2.setWidth(screen1.getBounds().getWidth());
stage2.setHeight(screen1.getBounds().getHeight());
Group root = new Group();
Scene scene = new Scene(root, screen1.getBounds().getWidth(), screen1.getBounds().getHeight(), Color.BLACK);
makeLighting(root, screen2.getBounds());
stage2.setScene(scene);
stage2.show();
SecondScreen sc = new SecondScreen();
Configuration config = ConfigurationBuilder.createFromPropertiesResource().build();
/*
* if (config.eyetracker.equals("tobii")) Tobii.execProg(sc); else
*/
if (config.isGazeMode())
gazeListener = new EyeTribeGazeListener(sc);
else
gazeListener = new FuzzyGazeListener(sc);
return sc;
}
示例4: cleanup
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Cleanup the tree.
*/
@FXThread
private void cleanup(@NotNull final TreeItem<ResourceElement> treeItem) {
final ResourceElement element = treeItem.getValue();
if (element instanceof FileResourceElement || element instanceof LoadingResourceElement) return;
final ObservableList<TreeItem<ResourceElement>> children = treeItem.getChildren();
for (int i = children.size() - 1; i >= 0; i--) {
cleanup(children.get(i));
}
if (children.isEmpty() && treeItem.getParent() != null) {
final TreeItem<ResourceElement> parent = treeItem.getParent();
final ObservableList<TreeItem<ResourceElement>> parentChildren = parent.getChildren();
parentChildren.remove(treeItem);
}
}
示例5: calcNoOfNodes
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
for (Node n : tempChildren) { calcNoOfNodes(n); }
}
}
}
示例6: getParentIndex
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Get index of parent in the list of TreeItems.
*
* @param tree
* TreeView which contains the parent
* @param parentItem
* The item to find.
*
* @return the index of the parent in the treeview.
*/
private int getParentIndex(TreeView<HomeworkTask> tree,
TreeItem<HomeworkTask> parentItem) {
ObservableList<TreeItem<HomeworkTask>> parentList = tree.getRoot()
.getChildren();
int parentIndex = 0;
for (int i = 0; i < parentList.size(); i++) {
if (parentList.get(i).equals(parentItem)) {
parentIndex = i;
}
}
return parentIndex;
}
示例7: convertTreeToArrayList
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Converts a TreeView to a list of lists of tasks. The first item of each
* list is the parent task, the items after that are its subtasks.
*
* @param tree
* The TreeView to convert.
*
* @return List<List<HomeworkTask>>
*/
List<List<HomeworkTask>> convertTreeToArrayList(
TreeView<HomeworkTask> tree) {
// create a list with the tree items of the parent tasks
ObservableList<TreeItem<HomeworkTask>> parentItems = tree.getRoot()
.getChildren();
// create a list with homework tasks of the parent tasks
List<HomeworkTask> parentTasks = convertTreeItemListToArrayList(
parentItems);
// create the list to eventually return
List<List<HomeworkTask>> tasks = new ArrayList<>();
for (int i = 0; i < parentItems.size(); i++) {
// get the sub tree items of parent task i, and store them in a list
ObservableList<TreeItem<HomeworkTask>> childItems = parentItems
.get(i).getChildren();
// store the subtasks of parent task i in a list
List<HomeworkTask> childTasks = convertTreeItemListToArrayList(
childItems);
// create a list containing one parent and its children
List<HomeworkTask> oneFamily = new ArrayList<>();
oneFamily.add(parentTasks.get(i)); // add the parent to the family
oneFamily.addAll(childTasks); // add its children to the family
tasks.add(oneFamily); // add the family to the nested list of tasks
}
return tasks;
}
示例8: apply
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void apply() {
ObservableList<Annotation> annotations = toolBox.getData().getSelectedAnnotations();
final int count = annotations.size();
ResourceBundle i18n = toolBox.getI18nBundle();
String content = i18n.getString("buttons.delete.dialog.content1") + " " +
count + " " + i18n.getString("buttons.delete.dialog.content2");
alert.setContentText(content);
Optional<ButtonType> buttonType = alert.showAndWait();
if (buttonType.get() == ButtonType.OK) {
toolBox.getEventBus()
.send(new DeleteAnnotationsCmd(annotations));
}
}
示例9: columnHeadersMatch
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private boolean columnHeadersMatch(ObservableList<ValidIoVariable> columnHeaders) {
if (this.columnHeaders.size() != columnHeaders.size()) {
return false;
}
for (int i = 0; i < this.columnHeaders.size(); i++) {
if (!this.columnHeaders.get(i).matches(columnHeaders.get(i))) {
return false;
}
}
return true;
}
示例10: tab
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override public void tab(Dockable base, Dockable dockable, int order, boolean select) {
dockables.add(base);
dockables.add(dockable);
base.setContainer(this);
dockable.setContainer(this);
ObservableList<Tab> tabs = getTabs();
if (order > tabs.size()) {
order = tabs.size();
}
getTabs().add(order, newTab(dockable));
if (select) {
getSelectionModel().select(order);
}
}
示例11: refreshFile
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* 刷新文件,cdn相关
*/
public void refreshFile(ObservableList<FileInfo> fileInfos, String domain) {
if (Checker.isNotEmpty(fileInfos)) {
String[] files = new String[fileInfos.size()];
int i = 0;
for (FileInfo fileInfo : fileInfos) {
files[i++] = getPublicURL(fileInfo.getName(), domain);
}
refreshFile(files);
}
}
示例12: 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);
}
示例13: updateSeries
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* update the series
*
* @param series
* @param cellValues
*/
private void updateSeries(Series<String, Number> series,
CANProperty<DoubleValue, Double> cellValues) {
DoubleValue cellDoubleValues = cellValues.getCanValue();
if (cellDoubleValues.getMax()==null || cellDoubleValues.getMin()==null) {
return;
}
List<CANValueItem<Double>> valueItems = cellDoubleValues.getValueItems();
ObservableList<Data<String, Number>> seriesData = series.getData();
if (debug) {
CANInfo canInfo = cellValues.getCANInfo();
LOGGER.log(Level.INFO, "plotting for " + canInfo.getMaxIndex()
+ " values of " + canInfo.getTitle());
}
int i = 0;
yAxis.setAutoRanging(false);
yAxis.setLowerBound(cellDoubleValues.getMin()-rangeExtra);
yAxis.setUpperBound(cellDoubleValues.getMax()+rangeExtra);
yAxis.setTickUnit(this.tickUnit);
for (CANValueItem<Double> valueItem : valueItems) {
if (valueItem.isAvailable()) {
Double value = valueItem.getValue();
if (seriesData.size() > i) {
Data<String, Number> seriesEntry = seriesData.get(i);
seriesEntry.setYValue(value);
} else {
String cellnum = "" + (i+1);
seriesData.add(
new XYChart.Data<String, Number>(cellnum, value));
} // if seriesEntry exists
} // if available
i++;
} // for
}
示例14: search
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* 搜索子菜单
*
* @param uiPlatform
* @param menu
*/
private void search(UIPlatform uiPlatform, Menu menu)
{
ObservableList<MenuItem> list = menu.getItems();
if (list.size() == 0)
{
return;
}
final String idPrefix = getPrefix().idPrefix;
final String pathPrefix = getPrefix().pathPrefix;
IdDeal idDeal = uiPlatform.getIdDeal();
BinderFactory factory = uiPlatform.getBinderFactory();
for (int i = 0; i < list.size(); i++)
{
MenuItem menuItem = list.get(i);
UiId id = UiId.newInstance(menuItem.getId(), idPrefix);
if (id != null)
{
IdDeal.Result result = idDeal.dealId(id, pathPrefix);
if (result != null)
{
hashMap.put(id, factory.getBinder(menuItem));
}
}
if (menuItem instanceof Menu)
{
search(uiPlatform, (Menu) menuItem);
}
}
}
示例15: handleDeleteAction
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@FXML
private void handleDeleteAction(ActionEvent event) {
ObservableList<Integer> selectedIndices = ownersListView.getSelectionModel().getSelectedIndices();
for (int i = 0; i < selectedIndices.size(); i++) {
try {
Connection connection = DriverManager
.getConnection("jdbc:mysql://172.17.0.134/propertydb",
"javauser",
"java");
Statement statement = connection.createStatement();
int propertyId = ownersList.get(selectedIndices.get(i)).getPropertyId();
String ownersName = ownersList.get(selectedIndices.get(i)).getOwnersName();
statement.executeUpdate("DELETE FROM property WHERE propertyId = "
+ propertyId + " AND ownersName = '"
+ ownersName + "'");
ownersList.remove(selectedIndex);
statusLabel.setText("Deleted " + propertyId + " " + ownersName);
propertyIdField.clear();
ownersNameField.clear();
} catch (SQLException sqle) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error message");
alert.setHeaderText("Database error");
alert.setContentText("Could not connect to the database");
alert.showAndWait();
System.err.println("Cannot connect to the database");
}
}
}