Package jsynoptic.base

Examples of jsynoptic.base.ContextualActionProvider


            popup.add(sourceDelete);
        }
     
        Object sel = getSelectedSourceOrCollection();
        if ((sel != null) && (sel instanceof ContextualActionProvider)) {
            ContextualActionProvider provider = (ContextualActionProvider) sel;
            String[] actions = provider.getActions(x, y, sel, ContextualActionProvider.SOURCELIST_CONTEXT);
            if ((actions != null) && (actions.length != 0)) {
                for (int i = 0; i < actions.length; ++i) {
                    JMenuItem jmi = new JMenuItem(actions[i]);
                    if (!provider.canDoAction(x, y, sel, actions[i], ContextualActionProvider.SOURCELIST_CONTEXT)) {
                        jmi.setEnabled(false);
                    } else {
                        jmi.addActionListener(this);
                    }
                    add(jmi);
View Full Code Here


    // Parent's MouseListener extension
    public void mousePressed(MouseEvent e) {
      if(!canEdit){
        return;
      }
      ContextualActionProvider p = null;
      double selX=((double)e.getX()/_param.scale)-_param.xmargin;
      double selY=((double)e.getY()/_param.scale)-_param.ymargin;
      for (int i=ShapesContainer.this.size()-1;i>=0; i--) { // outer Vector API
        Object o = get(i);
        if (! (o instanceof Shape)) continue;
View Full Code Here

      if(!canEdit){
        return;
      }
      double selX=((double)e.getX()/_param.scale)-_param.xmargin;
      double selY=((double)e.getY()/_param.scale)-_param.ymargin;
      ContextualActionProvider p = null;
      boolean isLink = false;
      for (int i=ShapesContainer.this.size()-1;i>=0; i--) { // outer Vector API
        Object o = get(i);
        if (! (o instanceof Shape)) continue;
        if (((Shape)o).contains(selX,selY)) {
          if (o instanceof Linkable) {
            String l = ((Linkable)o).getLink();
            if ((l!=null) && !l.equals("")) isLink = true;
          }
          if (! (o instanceof ContextualActionProvider)) continue;
          p = (ContextualActionProvider)o;
          break;
        }
      }
      if ((lastProviderOver != p) && (lastProviderOver != null)) {
        updateCursor();
        if (JSynoptic.gui!=null && !JSynoptic.gui.getLockedShapes().contains(lastProviderOver)) {
          String[] s = lastProviderOver.getActions(selX,selY,getElementContainer().getSelection(),ContextualActionProvider.MOUSE_OUT_CONTEXT);
          if (s!=null) {
            for (int i = 0; i<s.length; ++i) {
              lastProviderOver.doAction(selX,selY,getElementContainer().getSelection(),s[i], null);
            }
          }
        }
      }
      if (p!=null) {
        if (JSynoptic.gui!=null && JSynoptic.gui.getLockedShapes().contains(p)) {
          setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        } else {
          String[] s = p.getActions(selX,selY,getElementContainer().getSelection(),ContextualActionProvider.MOUSE_OVER_CONTEXT);
          if (s!=null) {
            for (int i = 0; i<s.length; ++i) {
              p.doAction(selX,selY,getElementContainer().getSelection(),s[i], null);
            }
          }
        }
      }
      if (isLink) {
View Full Code Here

TOP

Related Classes of jsynoptic.base.ContextualActionProvider

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.