コード例 #1
0
  @Override
  protected void performAction(Node[] nodes) {
    if (nodes != null && nodes.length == 1) {
      RADComponentCookie radCookie = nodes[0].getCookie(RADComponentCookie.class);
      RADComponent comp = (radCookie != null) ? radCookie.getRADComponent() : null;
      if (comp != null) {
        RADComponent topComp = comp.getFormModel().getTopRADComponent();
        if (topComp != comp && EditContainerAction.isEditableComponent(topComp)) {
          FormDesigner designer = getDesigner(topComp);
          if (designer != null && topComp != designer.getTopDesignComponent()) {
            designer.setTopDesignComponent((RADVisualComponent) topComp, true);
            designer.requestActive();

            // NodeAction is quite unreliable in enabling, do it ourselves for sure
            Node[] n = new Node[] {topComp.getNodeReference()};
            if (n[0] != null) {
              EditContainerAction.reenable(n);
              DesignParentAction.reenable(n);
              EditFormAction.reenable(n);
            }
          }
        }
      }
    }
  }
コード例 #2
0
 @Override
 protected boolean enable(Node[] nodes) {
   boolean ret = false;
   if (nodes != null && nodes.length == 1) {
     RADComponentCookie radCookie = nodes[0].getCookie(RADComponentCookie.class);
     RADComponent comp = (radCookie != null) ? radCookie.getRADComponent() : null;
     if (comp != null) {
       RADComponent topComp = comp.getFormModel().getTopRADComponent();
       if (comp != topComp && EditContainerAction.isEditableComponent(topComp)) {
         FormDesigner designer = getDesigner(comp);
         if (designer != null && comp == designer.getTopDesignComponent()) {
           ret = true;
         }
       }
     }
   }
   return ret;
 }
コード例 #3
0
ファイル: RADComponentNode.java プロジェクト: PrimoS/Netbeans
  private void addContainerActions(List<Action> actions) {
    if (component instanceof RADVisualContainer) {
      if (!((RADVisualContainer) component).hasDedicatedLayoutSupport()) {
        actions.add(SystemAction.get(SelectLayoutAction.class));
        actions.add(SystemAction.get(CustomizeLayoutAction.class));
      }
      if (MenuEditLayer.isMenuBarContainer(component)) {
        actions.add(SystemAction.get(InsertMenuAction.class));
      } else if (MenuEditLayer.isMenuRelatedContainer(component)) {
        actions.add(SystemAction.get(AddSubItemAction.class));
      } else { // only use the AddAction for non-menu containers
        actions.add(SystemAction.get(AddAction.class));
      }
    }
    if (getNewTypes().length != 0) {
      actions.add(null);
      actions.add(SystemAction.get(NewAction.class));
    }
    if (EditContainerAction.isEditableComponent(component)) {
      actions.add(SystemAction.get(EditContainerAction.class));
    }
    if (DesignParentAction.isParentEditableComponent(component)) {
      actions.add(SystemAction.get(DesignParentAction.class));
    }
    if (component.getParentComponent() == null) {
      if (component instanceof RADVisualComponent) {
        actions.add(SystemAction.get(DefaultSizeAction.class));
      }
      if (component instanceof RADVisualContainer
          && !((RADVisualContainer) component).hasDedicatedLayoutSupport()) {
        actions.add(SystemAction.get(CustomizeEmptySpaceAction.class));
      }
    }

    addSeparator(actions);
  }