Package org.dyno.visual.swing.plugin.spi

Examples of org.dyno.visual.swing.plugin.spi.IDesignOperation


      if (adapter == null)
        adapter = ExtensionRegistry.createWidgetAdapter(popup);
      Point sp = new Point(p);
      SwingUtilities.convertPointToScreen(sp, jmenu);
      SwingUtilities.convertPointFromScreen(sp, popup);
      IDesignOperation operation = (IDesignOperation) adapter.getAdapter(IDesignOperation.class);
      operation.dragEnter(sp);
      return true;
    } else {
      inside_popup=false;
      if (isDroppingPermitted()) {
        setDropStatus(DROPPING_PERMITTED);
View Full Code Here


      if (adapter == null)
        adapter = ExtensionRegistry.createWidgetAdapter(popup);
      Point sp = new Point(p);
      SwingUtilities.convertPointToScreen(sp, jmenu);
      SwingUtilities.convertPointFromScreen(sp, popup);
      IDesignOperation operation = (IDesignOperation) adapter.getAdapter(IDesignOperation.class);
      operation.dragExit(sp);
      return true;
    } else {
      inside_popup=false;
      setDropStatus(NOOP);
    }
View Full Code Here

      if (adapter == null)
        adapter = ExtensionRegistry.createWidgetAdapter(popup);
      Point sp = new Point(p);
      SwingUtilities.convertPointToScreen(sp, jmenu);
      SwingUtilities.convertPointFromScreen(sp, popup);
      IDesignOperation operation = (IDesignOperation) adapter.getAdapter(IDesignOperation.class);
      operation.dragOver(sp);
      return true;
    } else {
      inside_popup=false;
      if (isDroppingPermitted()) {
        setDropStatus(DROPPING_PERMITTED);
View Full Code Here

      if (adapter == null)
        adapter = ExtensionRegistry.createWidgetAdapter(popup);
      Point sp = new Point(p);
      SwingUtilities.convertPointToScreen(sp, jmenu);
      SwingUtilities.convertPointFromScreen(sp, popup);
      IDesignOperation operation = (IDesignOperation) adapter.getAdapter(IDesignOperation.class);
      operation.drop(sp);
      return true;
    } else {
      inside_popup=false;
      if (isDroppingPermitted()) {
        JMenu jmenu = (JMenu) adaptable.getWidget();
View Full Code Here

            adapter = adapter.getParentAdapter();
          }
          CompositeAdapter compositeAdapter = (CompositeAdapter) adapter;
          if (hoveredAdapter != compositeAdapter) {
            if (hoveredAdapter != null) {
              IDesignOperation operation = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
              if (operation != null)
                operation.dragExit(hoveredAdapter.convertToLocal(p));
            }
            hoveredAdapter = compositeAdapter;
            IDesignOperation operation = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
            if (operation != null)
              operation.dragEnter(hoveredAdapter.convertToLocal(p));
          } else if (compositeAdapter != null) {
            hoveredAdapter = compositeAdapter;
            IDesignOperation operation = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
            if (operation != null) {
              operation.dragOver(hoveredAdapter.convertToLocal(p));
            }
          }
        }
      } else {
        if (hoveredAdapter != null) {
          IDesignOperation operation = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
          if (operation != null) {
            operation.dragExit(hoveredAdapter.convertToLocal(p));
          }
          hoveredAdapter = null;
        }
        glassPlane.setHotspotPoint(p);
      }
    } else if (currentAdapters != null) {
      hoveredAdapter = currentAdapters.get(0);
      IDesignOperation operation = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
      if (operation != null) {
        operation.dragOver(hoveredAdapter.convertToLocal(p));
      }
    }
    glassPlane.repaint();
  }
View Full Code Here

    if (state == STATE_BEAN_HOVER) {
      Component hovered = designer.componentAt(p, 0);
      if (hovered != null) {
        WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(hovered);
        if (isDroppingPopup()) {
          IDesignOperation design = (IDesignOperation) adapter.getAdapter(IDesignOperation.class);
          design.drop(adapter.convertToLocal(p));
        } else {
          if (!(adapter instanceof CompositeAdapter)) {
            adapter = adapter.getParentAdapter();
          }
          CompositeAdapter compositeAdapter = (CompositeAdapter) adapter;
          hoveredAdapter = compositeAdapter;
          IDesignOperation design = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
          if (design != null && design.drop(compositeAdapter.convertToLocal(p))) {
            if (lastParent != null) {
              IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
              List<Component> children = new ArrayList<Component>();
              List<Object> new_constraints = new ArrayList<Object>();
              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                Component child = wa.getParentContainer();
                children.add(child);
                new_constraints.add(compositeAdapter.getChildConstraints(child));
              }
              IUndoableOperation operation = new MoveResizeOperation(lastParent, compositeAdapter, children, lastConstraints, new_constraints);
              operation.addContext(designer.getUndoContext());
              try {
                operationHistory.execute(operation, null, null);
              } catch (ExecutionException e) {
                VisualSwingPlugin.getLogger().error(e);
              }
              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                WidgetEvent we = new WidgetEvent(lastParent, compositeAdapter, wa);
                for (IWidgetListener listener : widgetListeners) {
                  listener.widgetMoved(we);
                }
              }
            } else {
              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                WidgetEvent we = new WidgetEvent(compositeAdapter, wa);
                for (IWidgetListener listener : widgetListeners) {
                  listener.widgetAdded(we);
                }
              }
            }
            designer.fireDirty();
            adapter.addNotify();
          } else {
            if (lastParent != null) {
              List<WidgetAdapter> selectedWidget = designer.getSelectedWidget();
              for (int i = 0; i < selectedWidget.size(); i++) {
                WidgetAdapter wa = selectedWidget.get(i);
                Object constraints = lastConstraints.get(i);
                lastParent.addChildByConstraints(wa.getWidget(), constraints);
              }
            }
          }
        }
      } else {
        glassPlane.setHotspotPoint(null);
        if (lastParent != null) {
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          List<Component> children = new ArrayList<Component>();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            children.add(wa.getParentContainer());
          }
          IUndoableOperation operation = new DragDropOperation(lastParent, children, lastConstraints);
          operation.addContext(designer.getUndoContext());
          try {
            operationHistory.execute(operation, null, null);
          } catch (ExecutionException e) {
            VisualSwingPlugin.getLogger().error(e);
          }
          lastParent.setDirty(true);
          designer.fireDirty();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            WidgetEvent we = new WidgetEvent(lastParent, wa);
            for (IWidgetListener listener : widgetListeners) {
              listener.widgetRemoved(we);
            }
          }
        }
      }
    } else if (currentAdapters != null) {
      WidgetAdapter adapter = currentAdapters.get(0);
      hoveredAdapter = adapter;
      IDesignOperation design = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
      if (design != null && design.drop(adapter.convertToLocal(p))) {
        if (lastParent != null) {
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          List<Component> children = new ArrayList<Component>();
          List<Object> new_constraints = new ArrayList<Object>();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
View Full Code Here

TOP

Related Classes of org.dyno.visual.swing.plugin.spi.IDesignOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.