home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-08-01 | 3.0 KB | 101 lines |
- package com.symantec.itools.swing.actions;
-
- import com.symantec.itools.vcafe.openapi.*;
- import com.symantec.itools.vcafe.openapi.beans.DesignTimeDnd;
- import com.symantec.itools.vcafe.openapi.beans.DesignTimeOnDrop;
-
- public final class ActionDTHelper
- implements DesignTimeDnd, DesignTimeOnDrop
- {
- //
- // DesignTimeDnd Implementation
- //
-
- public boolean canAcceptDrag(VisualObject visualObject)
- {
- return false;
- }
-
- public boolean canDragOnto(VisualObject visualObject)
- {
- if (visualObject.isRootObject())
- return true;
-
- if (visualObject.isInstanceOf("com.sun.java.swing.JMenu"))
- return true;
-
- if (visualObject.isInstanceOf("com.sun.java.swing.JToolBar"))
- return true;
-
- return false;
- }
-
- public boolean abortAcceptDrag(VisualObject visualObject)
- {
- return !canDragOnto(visualObject);
- }
-
- public boolean abortDragOnto(VisualObject visualObject)
- {
- return false;
- }
-
- //
- // DesignTimeOnDrop Implementation
- //
-
- public void onDrop(VisualObject actionRefVO)
- {
- /*
- //Since Actions are roots as well, we ignore those
- if (!actionRefVO.isRootObject())
- {
- //Find the reference at the root level that the actionRefVO also refers to
- VisualObject actionRootVO = null;
- {
- String objectName = actionRefVO.getName();
-
- VisualObject stepVO = actionRefVO.getRootObject().getFirstChild();
- while(stepVO != null)
- {
- if (stepVO.getName().equals(objectName))
- {
- actionRootVO = stepVO;
- break;
- }
-
- stepVO = stepVO.getSibling();
- }
- }
-
- System.out.println("actionRootVO = " + actionRootVO);
-
- VisualObject parent = actionRefVO.getParent();
- if (parent != null)
- {
- String className =
- parent.isInstanceOf("com.sun.java.swing.JToolBar") ?
- "com.symantec.itools.swing.actions.JActionButton" :
- "com.symantec.itools.swing.actions.JActionMenuItem";
- //System.out.println("className = " + className);
-
- VisualObject actionObject = VisualCafe.getVisualCafe().createVisualObjectByName(className);
- //System.out.println("actionObject = " + actionObject);
-
- //VisualProperty properties[] = actionObject.getProperties();
- //for (int i = 0; i < properties.length; i++)
- // if (properties[i] != null)
- // System.out.println(properties[i].getInternalPropertyName());
-
- VisualProperty actionProperty = actionObject.findProperty("ipnaction");
- //System.out.println("actionProperty = " + actionProperty);
-
-
-
- //actionProperty.setReferencedVisualObjectID();
- }
- }
- */
- }
- }
-