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


Java PropertyDescriptor類代碼示例

本文整理匯總了Java中com.bc.ceres.binding.PropertyDescriptor的典型用法代碼示例。如果您正苦於以下問題:Java PropertyDescriptor類的具體用法?Java PropertyDescriptor怎麽用?Java PropertyDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PropertyDescriptor類屬於com.bc.ceres.binding包,在下文中一共展示了PropertyDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPanel

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
JComponent createPanel() {
    this.bandFields = Arrays.stream(operatorDescriptor.getOperatorClass().getDeclaredFields())
            .filter(f -> f.getAnnotation(BandParameter.class) != null)
            .collect(Collectors.toList());
    this.bandFields.stream()
            .map(f -> new AbstractMap.SimpleEntry<>(this.propertySet.getProperty(f.getName()),
                    f.getAnnotation(BandParameter.class)))
            .forEach(entry -> {
                Property property = entry.getKey();
                property.addPropertyChangeListener(evt -> checkResampling(this.currentProduct));
                BandParameter annotation = entry.getValue();
                if (annotation != null) {
                    final PropertyDescriptor propertyDescriptor = property.getDescriptor();
                    propertyDescriptor.setDescription(propertyDescriptor.getDescription()
                            + String.format(" Expected wavelength interval: [%dnm, %dnm]",
                            (int) annotation.minWavelength(), (int) annotation.maxWavelength()));
                }
            });
    this.propertySet.getProperty(PROPERTY_RESAMPLE).addPropertyChangeListener(evt -> checkResampling(getSourceProduct()));

    insertMessageLabel(this.operatorPanel);

    return this.operatorPanel;
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:25,代碼來源:RadiometricIndicesPanel.java

示例2: setSourceProductSelectorLabels

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void setSourceProductSelectorLabels() {
    for (SourceProductDescriptor descriptor : sourceProductSelectorMap.keySet()) {
        final SourceProductSelector selector = sourceProductSelectorMap.get(descriptor);
        String label = descriptor.getLabel();
        String alias = descriptor.getAlias();
        if (label == null && alias != null) {
            label = alias;
        }
        if (label == null) {
            label = PropertyDescriptor.createDisplayName(descriptor.getName());
        }
        if (!label.endsWith(":")) {
            label += ":";
        }
        if (descriptor.isOptional()) {
            label += " (optional)";
        }
        selector.getProductNameLabel().setText(label);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:21,代碼來源:DefaultIOParametersPanel.java

示例3: addChoiceField

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的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

示例4: getEditorComponent

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的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

示例5: addValidatedTextField

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
JComponent addValidatedTextField(JPanel parent, TextFieldEditor textEditor, String labelText, String propertyName, String validatorRegex) {
    if(validatorRegex == null || validatorRegex.isEmpty()){
        return addTextField(parent, textEditor, labelText, propertyName, false, null);
    } else {
        JLabel jLabel = new JLabel(labelText);
        parent.add(jLabel);
        PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
        propertyDescriptor.setValidator(new PatternValidator(Pattern.compile(validatorRegex)));
        JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext);
        UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here");
        editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));
        editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
        jLabel.setLabelFor(editorComponent);
        parent.add(editorComponent);
        return editorComponent;
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:18,代碼來源:AbstractAdapterEditor.java

示例6: addTextField

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
JComponent addTextField(JPanel parent, TextFieldEditor textEditor, String labelText,
                        String propertyName, boolean isRequired, String[] excludedChars) {
    JLabel jLabel = new JLabel(labelText);
    Dimension size = jLabel.getPreferredSize();
    parent.add(jLabel);
    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
    if (isRequired) {
        propertyDescriptor.setValidator(new DecoratedNotEmptyValidator(jLabel, excludedChars));
        jLabel.setMaximumSize(new Dimension(size.width + 20, size.height));
    }
    JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext);
    UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here");
    UIUtils.enableUndoRedo(editorComponent);
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    jLabel.setLabelFor(editorComponent);
    parent.add(editorComponent);
    return editorComponent;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:AbstractAdapterEditor.java

示例7: addComboField

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
JComponent addComboField(JPanel parent, String labelText, String propertyName, boolean isRequired, boolean isEditable) {
    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
    propertyDescriptor.setNotEmpty(isRequired);
    PropertyEditor editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
    JComponent editorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));
    if (editorComponent instanceof JComboBox) {
        JComboBox comboBox = (JComboBox)editorComponent;
        comboBox.setEditable(isEditable);
        comboBox.setEnabled(isEditable);
    }
    JLabel jLabel = new JLabel(labelText);
    parent.add(jLabel);
    jLabel.setLabelFor(editorComponent);
    parent.add(editorComponent);
    return editorComponent;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:19,代碼來源:AbstractAdapterEditor.java

示例8: addEditablePropertyDescriptors

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
@Override
protected void addEditablePropertyDescriptors() {
    super.addEditablePropertyDescriptors();

    final PropertyDescriptor connectionLineWidth = new PropertyDescriptor("line-width", Double.class);
    connectionLineWidth.setDefaultValue(1.0);
    connectionLineWidth.setDefaultConverter();  // why this???
    addPropertyDescriptor(connectionLineWidth);

    final PropertyDescriptor connectionLineOpacity = new PropertyDescriptor("line-opacity", Double.class);
    connectionLineOpacity.setDefaultValue(0.7);
    connectionLineOpacity.setDefaultConverter();   // why this???
    addPropertyDescriptor(connectionLineOpacity);

    final PropertyDescriptor connectionLineColor = new PropertyDescriptor("line-color", Color.class);
    connectionLineOpacity.setDefaultValue(Color.ORANGE);
    connectionLineOpacity.setDefaultConverter();    // why this???
    addPropertyDescriptor(connectionLineColor);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:TrackLayerEditor.java

示例9: updateDatabaseCombo

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void updateDatabaseCombo(PropertySet propertySet) {
    String localFolder = propertySet.getValue(PREFERENCE_DB_LOCAL_PATH);
    String remoteAddress = propertySet.getValue(PREFERENCE_DB_REMOTE_URI);
    String remoteOrLocal = propertySet.getValue(PREFERENCE_DB_REMOTE_OR_LOCAL);
    String uri = DB_IS_REMOTE.equals(remoteOrLocal) ? remoteAddress: localFolder;

    try {
        URI databaseManagerURI = getDatabaseManagerURI(uri);
        if (databaseManager == null || !databaseManager.getURI().equals(databaseManagerURI)) {
            databaseManager = createDatabaseManager(databaseManagerURI);
        }
        PropertyDescriptor dbNameProperty = propertySet.getProperty(PREFERENCE_DB_NAME).getDescriptor();
        if (databaseManager.isAlive()) {
            String[] databases = databaseManager.listDatabases();
            Arrays.sort(databases);
            dbNameProperty.setValueSet(new ValueSet(databases));
        } else {
            dbNameProperty.setValueSet(new ValueSet(new String[0]));
            SnapApp.getDefault().handleError("Failed to connect to Database.", null);
        }
    } catch (URISyntaxException|IOException|IllegalArgumentException e) {
        SnapApp.getDefault().handleError("Error reading applications:" + e.getMessage(), e);
    }
}
 
開發者ID:bcdev,項目名稱:esa-pfa,代碼行數:25,代碼來源:DatabaseOptionsPanelController.java

示例10: updateValueSet

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void updateValueSet(Property property, Product product) {
    String[] values = new String[0];
    PropertyDescriptor propertyDescriptor = property.getDescriptor();
    if (product != null) {
        Object object = propertyDescriptor.getAttribute(RasterDataNodeValues.ATTRIBUTE_NAME);
        if (object != null) {
            @SuppressWarnings("unchecked")
            Class<? extends RasterDataNode> rasterDataNodeType = (Class<? extends RasterDataNode>) object;
            boolean includeEmptyValue = !propertyDescriptor.isNotNull() && !propertyDescriptor.isNotEmpty() &&
                    !propertyDescriptor.getType().isArray();
            values = RasterDataNodeValues.getNames(product, rasterDataNodeType, includeEmptyValue);
        }
    }
    propertyDescriptor.setValueSet(new ValueSet(values));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:16,代碼來源:RadiometricIndicesPanel.java

示例11: createWindowSizeEditor

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private JSpinner createWindowSizeEditor(BindingContext bindingContext) {
    final PropertyDescriptor windowSizeDescriptor = bindingContext.getPropertySet().getProperty("windowSize").getDescriptor();
    windowSizeDescriptor.setValueRange(new ValueRange(1, Double.POSITIVE_INFINITY));
    windowSizeDescriptor.setAttribute("stepSize", 2);
    windowSizeDescriptor.setValidator((property, value) -> {
        if (((Number) value).intValue() % 2 == 0) {
            throw new ValidationException("Only odd values allowed as window size.");
        }
    });

    final JSpinner spinner = new JSpinner();
    bindingContext.bind("windowSize", spinner);
    return spinner;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:15,代碼來源:PixelExtractionParametersForm.java

示例12: updateSourceBands

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void updateSourceBands() {
    if (propertySet == null) return;

    final Property[] properties = propertySet.getProperties();
    for (Property p : properties) {
        final PropertyDescriptor descriptor = p.getDescriptor();
        final String alias = descriptor.getAlias();

        if (sourceProducts != null && alias != null && alias.equals("sourceBands")) {
            final String[] bandNames = getBandNames();
            if (bandNames.length > 0) {
                final ValueSet valueSet = new ValueSet(bandNames);
                descriptor.setValueSet(valueSet);

                try {
                    if (descriptor.getType().isArray()) {
                        if (p.getValue() == null)
                            p.setValue(bandNames);//new String[] {bandNames[0]});
                    } else {
                        p.setValue(bandNames[0]);
                    }
                } catch (ValidationException e) {
                    System.out.println(e.toString());
                }
            }
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:29,代碼來源:DefaultUI.java

示例13: getItemConverter

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private static Converter getItemConverter(final PropertyDescriptor descriptor) {
    final Class<?> itemType = descriptor.getType().getComponentType();
    Converter itemConverter = descriptor.getConverter();
    if (itemConverter == null) {
        itemConverter = ConverterRegistry.getInstance().getConverter(itemType);
    }
    return itemConverter;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:9,代碼來源:BaseOperatorUI.java

示例14: addParameters

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void addParameters() {
    final PropertySet propertySet = parameterSupport.getPropertySet();
    final List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList();

    if (sourceProductSelectorList.isEmpty()) {
        Dialogs.showError("SourceProduct @Parameter not found in operator");
    } else {

        sourceProductSelectorList.get(0).addSelectionChangeListener(new AbstractSelectionChangeListener() {

            @Override
            public void selectionChanged(SelectionChangeEvent event) {
                final Product selectedProduct = (Product) event.getSelection().getSelectedValue();
                if (selectedProduct != null) { //&& form != null) {
                    final TargetProductSelectorModel targetProductSelectorModel = getTargetProductSelector().getModel();
                    targetProductSelectorModel.setProductName(selectedProduct.getName() + getTargetProductNameSuffix());
                    opUI.setSourceProducts(new Product[]{selectedProduct});
                }
            }
        });
    }

    if (propertySet.getProperties().length > 0) {
        if (!sourceProductSelectorList.isEmpty()) {
            Property[] properties = propertySet.getProperties();
            List<PropertyDescriptor> rdnTypeProperties = new ArrayList<>(properties.length);
            for (Property property : properties) {
                PropertyDescriptor parameterDescriptor = property.getDescriptor();
                if (parameterDescriptor.getAttribute(RasterDataNodeValues.ATTRIBUTE_NAME) != null) {
                    rdnTypeProperties.add(parameterDescriptor);
                }
            }
            rasterDataNodeTypeProperties = rdnTypeProperties.toArray(
                    new PropertyDescriptor[rdnTypeProperties.size()]);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:38,代碼來源:SingleOperatorDialog.java

示例15: updateValueSets

import com.bc.ceres.binding.PropertyDescriptor; //導入依賴的package包/類
private void updateValueSets(Product product) {
    if (rasterDataNodeTypeProperties != null) {
        for (PropertyDescriptor propertyDescriptor : rasterDataNodeTypeProperties) {
            updateValueSet(propertyDescriptor, product);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:8,代碼來源:SingleOperatorDialog.java


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