本文整理汇总了Java中org.controlsfx.control.PropertySheet.Item类的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于org.controlsfx.control.PropertySheet包,在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@FXML
void initialize() {
Callback<Item, PropertyEditor<?>> oldFactory = propertySheet.getPropertyEditorFactory();
propertySheet.setPropertyEditorFactory(new Callback<PropertySheet.Item, PropertyEditor<?>>() {
@Override
public PropertyEditor<?> call(PropertySheet.Item item) {
if (item.getValue() instanceof Image) {
return ImagePropertyEditor.createImageEditor(item);
}
return oldFactory.call(item);
}
});
customCssArea.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue != null) {
getProject().setCss(newValue);
MainWindow.touch();
queuePreviewUpdate();
}
}
});
updateFields();
}
开发者ID:Quantencomputer,项目名称:cyoastudio,代码行数:27,代码来源:StyleEditor.java
示例2: DirectoryEditor
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
public DirectoryEditor(Item property, TextField control) {
super(property, control, true);
control.setOnMouseClicked(e -> {
if (e.getClickCount() > 1) {
e.consume();
File dirNew = QuPathGUI.getDialogHelperForParent(control).promptForDirectory(getValue());
if (dirNew != null)
setValue(dirNew);
}
});
if (property.getDescription() != null)
control.setTooltip(new Tooltip(property.getDescription()));
// Bind to the text property
if (property instanceof DirectoryPropertyItem) {
control.textProperty().bindBidirectional(((DirectoryPropertyItem)property).prop);
}
value = Bindings.createObjectBinding(() -> {
String text = control.getText();
if (text == null || text.trim().isEmpty() || !new File(text).isDirectory())
return null;
else
return new File(text);
}, control.textProperty());
}
开发者ID:qupath,项目名称:qupath,代码行数:26,代码来源:PreferencePanel.java
示例3: call
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public PropertyEditor<?> call(PropertySheet.Item item) {
if (!(item instanceof Parameter))
throw new IllegalArgumentException(
"This ParameterEditorFactory can be only used for Parameter instances");
PropertyEditor<?> editor = super.call(item);
// Save the reference for the editor
editorsMap.put(item, editor);
if (editor instanceof ParameterEditor) {
addValidator(validationSupport, (Parameter<?>) item, (ParameterEditor<?>) editor);
}
return editor;
}
开发者ID:mzmine,项目名称:mzmine3,代码行数:19,代码来源:ParameterEditorFactory.java
示例4: createImageEditor
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
public static PropertyEditor<?> createImageEditor(Item property) {
return new AbstractPropertyEditor<Image, ImagePropertyEditor>(property, new ImagePropertyEditor()) {
@Override
protected ObjectProperty<Image> getObservableValue() {
return getEditor().valueProperty();
}
@Override
public void setValue(Image value) {
getEditor().setValue(value);
}
};
}
开发者ID:Quantencomputer,项目名称:cyoastudio,代码行数:15,代码来源:ImagePropertyEditor.java
示例5: propertyCopy2
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
public void propertyCopy2(Node from, Node to) {
ObservableList<Item> properties = BeanPropertyUtils.getProperties(from);
ObservableList<Item> properties2 = BeanPropertyUtils.getProperties(from);
properties.forEach(item -> {
// System.out.println(item.getCategory() + "/ name : " +
// item.getName() + " value : " + item.getValue());
setProperty(to, item.getName(), item.getValue());
});
properties2.addAll(properties);
}
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:14,代码来源:PropertyChangeExam.java
示例6: call
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public PropertyEditor<?> call(Item item) {
if (item.getType() == File.class) {
return new DirectoryEditor(item, new TextField());
}
if (item instanceof ChoicePropertyItem) {
return Editors.createChoiceEditor(item, ((ChoicePropertyItem<?>)item).getChoices());
}
// // This doesn't work...
// if (item.getType() == Double.class) {
// return new DoubleEditor(item, new TextField(), true);
// }
return super.call(item);
}
开发者ID:qupath,项目名称:qupath,代码行数:15,代码来源:PreferencePanel.java
示例7: saveExportPreferences
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Save export preferences for another occasion.
*
* @param items
* @param name
* @throws IOException
*/
static void saveExportPreferences(final List<Item> items, final String name) throws IOException {
Map<String, Serializable> map = getPreferenceMap(items);
try (ByteArrayOutputStream b = new ByteArrayOutputStream()){
try (ObjectOutputStream o = new ObjectOutputStream(b)){
o.writeObject(map);
}
byte[] bytes = b.toByteArray();
PathPrefs.getUserPreferences().putByteArray(EXPORT_CHART_PREFS_KEY + name, bytes);
}
}
开发者ID:qupath,项目名称:qupath,代码行数:18,代码来源:ExportChartPanel.java
示例8: loadExportPreferences
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Load & apply previously-saved preferences
*
* @param items
* @param name
* @throws IOException
*/
static boolean loadExportPreferences(final List<Item> items, final String name) throws IOException, ClassNotFoundException {
byte[] prefsArray = PathPrefs.getUserPreferences().getByteArray(EXPORT_CHART_PREFS_KEY + name, null);
if (prefsArray == null)
return false;
Map<?, ?> map = null;
try (ByteArrayInputStream b = new ByteArrayInputStream(prefsArray)){
try (ObjectInputStream o = new ObjectInputStream(b)){
Object object = o.readObject();
if (object instanceof Map)
map = (Map<?, ?>)object;
}
}
if (map == null)
return false;
int count = 0;
for (Item item : items) {
// Don't want to load Series properties - these might vary
if ("Series".equals(item.getCategory()))
continue;
Object value = map.get(item.getName());
if (value != null) {
item.setValue(value);
count++;
}
}
logger.debug("{} preferences set", count);
return true;
}
开发者ID:qupath,项目名称:qupath,代码行数:40,代码来源:ExportChartPanel.java
示例9: getPreferenceMap
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Get a map representing all the current export preferences with Serializable values.
*
* @param items
* @return
*/
static Map<String, Serializable> getPreferenceMap(final List<Item> items) {
Map<String, Serializable> prefsMap = new LinkedHashMap<>();
for (Item item : items) {
String name = item.getName();
Object value = item.getValue();
if (value instanceof Serializable)
prefsMap.put(name, (Serializable)value);
}
return prefsMap;
}
开发者ID:qupath,项目名称:qupath,代码行数:17,代码来源:ExportChartPanel.java
示例10: handleAction
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
private void handleAction(ActionEvent ae) {
// retrieving bean properties may take some time
// so we have to put it on separate thread to keep UI responsive
Service<?> service = new Service<ObservableList<Item>>() {
@Override
protected Task<ObservableList<Item>> createTask() {
return new Task<ObservableList<Item>>() {
@Override
protected ObservableList<Item> call() throws Exception {
return bean == null ? null : getProperties(bean);
}
};
}
};
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@SuppressWarnings("unchecked")
@Override
public void handle(WorkerStateEvent e) {
ObservableList<Item> items = (ObservableList<Item>) e.getSource().getValue();
if (items != null) {
try {
propertySheet.getItems().setAll(items.filtered((v) -> v != null));
} catch (Exception exc) {
//exc.printStackTrace();
propertySheet.getItems().clear();
}
} else {
propertySheet.getItems().clear();
}
}
});
service.start();
}
开发者ID:davidB,项目名称:jme3_ext_spatial_explorer,代码行数:39,代码来源:Explorer0.java
示例11: getProperties
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Given a JavaBean, this method will return a list of {@link Item} intances,
* which may be directly placed inside a {@link PropertySheet} (via its
* {@link PropertySheet#getItems() items list}.
*
* @param bean The JavaBean that should be introspected and be editable via
* a {@link PropertySheet}.
* @return A list of {@link Item} instances representing the properties of the
* JavaBean.
*/
public static ObservableList<Item> getProperties(final Object bean) {
ObservableList<Item> list = FXCollections.observableArrayList();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass(), Object.class);
for (PropertyDescriptor p : beanInfo.getPropertyDescriptors()) {
if (isProperty(p) && !p.isHidden()) {
BeanProperty bp = new BeanProperty(bean, p);
bp.setEditable(p.getWriteMethod() != null);
list.add(bp);
}
}
if (bean instanceof Spatial) {
Spatial sp = (Spatial)bean;
for(String key : sp.getUserDataKeys()) {
list.add(new BasicItem("UserData", key, sp.getUserData(key)));
}
for(int i = 0; i < sp.getNumControls(); i++){
Control ctrl = sp.getControl(i);
list.add(new BasicItem("Controls", ctrl.getClass().getSimpleName(), ctrl));
}
for(int i = 0; i < sp.getLocalLightList().size(); i++){
Light light = sp.getLocalLightList().get(i);
list.add(new BasicItem("Light", light.getClass().getSimpleName(), light));
}
}
} catch (IntrospectionException e) {
e.printStackTrace();
}
return list;
}
开发者ID:davidB,项目名称:jme3_ext_spatial_explorer,代码行数:43,代码来源:Explorer0.java
示例12: getProperties
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
private ObservableList<Item> getProperties(T bean) {
ObservableList<Item> properties = BeanPropertyUtils.getProperties(bean);
List<String> fields = Arrays.stream(bean.getClass().getDeclaredFields())
.map(Field::getName)
.collect(Collectors.toList());
properties.sort(Comparator.comparing(p -> fields.indexOf(((BeanProperty) p).getName())));
return properties;
}
开发者ID:sanaehirotaka,项目名称:logbook-kai,代码行数:9,代码来源:PropertyDialog.java
示例13: getPropertySheetItems
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public ObservableList<Item> getPropertySheetItems() {
ObservableList<Item> items = super.getPropertySheetItems();
items.add(new Item() {
@Override
public void setValue(Object value) {
setEndField((boolean) value);
}
@Override
public Object getValue() {
return isEndField();
}
@Override
public Class<?> getType() {
return Boolean.class;
}
@Override
public Optional<ObservableValue<?>> getObservableValue() {
return Optional.of(endFieldProperty());
}
@Override
public String getName() {
return "End Field";
}
@Override
public String getDescription() {
return "Indicates this field is used for te end value";
}
@Override
public String getCategory() {
return TIME_RANGE_FIELD_CATEGORY;
}
});
return items;
}
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:44,代码来源:TimeRangeField.java
示例14: getPropertySheetItems
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public ObservableList<Item> getPropertySheetItems() {
ObservableList<Item> items = super.getPropertySheetItems();
items.add(new Item() {
@Override
public Optional<ObservableValue<?>> getObservableValue() {
return Optional.of(numberOfDaysProperty());
}
@Override
public void setValue(Object value) {
setNumberOfDays((Integer) value);
}
@Override
public Object getValue() {
return getNumberOfDays();
}
@Override
public Class<?> getType() {
return Integer.class;
}
@Override
public String getName() {
return "Number of Days"; //$NON-NLS-1$
}
@Override
public String getDescription() {
return "Number of Days"; //$NON-NLS-1$
}
@Override
public String getCategory() {
return WEEK_DAY_HEADER_VIEW_CATEGORY;
}
});
return items;
}
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:45,代码来源:WeekDayHeaderView.java
示例15: getPropertySheetItems
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public ObservableList<Item> getPropertySheetItems() {
ObservableList<Item> items = super.getPropertySheetItems();
items.add(new Item() {
@Override
public Optional<ObservableValue<?>> getObservableValue() {
return Optional.of(showWeekNumbersProperty());
}
@Override
public void setValue(Object value) {
setShowWeekNumbers((boolean) value);
}
@Override
public Object getValue() {
return isShowWeekNumbers();
}
@Override
public Class<?> getType() {
return Boolean.class;
}
@Override
public String getName() {
return "Show Week Numbers"; //$NON-NLS-1$
}
@Override
public String getDescription() {
return "Show or hide the week numbers"; //$NON-NLS-1$
}
@Override
public String getCategory() {
return MONTH_VIEW_CATEGORY;
}
});
return items;
}
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:44,代码来源:MonthViewBase.java
示例16: getPropertySheetItems
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@Override
public ObservableList<Item> getPropertySheetItems() {
ObservableList<Item> items = super.getPropertySheetItems();
items.add(new Item() {
@Override
public void setValue(Object value) {
setMaximumRowsPerColumn((int) value);
}
@Override
public Object getValue() {
return getMaximumRowsPerColumn();
}
@Override
public Class<?> getType() {
return Integer.class;
}
@Override
public Optional<ObservableValue<?>> getObservableValue() {
return Optional.of(maximumRowsPerColumnProperty());
}
@Override
public String getName() {
return "Maximum Rows Per Column";
}
@Override
public String getDescription() {
return "The maximum number of rows per column";
}
@Override
public String getCategory() {
return SOURCE_GRID_VIEW_CATEGORY;
}
});
return items;
}
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:44,代码来源:SourceGridView.java
示例17: getEditorForItem
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
<ValueType> PropertyEditor<ValueType> getEditorForItem(Item item) {
return (PropertyEditor<ValueType>) editorsMap.get(item);
}
开发者ID:mzmine,项目名称:mzmine3,代码行数:5,代码来源:ParameterEditorFactory.java
示例18: addPropertyPreference
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Add a new preference based on a specified Property.
*
* @param prop
* @param cls
* @param name
* @param category
* @param description
*/
public <T> void addPropertyPreference(final Property<T> prop, final Class<? extends T> cls, final String name, final String category, final String description) {
PropertySheet.Item item = new PropertyItem<>(prop, cls)
.name(name)
.category(category)
.description(description);
propSheet.getItems().add(item);
}
开发者ID:qupath,项目名称:qupath,代码行数:17,代码来源:PreferencePanel.java
示例19: addColorPropertyPreference
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Add a new color preference based on a specified IntegerProperty (storing a packed RGBA value).
*
* @param prop
* @param name
* @param category
* @param description
*/
public void addColorPropertyPreference(final IntegerProperty prop, final String name, final String category, final String description) {
PropertySheet.Item item = new ColorPropertyItem(prop)
.name(name)
.category(category)
.description(description);
propSheet.getItems().add(item);
}
开发者ID:qupath,项目名称:qupath,代码行数:16,代码来源:PreferencePanel.java
示例20: addDirectoryPropertyPreference
import org.controlsfx.control.PropertySheet.Item; //导入依赖的package包/类
/**
* Add a new directory preference based on a specified StrongProperty.
*
* @param prop
* @param name
* @param category
* @param description
*/
public void addDirectoryPropertyPreference(final Property<String> prop, final String name, final String category, final String description) {
PropertySheet.Item item = new DirectoryPropertyItem(prop)
.name(name)
.category(category)
.description(description);
propSheet.getItems().add(item);
}
开发者ID:qupath,项目名称:qupath,代码行数:16,代码来源:PreferencePanel.java
注:本文中的org.controlsfx.control.PropertySheet.Item类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论