예제 #1
0
 public void disposeUIResources() {
   myRenderer = null;
   myOriginalRenderer = null;
   myLabelEditor.dispose();
   myChildrenEditor.dispose();
   myChildrenExpandedEditor.dispose();
   myListChildrenEditor.dispose();
 }
예제 #2
0
  private void updateEnabledState() {
    myLabelEditor.setEnabled(myRbExpressionLabel.isSelected());

    final boolean isChildrenExpression = myRbExpressionChildrenRenderer.isSelected();
    myChildrenExpandedEditor.setEnabled(isChildrenExpression);
    myExpandedLabel.setEnabled(isChildrenExpression);
    myChildrenEditor.setEnabled(isChildrenExpression);
    myChildrenListEditor.setEnabled(myRbListChildrenRenderer.isSelected());
  }
예제 #3
0
 private void flushDataTo(final CompoundReferenceRenderer renderer) { // label
   LabelRenderer labelRenderer = null;
   if (myRbExpressionLabel.isSelected()) {
     labelRenderer = new LabelRenderer();
     labelRenderer.setLabelExpression(myLabelEditor.getText());
   }
   renderer.setLabelRenderer(labelRenderer);
   // children
   ChildrenRenderer childrenRenderer = null;
   if (myRbExpressionChildrenRenderer.isSelected()) {
     childrenRenderer = new ExpressionChildrenRenderer();
     ((ExpressionChildrenRenderer) childrenRenderer)
         .setChildrenExpression(myChildrenEditor.getText());
     ((ExpressionChildrenRenderer) childrenRenderer)
         .setChildrenExpandable(myChildrenExpandedEditor.getText());
   } else if (myRbListChildrenRenderer.isSelected()) {
     childrenRenderer = new EnumerationChildrenRenderer(getTableModel().getExpressions());
   }
   renderer.setChildrenRenderer(childrenRenderer);
   // classname
   renderer.setClassName(myClassNameField.getText());
 }
예제 #4
0
  public void reset() {
    final TextWithImports emptyExpressionFragment =
        new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
    ((CardLayout) myMainPanel.getLayout())
        .show(myMainPanel, myRenderer == null ? EMPTY_PANEL_ID : DATA_PANEL_ID);
    if (myRenderer == null) {
      return;
    }
    final String className = myRenderer.getClassName();
    myClassNameField.setText(className);
    final ValueLabelRenderer labelRenderer = myRenderer.getLabelRenderer();
    final ChildrenRenderer childrenRenderer = myRenderer.getChildrenRenderer();
    final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();

    if (rendererSettings.isBase(labelRenderer)) {
      myRbDefaultLabel.setSelected(true);
      myLabelEditor.setText(emptyExpressionFragment);
    } else {
      myRbExpressionLabel.setSelected(true);
      myLabelEditor.setText(((LabelRenderer) labelRenderer).getLabelExpression());
    }

    if (rendererSettings.isBase(childrenRenderer)) {
      myRbDefaultChildrenRenderer.setSelected(true);
      myChildrenEditor.setText(emptyExpressionFragment);
      myChildrenExpandedEditor.setText(emptyExpressionFragment);
      getTableModel().clear();
    } else if (childrenRenderer instanceof ExpressionChildrenRenderer) {
      myRbExpressionChildrenRenderer.setSelected(true);
      final ExpressionChildrenRenderer exprRenderer = (ExpressionChildrenRenderer) childrenRenderer;
      myChildrenEditor.setText(exprRenderer.getChildrenExpression());
      myChildrenExpandedEditor.setText(exprRenderer.getChildrenExpandable());
      getTableModel().clear();
    } else {
      myRbListChildrenRenderer.setSelected(true);
      myChildrenEditor.setText(emptyExpressionFragment);
      myChildrenExpandedEditor.setText(emptyExpressionFragment);
      if (childrenRenderer instanceof EnumerationChildrenRenderer) {
        getTableModel().init(((EnumerationChildrenRenderer) childrenRenderer).getChildren());
      } else {
        getTableModel().clear();
      }
    }

    updateEnabledState();
    updateContext(className);
  }