本文整理汇总了Java中com.bc.ceres.binding.PropertyContainer.getDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyContainer.getDescriptor方法的具体用法?Java PropertyContainer.getDescriptor怎么用?Java PropertyContainer.getDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bc.ceres.binding.PropertyContainer
的用法示例。
在下文中一共展示了PropertyContainer.getDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addChoiceField
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
public static List<JRadioButton> addChoiceField(JPanel parent, String label, Map<String, String> valuesAndLabels,
PropertyContainer propertyContainer, String propertyName, Class enumClass) {
parent.add(new JLabel(label));
PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
ButtonGroup rbGroup = new ButtonGroup();
java.util.List<JRadioButton> components = new ArrayList<>(valuesAndLabels.size());
for (Map.Entry<String, String> choice : valuesAndLabels.entrySet()) {
JRadioButton button = new JRadioButton(choice.getValue());
button.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
propertyDescriptor.setDefaultValue(Enum.valueOf(enumClass, choice.getKey()));
}
});
rbGroup.add(button);
parent.add(button);
components.add(button);
}
return components;
}
示例2: getEditorComponent
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
private JComponent getEditorComponent(OSFamily osFamily, String propertyName,String controlName, boolean isFolder) {
if (osFamily == OSFamily.all) {
osFamily = OSFamily.windows;
}
PropertyContainer propertyContainer = propertyContainers.get(osFamily);
BindingContext bindingContext = bindingContexts.get(osFamily);
PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
if (isFolder) {
propertyDescriptor.setAttribute("directory", true);
}
PropertyEditor propertyEditor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
JComponent editorComponent = propertyEditor.createEditorComponent(propertyDescriptor, bindingContext);
if (controlName != null) {
editorComponent.setName(controlName);
}
return editorComponent;
}
示例3: createBindingContext
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
private BindingContext createBindingContext() {
final PropertyContainer container = PropertyContainer.createObjectBacked(variableItem.variableConfig, new ParameterDescriptorFactory());
final BindingContext context = new BindingContext(container);
PropertyDescriptor descriptor = container.getDescriptor(PROPERTY_VARIABLE_NAME);
descriptor.setDescription("The name for the source band.");
descriptor.setValidator(new VariableNameValidator());
container.setDefaultValues();
return context;
}
示例4: addTextField
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
public static JTextField addTextField(JPanel parent, TextFieldEditor textEditor, String labelText,
PropertyContainer propertyContainer, BindingContext bindingContext,
String propertyName, boolean isRequired) {
parent.add(new JLabel(labelText));
PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
if (isRequired) {
propertyDescriptor.setValidator(new NotEmptyValidator());
}
JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext);
UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here");
UIUtils.enableUndoRedo(editorComponent);
parent.add(editorComponent);
return (JTextField) editorComponent;
}
示例5: addComboField
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
public static JComboBox addComboField(JPanel parent, String labelText, PropertyContainer propertyContainer, BindingContext bindingContext,
String propertyName, GridBagConstraints constraints) {
PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
PropertyEditor editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
JComponent editorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
if (editorComponent instanceof JComboBox) {
JComboBox comboBox = (JComboBox)editorComponent;
comboBox.setEditable(false);
comboBox.setEnabled(true);
parent.add(new JLabel(labelText));
parent.add(editorComponent);
return comboBox;
}
return null;
}
示例6: setVariables
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
public void setVariables(List<SystemVariable> variables) {
this.variables = variables;
PropertyContainer propertyContainer = propertyContainers.get(OSFamily.windows);
BindingContext bindingContext = bindingContexts.get(OSFamily.windows);
PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor("updateVariable");
propertyDescriptor.setValueSet(new ValueSet(this.variables.stream().map(SystemVariable::getKey).toArray()));
PropertyEditor propertyEditor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
variablesCombo = propertyEditor.createEditorComponent(propertyDescriptor, bindingContext);
repaint();
}
示例7: createBindingContext
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
private BindingContext createBindingContext() {
final PropertyContainer container = PropertyContainer.createObjectBacked(this);
final BindingContext context = new BindingContext(container);
PropertyDescriptor descriptor;
descriptor = container.getDescriptor(PROPERTY_NAME_BAND_NAME);
descriptor.setDisplayName("Uncertainty band name");
descriptor.setDescription("The name for the new uncertainty band.");
descriptor.setNotEmpty(true);
descriptor.setValidator(new ProductNodeNameValidator(sourceBand.getProduct()));
descriptor.setDefaultValue(getDefaultBandName(sourceBand.getName() + "_unc"));
descriptor = container.getDescriptor(PROPERTY_NAME_ORDER);
descriptor.setDisplayName("Order of Taylor polynomial");
descriptor.setDescription("The number of Taylor series expansion terms used for the Standard Combined Uncertainty (GUM 1995).");
descriptor.setDefaultValue(1);
descriptor.setValueSet(new ValueSet(new Integer[]{1, 2, 3}));
descriptor = container.getDescriptor(PROPERTY_NAME_RELATION);
descriptor.setDisplayName("Relation name of ancillary bands");
descriptor.setDescription("Relation name of ancillary variables that represent uncertainties (NetCDF-U 'rel' attribute).");
descriptor.setDefaultValue("uncertainty");
descriptor.setNotNull(true);
descriptor.setNotEmpty(true);
container.setDefaultValues();
PropertyChangeListener targetExprUpdater = evt -> {
updateTargetExprArea();
};
context.addPropertyChangeListener(PROPERTY_NAME_ORDER, targetExprUpdater);
context.addPropertyChangeListener(PROPERTY_NAME_RELATION, targetExprUpdater);
return context;
}
示例8: createBindingContext
import com.bc.ceres.binding.PropertyContainer; //导入方法依赖的package包/类
private BindingContext createBindingContext() {
final PropertyContainer container = PropertyContainer.createObjectBacked(this);
final BindingContext context = new BindingContext(container);
container.addPropertyChangeListener(PROPERTY_NAME_PRODUCT, evt -> targetProduct = productsList.getByDisplayName(productName));
productName = targetProduct.getDisplayName();
PropertyDescriptor descriptor = container.getDescriptor(PROPERTY_NAME_PRODUCT);
descriptor.setValueSet(new ValueSet(productsList.getDisplayNames()));
descriptor.setDisplayName("Target product");
descriptor = container.getDescriptor(PROPERTY_NAME_BAND_NAME);
descriptor.setDisplayName("Name");
descriptor.setDescription("The name for the new band.");
descriptor.setNotEmpty(true);
descriptor.setValidator(new ProductNodeNameValidator(targetProduct));
String newBandName;
do {
numNewBands++;
newBandName = "new_band_" + numNewBands;
} while (targetProduct.containsRasterDataNode(newBandName));
descriptor.setDefaultValue("new_band_" + (numNewBands));
descriptor = container.getDescriptor(PROPERTY_NAME_BAND_DESC);
descriptor.setDisplayName("Description");
descriptor.setDescription("The description for the new band.");
descriptor = container.getDescriptor(PROPERTY_NAME_BAND_UNIT);
descriptor.setDisplayName("Unit");
descriptor.setDescription("The physical unit for the new band.");
descriptor = container.getDescriptor(PROPERTY_NAME_BAND_WAVELENGTH);
descriptor.setDisplayName("Spectral wavelength");
descriptor.setDescription("The physical unit for the new band.");
descriptor = container.getDescriptor(PROPERTY_NAME_EXPRESSION);
descriptor.setDisplayName("Band maths expression");
descriptor.setDescription("Band maths expression");
descriptor.setNotEmpty(true);
descriptor = container.getDescriptor(PROPERTY_NAME_SAVE_EXPRESSION_ONLY);
descriptor.setDisplayName("Virtual (save expression only, don't store data)");
descriptor.setDefaultValue(Boolean.TRUE);
descriptor = container.getDescriptor(PROPERTY_NAME_NO_DATA_VALUE_USED);
descriptor.setDisplayName("Replace NaN and infinity results by");
descriptor.setDefaultValue(Boolean.TRUE);
descriptor = container.getDescriptor(PROPERTY_NAME_NO_DATA_VALUE);
descriptor.setDefaultValue(Double.NaN);
descriptor = container.getDescriptor(PROPERTY_NAME_GENERATE_UNCERTAINTY_BAND);
descriptor.setDisplayName("Generate associated uncertainty band");
descriptor.setDefaultValue(Boolean.FALSE);
container.setDefaultValues();
context.addPropertyChangeListener(PROPERTY_NAME_SAVE_EXPRESSION_ONLY, evt -> {
final boolean saveExpressionOnly1 = (Boolean) context.getBinding(
PROPERTY_NAME_SAVE_EXPRESSION_ONLY).getPropertyValue();
if (!saveExpressionOnly1) {
context.getBinding(PROPERTY_NAME_NO_DATA_VALUE_USED).setPropertyValue(true);
}
});
context.bindEnabledState(PROPERTY_NAME_NO_DATA_VALUE_USED, false,
PROPERTY_NAME_SAVE_EXPRESSION_ONLY, Boolean.FALSE);
context.bindEnabledState(PROPERTY_NAME_NO_DATA_VALUE, true,
PROPERTY_NAME_NO_DATA_VALUE_USED, Boolean.TRUE);
context.bindEnabledState(PROPERTY_NAME_GENERATE_UNCERTAINTY_BAND, true,
PROPERTY_NAME_SAVE_EXPRESSION_ONLY, Boolean.TRUE);
return context;
}