本文整理汇总了Java中com.bc.ceres.binding.PropertyContainer类的典型用法代码示例。如果您正苦于以下问题:Java PropertyContainer类的具体用法?Java PropertyContainer怎么用?Java PropertyContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyContainer类属于com.bc.ceres.binding包,在下文中一共展示了PropertyContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.bc.ceres.binding.PropertyContainer; //导入依赖的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());
}
}
}
示例2: getWorldMapImage
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
/**
* Reads the world map image from disk if not yet loaded, otherwise
* it is just returning the image.
* <p>
* If the world map image cannot be read an image with an error message is returned.
*
* @param highRes specifies if the high-resolution image shall be returned,
*
* @return the world map image
*/
public static BufferedImage getWorldMapImage(boolean highRes) {
if (worldMapImage == null || isHighRes() != highRes) {
setHighRes(highRes);
LayerType layerType = LayerTypeRegistry.getLayerType("org.esa.snap.worldmap.BlueMarbleLayerType");
if (layerType == null) {
worldMapImage = createErrorImage();
} else {
final CollectionLayer rootLayer = new CollectionLayer();
Layer worldMapLayer = layerType.createLayer(new WorldMapLayerContext(rootLayer), new PropertyContainer());
Dimension dimension = highRes ? HI_RES_DIMENSION : LOW_RES_DIMENSION;
final BufferedImageRendering biRendering = new BufferedImageRendering(dimension.width,
dimension.height);
biRendering.getViewport().setModelYAxisDown(false);
biRendering.getViewport().zoom(worldMapLayer.getModelBounds());
worldMapLayer.render(biRendering);
worldMapImage = biRendering.getImage();
}
}
return worldMapImage;
}
示例3: testValidValuesAreNotChanged
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
@Test
public void testValidValuesAreNotChanged() {
//preparation
propertiesObject.northBound = 15.0;
propertiesObject.eastBound = 15.0;
propertiesObject.southBound = -15.0;
propertiesObject.westBound = -15.0;
final PropertyContainer objectBacked = PropertyContainer.createObjectBacked(propertiesObject);
//execution
RegionSelectableWorldMapPane.ensureValidBindingContext(new BindingContext(objectBacked));
//verification
assertEquals(Double.valueOf(15.0), propertiesObject.northBound);
assertEquals(Double.valueOf(15.0), propertiesObject.eastBound);
assertEquals(Double.valueOf(-15.0), propertiesObject.southBound);
assertEquals(Double.valueOf(-15.0), propertiesObject.westBound);
}
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:19,代码来源:RegionSelectableWorldMapPane_BindingContextValidationTest.java
示例4: AggregatorItemDialog
import com.bc.ceres.binding.PropertyContainer; //导入依赖的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());
}
}
}
示例5: ReprojectionForm
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
ReprojectionForm(TargetProductSelector targetProductSelector, boolean orthorectify, AppContext appContext) {
this.targetProductSelector = targetProductSelector;
this.orthoMode = orthorectify;
this.appContext = appContext;
this.sourceProductSelector = new SourceProductSelector(appContext, "Source Product:");
if (orthoMode) {
targetProductSuffix = "orthorectified";
this.sourceProductSelector.setProductFilter(new OrthorectifyProductFilter());
} else {
targetProductSuffix = "reprojected";
this.sourceProductSelector.setProductFilter(new GeoCodingProductFilter());
}
this.reprojectionModel = new Model();
this.reprojectionContainer = PropertyContainer.createObjectBacked(reprojectionModel);
createUI();
}
示例6: 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;
}
示例7: 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;
}
示例8: actionPerformed
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
ProductNode productNode = SnapApp.getDefault().getSelectedProductNode(SnapApp.SelectionSourceHint.VIEW);
if (productNode == null) {
return;
}
Product product = productNode.getProduct();
if (product != null) {
DialogData dialogData = new DialogData(product.getVectorDataGroup());
PropertySet propertySet = PropertyContainer.createObjectBacked(dialogData);
propertySet.getDescriptor("name").setNotNull(true);
propertySet.getDescriptor("name").setNotEmpty(true);
propertySet.getDescriptor("name").setValidator(new NameValidator(product));
propertySet.getDescriptor("description").setNotNull(true);
final PropertyPane propertyPane = new PropertyPane(propertySet);
JPanel panel = propertyPane.createPanel();
panel.setPreferredSize(new Dimension(400, 100));
ModalDialog dialog = new MyModalDialog(propertyPane);
dialog.setContent(panel);
int i = dialog.show();
if (i == ModalDialog.ID_OK) {
createDefaultVectorDataNode(product, dialogData.name, dialogData.description);
}
}
}
示例9: createLayerConfig
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
@Override
public PropertySet createLayerConfig(LayerContext ctx) {
final PropertyContainer configuration = new PropertyContainer();
// Mandatory Parameters
configuration.addProperty(Property.create(PROPERTY_NAME_FEATURE_COLLECTION, FeatureCollection.class));
configuration.getDescriptor(PROPERTY_NAME_FEATURE_COLLECTION).setTransient(true);
configuration.addProperty(Property.create(PROPERTY_NAME_SLD_STYLE, Style.class));
configuration.getDescriptor(PROPERTY_NAME_SLD_STYLE).setDomConverter(new StyleDomConverter());
configuration.getDescriptor(PROPERTY_NAME_SLD_STYLE).setNotNull(true);
// Optional Parameters
configuration.addProperty(Property.create(PROPERTY_NAME_FEATURE_COLLECTION_CLIP_GEOMETRY, Geometry.class));
configuration.getDescriptor(PROPERTY_NAME_FEATURE_COLLECTION_CLIP_GEOMETRY).setDomConverter(
new GeometryDomConverter());
configuration.addProperty(Property.create(PROPERTY_NAME_FEATURE_COLLECTION_URL, URL.class));
configuration.addProperty(Property.create(PROPERTY_NAME_FEATURE_COLLECTION_CRS, CoordinateReferenceSystem.class));
configuration.getDescriptor(PROPERTY_NAME_FEATURE_COLLECTION_CRS).setDomConverter(new CRSDomConverter());
return configuration;
}
示例10: testLayerConfigurationPersistency
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
@Test
public void testLayerConfigurationPersistency() throws Exception {
final Layer layer = createLayer(layerType);
final SessionDomConverter domConverter = new SessionDomConverter(getProductManager());
final DomElement originalDomElement = new DefaultDomElement("configuration");
domConverter.convertValueToDom(layer.getConfiguration(), originalDomElement);
//System.out.println(originalDomElement.toXml());
PropertySet template = layer.getLayerType().createLayerConfig(null);
final PropertyContainer restoredConfiguration = (PropertyContainer) domConverter.convertDomToValue(originalDomElement, template);
compareConfigurations(layer.getConfiguration(), restoredConfiguration);
final DomElement restoredDomElement = new DefaultDomElement("configuration");
domConverter.convertValueToDom(restoredConfiguration, restoredDomElement);
// assertEquals(originalDomElement.toXml(), restoredDomElement.toXml());
}
示例11: testPersistency
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
@Test
public void testPersistency() throws ValidationException, ConversionException, MalformedURLException {
final WmsLayerType wmsLayerType = LayerTypeRegistry.getLayerType(WmsLayerType.class);
final PropertySet configuration = wmsLayerType.createLayerConfig(null);
configuration.setValue(WmsLayerType.PROPERTY_NAME_STYLE_NAME, "FancyStyle");
configuration.setValue(WmsLayerType.PROPERTY_NAME_URL, new URL("http://www.mapserver.org"));
configuration.setValue(WmsLayerType.PROPERTY_NAME_CRS_ENVELOPE, new CRSEnvelope("EPSG:4324", -10, 20, 15, 50));
configuration.setValue(WmsLayerType.PROPERTY_NAME_IMAGE_SIZE, new Dimension(200, 300));
configuration.setValue(WmsLayerType.PROPERTY_NAME_LAYER_INDEX, 12);
configuration.setValue(WmsLayerType.PROPERTY_NAME_RASTER, band);
final DomElement originalDomElement = new DefaultDomElement("configuration");
final SessionDomConverter domConverter = new SessionDomConverter(productManager);
//
domConverter.convertValueToDom(configuration, originalDomElement);
// For debug purposes
System.out.println(originalDomElement.toXml());
//
final PropertyContainer restoredConfiguration = (PropertyContainer) domConverter.convertDomToValue(originalDomElement,
wmsLayerType.createLayerConfig(null));
compareConfigurations(configuration, restoredConfiguration);
}
示例12: configurePropertySet
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
private void configurePropertySet(PropertySet propertySet) {
final PropertySet presetPropertySet = PropertyContainer.createObjectBacked(new PresetContainer());
// awkward - purpose is to insert 'preset' property at the first position of the binding context's property set
final Property[] properties = propertySet.getProperties();
propertySet.removeProperties(properties);
propertySet.addProperty(presetPropertySet.getProperty("preset"));
propertySet.addProperties(properties);
}
示例13: TimeExtractionPane
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
public TimeExtractionPane(PropertyContainer container) {
super(new BorderLayout(0, 5));
final JCheckBox extractTime = createCheckBoxBinding(container.getProperty("extractTimeFromFilename"));
final Property datePattern = container.getProperty("dateInterpretationPattern");
final String dateDN = datePattern.getDescriptor().getDisplayName();
final JPanel datePanel = new JPanel(new BorderLayout(0, 2));
final JLabel dateLabel = new JLabel(dateDN + ":");
final JTextField datePatternField = createTextFieldBinding(datePattern);
dateLabel.setEnabled(false);
datePatternField.setEnabled(false);
datePanel.add(dateLabel, BorderLayout.NORTH);
datePanel.add(datePatternField, BorderLayout.CENTER);
final Property filenamePattern = container.getProperty("filenameInterpretationPattern");
final String filenameDN = filenamePattern.getDescriptor().getDisplayName();
final JPanel filenamePanel = new JPanel(new BorderLayout(0, 2));
final JLabel filenameLabel = new JLabel(filenameDN + ":");
final JTextField filenamePatternField = createTextFieldBinding(filenamePattern);
filenameLabel.setEnabled(false);
filenamePatternField.setEnabled(false);
filenamePanel.add(filenameLabel, BorderLayout.NORTH);
filenamePanel.add(filenamePatternField, BorderLayout.CENTER);
extractTime.addChangeListener(e -> {
final boolean selected = extractTime.isSelected();
dateLabel.setEnabled(selected);
datePatternField.setEnabled(selected);
filenameLabel.setEnabled(selected);
filenamePatternField.setEnabled(selected);
});
add(extractTime, BorderLayout.NORTH);
add(datePanel, BorderLayout.CENTER);
add(filenamePanel, BorderLayout.SOUTH);
}
示例14: createParameterMap
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
private static PropertyContainer createParameterMap(Map<String, Object> map) {
ParameterDescriptorFactory parameterDescriptorFactory = new ParameterDescriptorFactory();
final PropertyContainer container = PropertyContainer.createMapBacked(map, PixExOp.class,
parameterDescriptorFactory);
container.setDefaultValues();
return container;
}
示例15: getConverter
import com.bc.ceres.binding.PropertyContainer; //导入依赖的package包/类
private static Converter getConverter(final PropertyContainer valueContainer, final String name) {
final Property[] properties = valueContainer.getProperties();
for (Property p : properties) {
final PropertyDescriptor descriptor = p.getDescriptor();
if (descriptor != null && (descriptor.getName().equals(name) ||
(descriptor.getAlias() != null && descriptor.getAlias().equals(name)))) {
return descriptor.getConverter();
}
}
return null;
}