當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyContainer.getDescriptor方法代碼示例

本文整理匯總了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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:UIUtils.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:18,代碼來源:BundleForm.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:12,代碼來源:VariableItemDialog.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:15,代碼來源:UIUtils.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:16,代碼來源:UIUtils.java

示例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();
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:11,代碼來源:BundleForm.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:36,代碼來源:PropagateUncertaintyDialog.java

示例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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:75,代碼來源:BandMathsDialog.java


注:本文中的com.bc.ceres.binding.PropertyContainer.getDescriptor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。