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


Java Property類代碼示例

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


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

示例1: createPanel

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

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private void updateBandList(final Product product, final Property bandProperty, boolean considerReferenceSize) {
    if (product == null) {
        return;
    }

    final ValueSet bandValueSet = new ValueSet(createAvailableBandList(product, considerReferenceSize));
    bandProperty.getDescriptor().setValueSet(bandValueSet);
    if (bandValueSet.getItems().length > 0) {
        RasterDataNode currentRaster = getRaster();
        if (bandValueSet.contains(getRaster())) {
            currentRaster = getRaster();
        }
        try {
            bandProperty.setValue(currentRaster);
        } catch (ValidationException ignored) {
            Debug.trace(ignored);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:DensityPlotPanel.java

示例3: isResampleNeeded

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private boolean isResampleNeeded(Product product) {
    boolean needsResampling = false;
    if (product != null) {
        int sceneWidth = 0;
        PropertySet propertySet = this.bindingContext.getPropertySet();

        Set<String> setBandNames = this.bandFields.stream()
                .map(f -> propertySet.getProperty(f.getName()))
                .filter(p -> !StringUtils.isNullOrEmpty(p.getValueAsText()))
                .map(Property::getValueAsText)
                .collect(Collectors.toSet());
        if (setBandNames.size() > 0) {
            BitSet bitSet = new BitSet(setBandNames.size());
            int idx = 0;
            for (String bandName : setBandNames) {
                Band band = product.getBand(bandName);
                bitSet.set(idx++, sceneWidth != 0 && sceneWidth != band.getRasterWidth());
                sceneWidth = band.getRasterWidth();
            }
            needsResampling = bitSet.nextSetBit(0) != -1;
        }
    }

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

示例4: getDefaultOutputPath

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private String getDefaultOutputPath(AppContext appContext) {
    final Property dirProperty = container.getProperty("outputDir");
    String userHomePath = SystemUtils.getUserHomeDir().getAbsolutePath();
    String lastDir = appContext.getPreferences().getPropertyString(PROPERTY_NAME_LAST_OPEN_OUTPUT_DIR, userHomePath);
    String path;
    try {
        path = new File(lastDir).getCanonicalPath();
    } catch (IOException ignored) {
        path = userHomePath;
    }
    try {
        dirProperty.setValue(new File(path));
    } catch (ValidationException ignore) {
    }
    return path;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:17,代碼來源:PixelExtractionIOForm.java

示例5: createOutputDirChooserButton

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private AbstractButton createOutputDirChooserButton(final Property outputFileProperty) {
    AbstractButton button = new JButton("...");
    button.addActionListener(e -> {
        FolderChooser folderChooser = new FolderChooser();
        folderChooser.setCurrentDirectory(new File(getDefaultOutputPath(appContext)));
        folderChooser.setDialogTitle("Select output directory");
        folderChooser.setMultiSelectionEnabled(false);
        int result = folderChooser.showDialog(appContext.getApplicationWindow(), "Select");    /*I18N*/
        if (result != JFileChooser.APPROVE_OPTION) {
            return;
        }
        File selectedFile = folderChooser.getSelectedFile();
        setOutputDirPath(selectedFile.getAbsolutePath());
        try {
            outputFileProperty.setValue(selectedFile);
            appContext.getPreferences().setPropertyString(PROPERTY_NAME_LAST_OPEN_OUTPUT_DIR,
                                                          selectedFile.getAbsolutePath());

        } catch (ValidationException ve) {
            // not expected to ever come here
            appContext.handleError("Invalid input path", ve);
        }
    });
    return button;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:26,代碼來源:PixelExtractionIOForm.java

示例6: setProperty

import com.bc.ceres.binding.Property; //導入依賴的package包/類
public void setProperty(Property property) {
    this.sourceProductPaths = property;
    if (sourceProductPaths != null && sourceProductPaths.getContainer() != null) {
        sourceProductPaths.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (!internalPropertyChange) {
                    Object newValue = evt.getNewValue();
                    try {
                        if (newValue == null) {
                            final Object[] sourceProducts = getSourceProducts();
                            clear();
                            addElements(sourceProducts);
                        } else {
                            setPaths((String[]) newValue);
                        }
                    } catch (ValidationException e) {
                        SystemUtils.LOG.log(Level.SEVERE, "Problems at setPaths.", e);
                    }
                }
            }
        });
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:25,代碼來源:InputListModel.java

示例7: init

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private void init(Product sourceProduct, CoordinateReferenceSystem targetCrs, boolean fitProductSize, int referencePixelLocation,
                  PropertySet sourcePropertySet) {
    this.sourceProduct = sourceProduct;
    this.targetCrs = targetCrs;
    this.fitProductSize = fitProductSize;
    this.referencePixelLocation = referencePixelLocation;

    this.propertyContainer = PropertyContainer.createValueBacked(ImageGeometry.class);
    configurePropertyContainer(propertyContainer);

    Property[] properties = sourcePropertySet.getProperties();
    for (Property property : properties) {
        if (propertyContainer.isPropertyDefined(property.getName())) {
            propertyContainer.setValue(property.getName(), property.getValue());
        }
    }

}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:19,代碼來源:OutputGeometryFormModel.java

示例8: AggregatorItemDialog

import com.bc.ceres.binding.Property; //導入依賴的package包/類
public AggregatorItemDialog(Window parent, String[] sourceVarNames, AggregatorItem aggregatorItem, boolean initWithDefaults) {
    super(parent, "Edit Aggregator", ID_OK | ID_CANCEL, null);
    this.sourceVarNames = sourceVarNames;
    this.aggregatorItem = aggregatorItem;
    aggregatorConfig = aggregatorItem.aggregatorConfig;
    aggregatorDescriptor = aggregatorItem.aggregatorDescriptor;
    aggregatorPropertySet = createPropertySet(aggregatorConfig);
    if (initWithDefaults) {
        aggregatorPropertySet.setDefaultValues();
    } else {
        PropertySet objectPropertySet = PropertyContainer.createObjectBacked(aggregatorConfig);
        Property[] objectProperties = objectPropertySet.getProperties();
        for (Property objectProperty : objectProperties) {
            aggregatorPropertySet.setValue(objectProperty.getName(), objectProperty.getValue());
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:18,代碼來源:AggregatorItemDialog.java

示例9: testUpdatePointDataSource

import com.bc.ceres.binding.Property; //導入依賴的package包/類
@Test
public void testUpdatePointDataSource() throws Exception {
    final BindingContext bindingContext = new BindingContext();
    bindingContext.getPropertySet().addProperties(Property.create("pointDataSource", VectorDataNode.class));
    bindingContext.getPropertySet().addProperties(Property.create("dataField", AttributeDescriptor.class));

    final CorrelativeFieldSelector correlativeFieldSelector = new CorrelativeFieldSelector(bindingContext);
    final Product product = new Product("name", "type", 10, 10);
    product.getVectorDataGroup().add(new VectorDataNode("a", createFeatureType(Geometry.class)));
    product.getVectorDataGroup().add(new VectorDataNode("b", createFeatureType(Point.class)));

    assertEquals(0, correlativeFieldSelector.pointDataSourceList.getItemCount());
    assertEquals(0, correlativeFieldSelector.dataFieldList.getItemCount());

    correlativeFieldSelector.updatePointDataSource(product);

    assertEquals(3, correlativeFieldSelector.pointDataSourceList.getItemCount());
    assertEquals(0, correlativeFieldSelector.dataFieldList.getItemCount());

    correlativeFieldSelector.pointDataSourceProperty.setValue(product.getVectorDataGroup().get("b"));

    assertEquals(3, correlativeFieldSelector.dataFieldList.getItemCount());
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:24,代碼來源:CorrelativeFieldSelectorTest.java

示例10: valueChanged

import com.bc.ceres.binding.Property; //導入依賴的package包/類
@Override
public void valueChanged(ListSelectionEvent event) {
    if (event.getValueIsAdjusting()) {
        return;
    }
    if (getBinding().isAdjustingComponents()) {
        return;
    }
    final Property property = getBinding().getContext().getPropertySet().getProperty(getBinding().getPropertyName());
    Object selectedValue = list.getSelectedValue();
    try {
        property.setValue(selectedValue);
        // Now model is in sync with UI
        getBinding().clearProblem();
    } catch (ValidationException e) {
        getBinding().reportProblem(e);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:19,代碼來源:AddElevationAction.java

示例11: validateValue

import com.bc.ceres.binding.Property; //導入依賴的package包/類
@Override
public void validateValue(Property property, Object value) throws ValidationException {
    final String bandName = value.toString().trim();
    if (!ProductNode.isValidNodeName(bandName)) {
        throw new ValidationException(MessageFormat.format("The band name ''{0}'' appears not to be valid.\n" +
                        "Please choose another one.",
                bandName
        ));
    } else if (product.containsBand(bandName)) {
        throw new ValidationException(MessageFormat.format("The selected product already contains a band named ''{0}''.\n" +
                        "Please choose another one.",
                bandName
        ));
    }

}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:17,代碼來源:AddElevationAction.java

示例12: createPanel

import com.bc.ceres.binding.Property; //導入依賴的package包/類
@Override
protected JPanel createPanel(BindingContext context) {
    TableLayout tableLayout = new TableLayout(1);
    tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayout.setTablePadding(new Insets(4, 10, 0, 0));
    tableLayout.setTableFill(TableLayout.Fill.BOTH);
    tableLayout.setColumnWeightX(0, 1.0);

    JPanel pageUI = new JPanel(tableLayout);
    PropertyEditorRegistry registry = PropertyEditorRegistry.getInstance();
    Property beepSound = context.getPropertySet().getProperty(GPF.BEEP_AFTER_PROCESSING_PROPERTY);
    JComponent[] beepSoundComponent = registry.findPropertyEditor(beepSound.getDescriptor()).createComponents(beepSound.getDescriptor(), context);

    pageUI.add(beepSoundComponent[0]);
    tableLayout.setTableFill(TableLayout.Fill.VERTICAL);
    pageUI.add(tableLayout.createVerticalSpacer());
    JPanel parent = new JPanel(new BorderLayout());
    parent.add(pageUI, BorderLayout.CENTER);
    parent.add(Box.createHorizontalStrut(100), BorderLayout.EAST);
    return parent;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:22,代碼來源:GPFController.java

示例13: updateRoiMasks

import com.bc.ceres.binding.Property; //導入依賴的package包/類
private void updateRoiMasks() {
    final Property property = bindingContext.getPropertySet().getProperty(PROPERTY_NAME_ROI_MASK);
    if (product != null && raster != null) {
        //todo [multisize_products] compare scenerastertransform (or its successor) rather than size
        final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup();
        List<ProductNode> maskList = new ArrayList<>();
        final Dimension refRrasterSize = raster.getRasterSize();
        for (int i = 0; i < maskGroup.getNodeCount(); i++) {
            final Mask mask = maskGroup.get(i);
            if (refRrasterSize.equals(mask.getRasterSize())) {
                maskList.add(mask);
            }
        }
        property.getDescriptor().setValueSet(new ValueSet(maskList.toArray(new ProductNode[maskList.size()])));
    } else {
        property.getDescriptor().setValueSet(new ValueSet(new Mask[0]));
    }
    useRoiEnablement.apply();
    roiMaskEnablement.apply();
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:21,代碼來源:RoiMaskSelector.java

示例14: addPromptSupport

import com.bc.ceres.binding.Property; //導入依賴的package包/類
public static void addPromptSupport(JComponent component, Property property, String promptText) {
    if (JTextComponent.class.isAssignableFrom(component.getClass())) {
        JTextComponent castedComponent = (JTextComponent) component;
        String text;
        if (File.class.isAssignableFrom(property.getType())) {
            text = promptText != null ? promptText :
                    String.format(FILE_FIELD_PROMPT, separateWords(property.getName()));
        } else {
            if (promptText == null) {
                text = property.getDescriptor().getDescription();
                if (StringUtils.isNullOrEmpty(text)) {
                    text = String.format(TEXT_FIELD_PROMPT, separateWords(property.getName()));
                }
            } else {
                text = promptText;
            }
        }
        PromptSupport.setPrompt(text, castedComponent);
        PromptSupport.setFocusBehavior(PromptSupport.FocusBehavior.HIDE_PROMPT, castedComponent);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:22,代碼來源:UIUtils.java

示例15: validateValue

import com.bc.ceres.binding.Property; //導入依賴的package包/類
@Override
public void validateValue(Property property, Object value) throws ValidationException {
    try {
        if (value != null) {
            String stringValue = value.toString();
            if (this.excludedChars != null) {
                for (String exclChar : this.excludedChars) {
                    if (stringValue.contains(exclChar)) {
                        throw new ValidationException(String.format("Character '%s' not allowed", exclChar));
                    }
                }
            }
        }
        this.validator.validateValue(property, value);
        this.label.setIcon(null);
        this.label.setToolTipText(null);
    } catch (ValidationException vex) {
        this.label.setIcon(TangoIcons.status_dialog_error(TangoIcons.Res.R16));
        throw vex;
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:22,代碼來源:DecoratedNotEmptyValidator.java


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