当前位置: 首页>>代码示例>>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;未经允许,请勿转载。