/**
   * Action method invoked when an event triggers this action.
   *
   * <p>The {@link #_compartment} instance variable defines the action to take, and the {@link
   * #_display} instance variable whether it should set visibility or note.
   *
   * <p><em>Note</em>. The {@link #_display} instance variable is really redundant. Its value is
   * implied by the operation.
   *
   * @param ae The event that triggered us.
   */
  public void actionPerformed(ActionEvent ae) {

    // Only do anything if we have a single item selected (surely this
    // should work for multiple selections as well?).

    Vector sels = Globals.curEditor().getSelectionManager().selections();

    if (sels.size() == 1) {
      Selection sel = (Selection) sels.firstElement();
      Fig f = sel.getContent();

      // Perform the action

      if (_compartment.equals("Show Attribute Compartment")) {
        ((FigClass) f).setAttributeVisible(_display);
      } else if (_compartment.equals("Hide Attribute Compartment")) {
        ((FigClass) f).setAttributeVisible(_display);
      } else if (_compartment.equals("Show Operation Compartment")
          || _compartment.equals("Hide Operation Compartment")) {
        if (f instanceof FigClass) ((FigClass) f).setOperationVisible(_display);
        if (f instanceof FigInterface) ((FigInterface) f).setOperationVisible(_display);
      } else if (_compartment.equals("Show Extension Point Compartment")) {
        ((FigUseCase) f).setExtensionPointVisible(_display);
      } else if (_compartment.equals("Hide Extension Point Compartment")) {
        ((FigUseCase) f).setExtensionPointVisible(_display);
      } else if (_compartment.equals("Show All Compartments")) {
        ((FigClass) f).setAttributeVisible(_display);
        ((FigClass) f).setOperationVisible(_display);
      } else {
        ((FigClass) f).setAttributeVisible(_display);
        ((FigClass) f).setOperationVisible(_display);
      }
    }
  }
Пример #2
0
 public Object clone() {
   FigUseCase figClone = (FigUseCase) super.clone();
   Vector v = figClone.getFigs();
   figClone._bigPort = (FigCircle) v.elementAt(0);
   figClone._cover = (FigCircle) v.elementAt(1);
   figClone._name = (FigText) v.elementAt(2);
   return figClone;
 }
Пример #3
0
 /**
  * Something has changed, check if its the check box.
  *
  * <p>
  *
  * @param e The event that triggered us.
  * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
  */
 public void itemStateChanged(ItemEvent e) {
   if (!refreshTransaction) {
     if (e.getSource() == epCheckBox) {
       FigUseCase target = (FigUseCase) getTarget();
       target.setExtensionPointVisible(epCheckBox.isSelected());
     } else {
       super.itemStateChanged(e);
     }
   }
 }
Пример #4
0
  /**
   * Refresh the display. This means setting the check box from the target use case fig.
   *
   * @see org.argouml.ui.TabTarget#refresh()
   */
  public void refresh() {

    refreshTransaction = true;

    // Invoke the parent refresh first

    super.refresh();

    FigUseCase target = (FigUseCase) getTarget();

    epCheckBox.setSelected(target.isExtensionPointVisible());

    refreshTransaction = false;
  }