com.bc.ceres.swing.binding.Binding类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中com.bc.ceres.swing.binding.Binding类的一些代码示例,展示了Binding类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding类的具体详情如下:
包路径:com.bc.ceres.swing.binding.Binding
类名称:Binding

Binding介绍

暂无

代码示例

代码示例来源:origin: bcdev/beam

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    final boolean saveExpressionOnly = (Boolean) context.getBinding(
        PROPERTY_NAME_SAVE_EXPRESSION_ONLY).getPropertyValue();
    if (!saveExpressionOnly) {
      context.getBinding(PROPERTY_NAME_NO_DATA_VALUE_USED).setPropertyValue(true);
    }
  }
});

代码示例来源:origin: senbox-org/snap-desktop

private JComponent createUnitComponent(String propertyName) {
  PropertyDescriptor descriptor = context.getPropertySet().getDescriptor(propertyName);
  JLabel unitLabel = new JLabel(descriptor.getUnit());
  context.getBinding(propertyName).addComponent(unitLabel);
  return unitLabel;
}

代码示例来源:origin: senbox-org/snap-desktop

public void valueChanged(ListSelectionEvent event) {
    if (event.getValueIsAdjusting() || getBinding().isAdjustingComponents()) {
      return;
    }
    final Property model = getBinding().getContext().getPropertySet().getProperty(getBinding().getPropertyName());
    try {
      List<File> selectedValuesList = list.getSelectedValuesList();
      model.setValue(selectedValuesList.toArray(new File[selectedValuesList.size()]));
      // Now model is in sync with UI
      getBinding().clearProblem();
    } catch (ValidationException e) {
      getBinding().reportProblem(e);
    }
  }
};

代码示例来源:origin: senbox-org/snap-desktop

private ActionListener createLoadExpressionButtonListener() {
  return e -> {
    try {
      final File file = Dialogs.requestFileForOpen(
          "Load Band Maths Expression", false, null, PREF_KEY_LAST_EXPRESSION_PATH);
      if (file != null) {
        expression = new String(Files.readAllBytes(file.toPath()));
        bindingContext.getBinding(PROPERTY_NAME_EXPRESSION).setPropertyValue(expression);
        bindingContext.getBinding(PROPERTY_NAME_EXPRESSION).adjustComponents();
      }
    } catch (IOException ex) {
      showErrorDialog(ex.getMessage());
    }
  };
}

代码示例来源:origin: bcdev/beam

public boolean isAutoMinMax() {
  return (Boolean) bindingContext.getBinding("autoMinMax").getPropertyValue();
}

代码示例来源:origin: senbox-org/snap-desktop

private void syncPropertyValue(Binding binding, DefaultListModel<File> listModel) {
  Object[] objects = listModel.toArray();
  binding.setPropertyValue(Arrays.stream(objects)
                  .map(item -> new File(item.toString()))
                  .collect(Collectors.toList())
                  .toArray(new File[objects.length]));
}

代码示例来源:origin: senbox-org/snap-desktop

private PropertyDescriptor getPropertyDescriptor() {
  return getBinding().getContext().getPropertySet().getDescriptor(getBinding().getPropertyName());
}

代码示例来源:origin: senbox-org/snap-desktop

