예제 #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;
 }