本文整理汇总了Java中com.bc.ceres.binding.Property.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setValue方法的具体用法?Java Property.setValue怎么用?Java Property.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bc.ceres.binding.Property
的用法示例。
在下文中一共展示了Property.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reactOnChange
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
/**
* Sets the incidence angle and the quantification value according to the selected product.
*/
void reactOnChange() {
if (isInputProductChanged()) {
if (this.currentProduct != null) {
PropertySet propertySet = this.bindingContext.getPropertySet();
for (Field field : this.bandFields) {
Property property = propertySet.getProperty(field.getName());
updateValueSet(property, this.currentProduct);
BandParameter annotation = field.getAnnotation(BandParameter.class);
float min = annotation.minWavelength();
float max = annotation.maxWavelength();
if (min != 0.0f && max != 0.0f) {
String bandName = BaseIndexOp.findBand(min, max, this.currentProduct);
try {
property.setValue(bandName);
} catch (ValidationException e) {
e.printStackTrace();
}
}
}
checkResampling(this.currentProduct);
}
}
}
示例2: 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;
}
示例3: 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);
final Property bandNameProperty = getBinding().getContext().getPropertySet().getProperty("bandName");
bandNameProperty.setValueFromText(AddLandCoverOp.getValidBandName((String) selectedValue, product));
// Now model is in sync with UI
getBinding().clearProblem();
} catch (ValidationException e) {
getBinding().reportProblem(e);
}
}
示例4: 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);
}
}
}
示例5: 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);
}
}
示例6: applyChanges
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
@Override
public void applyChanges() {
if (isInitialised()) {
final BindingContext bindingContext = getBindingContext();
final Property showSuppressedProperty = bindingContext.getPropertySet().getProperty(PREFERENCE_KEY_SHOW_SUPPRESSED);
if (Boolean.parseBoolean(showSuppressedProperty.getValueAsText())) {
final Preferences preferences = SnapApp.getDefault().getPreferences();
try {
final String[] childrenNames = preferences.keys();
for (String childrenName : childrenNames) {
if (childrenName.endsWith(Dialogs.PREF_KEY_SUFFIX_DONTSHOW)) {
preferences.putBoolean(childrenName, false);
}
}
showSuppressedProperty.setValue(Boolean.FALSE);
} catch (BackingStoreException | ValidationException e) {
SnapApp.getDefault().handleError("Failure while resetting suppressed dialogs.", e);
}
}
}
super.applyChanges();
}
示例7: updateSourceBands
import com.bc.ceres.binding.Property; //导入方法依赖的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());
}
}
}
}
}
示例8: updateSourceProduct
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
private void updateSourceProduct() {
try {
Property property = bindingContext.getPropertySet().getProperty(UIUtils.PROPERTY_SOURCE_PRODUCT);
if (property != null) {
property.setValue(productChangedHandler.currentProduct);
}
} catch (ValidationException e) {
throw new IllegalStateException("Property '" + UIUtils.PROPERTY_SOURCE_PRODUCT + "' must be of type " + Product.class + ".", e);
}
}
示例9: propertyChange
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (getCurrentLayer() != null) {
try {
final Property layerProperty = getCurrentLayer().getConfiguration().getProperty(propertyName);
if (layerProperty != null) {
layerProperty.setValue(evt.getNewValue());
}
} catch (ValidationException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
}
示例10: updateFormModel
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
private void updateFormModel(Map<String, Object> parameterMap) throws ValidationException {
final PropertySet propertySet = formModel.getBindingContext().getPropertySet();
final Set<Map.Entry<String, Object>> entries = parameterMap.entrySet();
for (Map.Entry<String, Object> entry : entries) {
Property property = propertySet.getProperty(entry.getKey());
if (property != null) {
property.setValue(entry.getValue());
}
}
if (parameterMap.containsKey("outputFile")) {
File outputFile = new File((String) parameterMap.get("outputFile"));
File outputDir = outputFile.getParentFile();
if (outputDir != null) {
getTargetProductSelector().getModel().setProductDir(outputDir);
}
getTargetProductSelector().getModel().setProductName(FileUtils.getFilenameWithoutExtension(outputFile));
}
BinningConfigurationPanel configurationPanel = form.getBinningConfigurationPanel();
VariableTableController variableTableController = configurationPanel.getVariableTableController();
VariableConfig[] variableConfigs = new VariableConfig[0];
if (parameterMap.containsKey("variableConfigs")) {
variableConfigs = (VariableConfig[]) parameterMap.get("variableConfigs");
}
variableTableController.setVariableConfigs(variableConfigs);
AggregatorTableController aggregatorTableController = configurationPanel.getAggregatorTableController();
AggregatorConfig[] aggregatorConfigs = new AggregatorConfig[0];
if (parameterMap.containsKey("aggregatorConfigs")) {
aggregatorConfigs = (AggregatorConfig[]) parameterMap.get("aggregatorConfigs");
}
aggregatorTableController.setAggregatorConfigs(aggregatorConfigs);
}
示例11: setProperty
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
public void setProperty(String key, Object value) throws ValidationException {
if (propertySet.isPropertyDefined(key)) {
final Property property = propertySet.getProperty(key);
property.setValue(value);
} else {
throw new IllegalStateException("Unknown property: " + key);
}
}
示例12: updateTargetProductFields
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
private void updateTargetProductFields() {
TargetProductSelectorModel model = targetProductSelector.getModel();
Property property = propertySet.getProperty(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE);
model.setSaveToFileSelected(false);
if (!operatorDescriptor.isHandlingOutputName()) {
Object value = property.getValue();
if (value != null) {
File file = operatorDescriptor.resolveVariables(new File(property.getValueAsText()));
if (!file.isAbsolute()) {
file = new File(operatorDescriptor.getWorkingDir(), file.getAbsolutePath());
}
String productName = FileUtils.getFilenameWithoutExtension(file);
if (fileExtension == null) {
fileExtension = FileUtils.getExtension(file);
}
model.setProductName(productName);
}
} else {
try {
model.setProductName("Output Product");
if (property != null) {
property.setValue(null);
}
targetProductSelector.setEnabled(false);
targetProductSelector.getSaveToFileCheckBox().setEnabled(false);
} catch (ValidationException e) {
Logger.getLogger(ToolExecutionForm.class.getName()).severe(e.getMessage());
}
}
targetProductSelector.getProductDirTextField().setEnabled(false);
}
示例13: selectionChanged
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
@Override
public void selectionChanged(SelectionChangeEvent event) {
if (!operatorDescriptor.isHandlingOutputName()) {
Property targetProperty = propertySet.getProperty(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE);
Object value = targetProperty.getValue();
String productName = "";
final Product selectedProduct = (Product) event.getSelection().getSelectedValue();
if (selectedProduct != null) {
productName = FileUtils.getFilenameWithoutExtension(selectedProduct.getName());
}
final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel();
productName += TARGET_PRODUCT_NAME_SUFFIX;
targetProductSelectorModel.setProductName(productName);
String workingDir = operatorDescriptor.getWorkingDir();
if (value != null) {
File oldValue = operatorDescriptor.resolveVariables(value instanceof File ? (File) value : new File((String) value));
if (fileExtension == null)
fileExtension = TIF_EXTENSION;
File current;
File parent;
if (oldValue != null && (parent = oldValue.getParentFile()) != null) {
current = new File(parent.getAbsolutePath(), productName + fileExtension);
} else {
current = new File(workingDir, productName + fileExtension);
}
propertySet.setValue(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE, current);
} else {
try {
targetProperty.setValue(new File(workingDir, productName + TIF_EXTENSION));
} catch (ValidationException ignored) {
}
}
}
}
示例14: setPropertyValue
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
private void setPropertyValue(Property property, boolean defaultValue) {
try {
property.setValue(getPropertyValue(property.getName(), defaultValue));
} catch (ValidationException e) {
e.printStackTrace();
}
}
示例15: SpectralUnmixingFormModel
import com.bc.ceres.binding.Property; //导入方法依赖的package包/类
public SpectralUnmixingFormModel(Product sourceProduct, PropertySet propertySet) {
this.sourceProduct = sourceProduct;
this.propertySet = propertySet;
try {
Property model = this.propertySet.getProperty("sourceBandNames");
model.setValue(model.getDescriptor().getValueSet().getItems());
} catch (ValidationException e) {
// ignore, validation will be performed again later
}
}