this.panel = parametersPane.createPanel();
for (Property property : propertyContainer.getProperties()) {
  Arrays.stream(parametersPane.getBindingContext().getBinding(property.getName()).getComponents())
      .forEach(c -> UIUtils.addPromptSupport(c, property));
  if (this.annotatedFields.containsKey(property.getName())) {
        .filter(a -> a.annotationType().equals(ReadOnly.class))
        .findFirst();
    annotation.ifPresent(annotation1 -> Arrays.stream(parametersPane.getBindingContext().getBinding(property.getName()).getComponents())
        .forEach(c -> c.setEnabled(false)));
          Object newTargetValue = dependency.apply(newValue);
          Binding binding = parametersPane.getBindingContext().getBinding(dependency.getTargetFieldName());
          binding.setPropertyValue(newTargetValue);
          binding.adjustComponents();

代码示例来源:origin: bcdev/beam

private void updateEnabledState(boolean isEnvisatFormatSelected) {
  Binding binding = processingParamBindingContext.getBinding("doRadToRefl");
  for (JComponent component : binding.getComponents()) {
    component.setEnabled(!isEnvisatFormatSelected);
  }
}

代码示例来源:origin: bcdev/beam

@Override
public void problemReported(BindingProblem problem, BindingProblem ignored) {
  final String propertyName = problem.getBinding().getPropertyName();
  final boolean invalidBoundSet = propertyName.equals(PROPERTY_NORTH_BOUND) ||
      propertyName.equals(PROPERTY_EAST_BOUND) ||
      propertyName.equals(PROPERTY_SOUTH_BOUND) ||
      propertyName.equals(PROPERTY_WEST_BOUND);
  if (invalidBoundSet) {
    resetTextField(problem);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

public boolean isAutoMinMax() {
  return (Boolean) bindingContext.getBinding("autoMinMax").getPropertyValue();
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void tableChanged(TableModelEvent e) {
  final TableModel tableModel = (TableModel) e.getSource();
  final MosaicOp.Condition[] conditions = new MosaicOp.Condition[tableModel.getRowCount()];
  for (int i = 0; i < conditions.length; i++) {
    conditions[i] = new MosaicOp.Condition((String) tableModel.getValueAt(i, 0),
                        (String) tableModel.getValueAt(i, 1),
                        Boolean.TRUE.equals(tableModel.getValueAt(i, 2)));
  }
  getBinding().setPropertyValue(conditions);
}

代码示例来源:origin: senbox-org/snap-desktop

private PropertyDescriptor getPropertyDescriptor() {
  return getBinding().getContext().getPropertySet().getDescriptor(getBinding().getPropertyName());
}

代码示例来源:origin: senbox-org/snap-desktop

private void updateLogXAxisCheckBox() {
  HistogramPanelModel.HistogramConfig config = createHistogramConfig();
  final boolean enabled = dataset != null && model.hasStx(config) && model.getStx(config).getMinimum() > 0 && !model.getStx(config).isLogHistogram();
  Binding binding = xAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED);
  if (!enabled) {
    binding.setPropertyValue(false);
  }
  log10AxisEnablement.apply();
  binding.adjustComponents();
}

代码示例来源:origin: senbox-org/snap-desktop

private void toggleControls(OSFamily osFamily) {
  Bundle bundle = modified.get(osFamily);
  boolean canSelect = bundle.getBundleType() != BundleType.NONE;
  BundleLocation location = bundle.getLocation();
  boolean remoteCondition = canSelect && location == BundleLocation.REMOTE;
  boolean localCondition = canSelect && location == BundleLocation.LOCAL;
  for (JComponent component : controls.get(osFamily)) {
    if ("url".equals(component.getName())) {
      component.setEnabled(remoteCondition);
    } else {
      component.setEnabled(canSelect);
    }
  }
  BindingContext bindingContext = bindingContexts.get(osFamily);
  JComponent[] components = bindingContext.getBinding("source").getComponents();
  for (JComponent component : components) {
    component.setEnabled(localCondition);
  }
  for (Component jcomponent : components[0].getParent().getComponents()) {
    jcomponent.setEnabled(localCondition);
  }
  components = bindingContext.getBinding("targetLocation").getComponents();
  for (JComponent component : components) {
    component.setEnabled(canSelect);
  }
  repaint();
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void problemReported(BindingProblem problem, BindingProblem ignored) {
  final String propertyName = problem.getBinding().getPropertyName();
  final boolean invalidBoundSet = propertyName.equals(PROPERTY_NORTH_BOUND) ||
      propertyName.equals(PROPERTY_EAST_BOUND) ||
      propertyName.equals(PROPERTY_SOUTH_BOUND) ||
      propertyName.equals(PROPERTY_WEST_BOUND);
  if (invalidBoundSet) {
    resetTextField(problem);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

public void actionPerformed(ActionEvent e) {
    ProductExpressionPane expressionPane = getProductExpressionPane(currentProduct);
    expressionPane.setCode((String) binding.getPropertyValue());
    if (expressionPane.showModalDialog(null, "Expression Editor") == ModalDialog.ID_OK) {
      binding.setPropertyValue(expressionPane.getCode());
    }
  }
});

代码示例来源:origin: bcdev/beam

@Override
public void adjustComponents() {
  final Color color = (Color) getBinding().getPropertyValue();
  colorComboBox.setSelectedColor(ImageInfo.NO_COLOR.equals(color) ? null : color);
}

代码示例来源:origin: bcdev/beam

@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);
    }
  }
}

代码示例来源:origin: bcdev/beam

@Override
public void tableChanged(TableModelEvent e) {
  final TableModel tableModel = (TableModel) e.getSource();
  final MosaicOp.Condition[] conditions = new MosaicOp.Condition[tableModel.getRowCount()];
  for (int i = 0; i < conditions.length; i++) {
    conditions[i] = new MosaicOp.Condition((String) tableModel.getValueAt(i, 0),
                        (String) tableModel.getValueAt(i, 1),
                        Boolean.TRUE.equals(tableModel.getValueAt(i, 2)));
  }
  getBinding().setPropertyValue(conditions);
}

相关文章