コード例 #1
0
 /**
  * Standard perform action extended by actually activated nodes.
  *
  * @param activatedNodes gives array of actually activated nodes.
  */
 protected void performAction(Node[] activatedNodes) {
   FormLayoutCookie layoutCookie =
       (FormLayoutCookie) activatedNodes[0].getCookie(FormLayoutCookie.class);
   if (layoutCookie != null) {
     org.openide.TopManager.getDefault()
         .getNodeOperation()
         .customize(layoutCookie.getLayoutNode());
   } else {
     RADComponentCookie nodeCookie =
         (RADComponentCookie) activatedNodes[0].getCookie(RADComponentCookie.class);
     if (nodeCookie != null) {
       if (nodeCookie.getRADComponent() instanceof RADVisualContainer) {
         RADVisualContainer container = (RADVisualContainer) nodeCookie.getRADComponent();
         org.openide.TopManager.getDefault()
             .getNodeOperation()
             .customize(container.getLayoutNodeReference());
       }
     }
   }
 }
コード例 #2
0
 /*
  * In this method the enable / disable action logic can be defined.
  *
  * @param activatedNodes gives array of actually activated nodes.
  */
 protected boolean enable(Node[] activatedNodes) {
   if (super.enable(activatedNodes)) {
     FormLayoutCookie layoutCookie =
         (FormLayoutCookie) activatedNodes[0].getCookie(FormLayoutCookie.class);
     if (layoutCookie != null) {
       return layoutCookie.getLayoutNode().hasCustomizer();
     } else {
       RADComponentCookie nodeCookie =
           (RADComponentCookie) activatedNodes[0].getCookie(RADComponentCookie.class);
       if (nodeCookie != null) {
         if (nodeCookie.getRADComponent() instanceof RADVisualContainer) {
           RADVisualContainer container = (RADVisualContainer) nodeCookie.getRADComponent();
           return (container.getLayoutNodeReference() != null)
               && container.getLayoutNodeReference().hasCustomizer();
         }
       }
     }
   }
   return false;
 }