本文整理汇总了Java中javafx.collections.ObservableList.clear方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.clear方法的具体用法?Java ObservableList.clear怎么用?Java ObservableList.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableList
的用法示例。
在下文中一共展示了ObservableList.clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePathSizeValues
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Update a list of available path sizes.
*/
@FXThread
private void updatePathSizeValues() {
final ComboBox<Integer> pathSizeComboBox = getPatchSizeComboBox();
final SingleSelectionModel<Integer> selectionModel = pathSizeComboBox.getSelectionModel();
final Integer current = selectionModel.getSelectedItem();
final ObservableList<Integer> items = pathSizeComboBox.getItems();
items.clear();
final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
final Integer naxValue = totalSizeComboBox.getSelectionModel().getSelectedItem();
for (final Integer value : PATCH_SIZE_VARIANTS) {
if (value >= naxValue) break;
items.add(value);
}
if (items.contains(current)) {
selectionModel.select(current);
} else {
selectionModel.select(items.get(items.size() - 1));
}
}
示例2: populateMenuItems
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void populateMenuItems(ContextMenu contextMenu, Tab tab) {
int tabCount = getTabs().size();
int tabIndex = getTabs().indexOf(tab);
ObservableList<MenuItem> items = contextMenu.getItems();
items.clear();
MenuItem closeMenuItem = new MenuItem("Close");
closeMenuItem.setOnAction((e) -> requestClose(tab));
items.add(closeMenuItem);
if (tabCount > 1) {
MenuItem closeRestMenuItem = new MenuItem("Close Others");
closeRestMenuItem.setOnAction((e) -> closeOtherTabs(tab));
items.add(closeRestMenuItem);
}
if (tabCount > 1 && tabIndex != 0) {
MenuItem closeLeftTabsMenuItem = new MenuItem("Close Tabs to the Left");
closeLeftTabsMenuItem.setOnAction((e) -> closeTabsToLeft(tab));
items.add(closeLeftTabsMenuItem);
}
if (tabCount > 1 && tabIndex != tabCount - 1) {
MenuItem closeRigthTabsMenuItem = new MenuItem("Close Tabs to the Right");
closeRigthTabsMenuItem.setOnAction((e) -> closeTabsToRight(tab));
items.add(closeRigthTabsMenuItem);
}
if (tabCount > 1) {
MenuItem closeAllMenuItem = new MenuItem("Close All");
closeAllMenuItem.setOnAction((e) -> closeAllTabs());
items.addAll(new SeparatorMenuItem(), closeAllMenuItem);
}
}
示例3: testCombineListsListeners
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Test
@SuppressWarnings("LocalVariableName")
public void testCombineListsListeners() {
ObservableList<String> a = FXCollections.observableArrayList("a");
ObservableList<String> b = FXCollections.observableArrayList("b");
ObservableList<String> combine = PropertyUtils.combineLists(a, b);
a.add("A");
assertEquals(3, combine.size());
b.add("B");
assertEquals(4, combine.size());
assertEquals(a.get(1), combine.get(2));
assertEquals(b.get(1), combine.get(3));
a.clear();
b.clear();
assertEquals(0, combine.size());
}
示例4: showComponentFor
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Show a processing component to process with the element.
*
* @param element the element to process.
*/
@FXThread
public void showComponentFor(@Nullable final Object element) {
final VBox container = getContainer();
final ObservableList<Node> children = container.getChildren();
children.stream().filter(componentType::isInstance)
.map(componentType::cast)
.peek(ProcessingComponent::notifyHided)
.forEach(ProcessingComponent::stopProcessing);
children.clear();
if (element == null) return;
final C processingComponent = getComponents().search(element, C::isSupport);
if (processingComponent == null) return;
children.add((Node) processingComponent);
processingComponent.startProcessing(element);
if (isShowed()) {
processingComponent.notifyShowed();
}
}
示例5: listKeys0
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void listKeys0() {
if (StringUtils.isBlank(this.txtKeyPattern.getText())) {
this.txtKeyPattern.setText("*");
}
String pattern = this.txtKeyPattern.getText();
int limit = Integer.parseInt(String.valueOf(cmbLimit.getValue()));
ObservableList<KeyItem> items = this.tblKeys.getItems();
items.clear();
if (pattern.trim().length() > 0) {
try (Jedis jedis = JedisManager.getJedis()) {
ScanParams scanParams = new ScanParams().match(pattern).count(limit);
ScanResult<String> result = jedis.scan(ScanParams.SCAN_POINTER_START, scanParams);
result.getResult().forEach(key -> {
String type = jedis.type(key);
items.add(new KeyItem(key, type));
});
}
}
}
示例6: reload
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Reload the material.
*/
@FXThread
private void reload(@NotNull final Material material) {
setCurrentMaterial(material);
setIgnoreListeners(true);
try {
final MaterialEditor3DState editor3DState = getEditor3DState();
editor3DState.updateMaterial(material);
getSettingsTree().fill(new RootMaterialSettings(material));
final ComboBox<String> materialDefinitionBox = getMaterialDefinitionBox();
final ObservableList<String> items = materialDefinitionBox.getItems();
items.clear();
items.addAll(RESOURCE_MANAGER.getAvailableResources(FileExtensions.JME_MATERIAL_DEFINITION));
final MaterialDef materialDef = material.getMaterialDef();
materialDefinitionBox.getSelectionModel().select(materialDef.getAssetName());
} finally {
setIgnoreListeners(false);
}
}
示例7: reload
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
if (!hasEditObject()) return;
final Geometry geometry = getEditObject();
final Mesh mesh = geometry.getMesh();
if (mesh == null) return;
final Integer element = getPropertyValue();
final ComboBox<Integer> levelComboBox = getLevelComboBox();
final ObservableList<Integer> items = levelComboBox.getItems();
items.clear();
final int numLodLevels = mesh.getNumLodLevels();
for (int i = 0; i < numLodLevels; i++) {
items.add(i);
}
if (items.isEmpty()) {
items.add(0);
}
levelComboBox.getSelectionModel().select(element);
}
示例8: buildFor
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Build property controls for the object.
*
* @param object the object
* @param parent the parent
*/
@FXThread
public void buildFor(@Nullable final Object object, @Nullable final Object parent) {
if (getCurrentObject() == object) return;
final VBox container = getContainer();
final ObservableList<Node> children = container.getChildren();
children.clear();
if (object != null) {
BUILDER_REGISTRY.buildFor(object, parent, container, changeConsumer);
}
container.setDisable(object == null || !canEdit(object, parent));
setCurrentObject(object);
setCurrentParent(parent);
}
示例9: processEvent
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Handle changing the current asset folder.
*/
@FXThread
private void processEvent(@NotNull final ChangedCurrentAssetFolderEvent event) {
setIgnoreOpenedFiles(true);
try {
final ObservableList<Tab> tabs = getTabs();
tabs.clear();
loadOpenedFiles();
} finally {
setIgnoreOpenedFiles(false);
}
}
示例10: fillUpChildren
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void fillUpChildren(File rootFile) {
File[] files = rootFile.listFiles();
ObservableList<File> items = childrenListView.getItems();
items.clear();
if (files != null) {
for (File file : files) {
if (!file.isDirectory()) {
items.add(file);
}
}
}
}
示例11: clearLevels
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Clear added levels.
*/
@FXThread
private void clearLevels() {
final ListView<Number> levelsList = getLevelsList();
final ObservableList<Number> items = levelsList.getItems();
items.clear();
}
示例12: smooth
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void smooth(ObservableList<PathElement> strokeElements, ObservableList<PathElement> fillElements, final double HEIGHT) {
if (fillElements.isEmpty()) return;
// as we do not have direct access to the data, first recreate the list of all the data points we have
final Point2D[] dataPoints = new Point2D[strokeElements.size()];
for (int i = 0; i < strokeElements.size(); i++) {
final PathElement element = strokeElements.get(i);
if (element instanceof MoveTo) {
final MoveTo move = (MoveTo) element;
dataPoints[i] = new Point2D(move.getX(), move.getY());
} else if (element instanceof LineTo) {
final LineTo line = (LineTo) element;
final double x = line.getX(), y = line.getY();
dataPoints[i] = new Point2D(x, y);
}
}
double firstX = dataPoints[0].getX();
double lastX = dataPoints[dataPoints.length - 1].getX();
Point2D[] points = Helper.subdividePoints(dataPoints, getSubDivisions());
fillElements.clear();
fillElements.add(new MoveTo(firstX, HEIGHT));
strokeElements.clear();
strokeElements.add(new MoveTo(points[0].getX(), points[0].getY()));
for (Point2D p : points) {
if (Double.compare(p.getX(), firstX) >= 0) {
fillElements.add(new LineTo(p.getX(), p.getY()));
strokeElements.add(new LineTo(p.getX(), p.getY()));
}
}
fillElements.add(new LineTo(lastX, HEIGHT));
fillElements.add(new LineTo(0, HEIGHT));
fillElements.add(new ClosePath());
}
示例13: updateSeries
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* update the given chart Series
* @param series - the series to update
* @param canProperty - the canvalue to take the data from
*/
@SuppressWarnings("rawtypes")
public void updateSeries(XYChart.Series<Number, Number> series, CANProperty canProperty) {
CircularFifoQueue<?> history = canProperty.getCanValue().getHistory();
if (debug)
LOGGER.log(Level.INFO,
"plotting for " + history.size() + " history values of " + canProperty.getCanValue().canInfo.getTitle());
Date first=null;
ObservableList<Data<Number, Number>> dataList = series.getData();
// FIXME - full redraw?
dataList.clear();
for (Object historyValueObject : history) {
ValueItem<?>historyValue = (ValueItem<?>) historyValueObject;
Date timeStamp=historyValue.getTimeStamp();
if (first==null)
first=timeStamp;
Double value;
if (historyValue.getValue() instanceof Integer) {
// http://stackoverflow.com/questions/31860761/maven-compile-error-with-using-java-generics
int intValue=(Integer) historyValue.getValue();
value = new Double(intValue*1.0);
} else {
value = (Double) historyValue.getValue();
}
long minute = getMinute(timeStamp,first);
Data<Number, Number> chartData = new XYChart.Data<Number,Number>(minute,value);
dataList.add(chartData);
}
}
示例14: refreshPlugins
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Refresh the list of installed plugins.
*/
@FXThread
private void refreshPlugins() {
final ObservableList<EditorPlugin> items = pluginListView.getItems();
items.clear();
PLUGIN_MANAGER.handlePlugins(items::add);
}
示例15: validate
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
@FXThread
protected void validate(@NotNull final Label warningLabel, @Nullable final ResourceElement element) {
final ComboBox<String> comboBox = getTextureParamNameComboBox();
final ObservableList<String> items = comboBox.getItems();
items.clear();
final Path file = element == null ? null : element.getFile();
if (file != null && !Files.isDirectory(file)) {
final AssetManager assetManager = EDITOR.getAssetManager();
final Path assetFile = getAssetFile(file);
if (assetFile == null) {
throw new RuntimeException("AssetFile can't be null.");
}
final MaterialKey materialKey = new MaterialKey(toAssetPath(assetFile));
final Material material = assetManager.loadAsset(materialKey);
final MaterialDef materialDef = material.getMaterialDef();
final Collection<MatParam> materialParams = materialDef.getMaterialParams();
materialParams.stream()
.filter(param -> param.getVarType() == VarType.Texture2D)
.filter(matParam -> material.getTextureParam(matParam.getName()) != null)
.forEach(filtred -> items.add(filtred.getName()));
final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
if (!items.isEmpty()) {
selectionModel.select(0);
} else {
selectionModel.select(null);
}
}
super.validate(warningLabel, element);
}