コード例 #1
0
ファイル: CGEditor.java プロジェクト: raghunayak/mico
private void ShowStatus (int x, int y)
    {
        String s = "";
        CGNode node = null;

        if (x >= 0 && y >= 0) {
            try {
                CanvasObject co = super.Find (x, y);
                if (co instanceof CGNode) {
                    node = (CGNode)co;
                }
            } catch (NoSuchElementException ex) {}

            if (node == null) {
                if (topnode == null)
                    s = "Button1: create";
            } else {
		s = "Button1: drag";
                if (node.IsConcept()) {
		    if (node.GetInst() != null)
			s += ", Shift-Button1: edit";
		    if (node == topnode)
			s += ", Shift-Ctrl-Button1: remove";
                    if (menumap.containsKey (node.GetType (true)))
                        s += ", Button3: menu";
                } else {
                    s += ", Shift-Ctrl-Button1: remove";
                }
            }
        }
	frame.status.setStatus (s);
    }
コード例 #2
0
ファイル: CGEditor.java プロジェクト: raghunayak/mico
private void MenuPopup (MouseEvent ev, CGNode node)
    {
	if (!node.IsConcept())
	    return;

	String menuname = (String)menumap.get (node.GetType(true));
	if (menuname == null)
	    return;
	Hashtable templates = (Hashtable)menus.get (menuname);
	if (templates == null)
	    return;

	if( popup != null )
	  remove( popup );

	popup = new PopupMenu( menuname );
	
        Enumeration e = templates.keys();
        while (e.hasMoreElements()) {
            String key = (String)e.nextElement();
	    MenuItem mi = new MenuItem( key );
	    mi.setActionCommand( key );
	    mi.addActionListener( this );
	    popup.add( mi );
        }
        curnode = node;

	this.add( popup );

	popup.show( this, ev.getX(), ev.getY() );
    }
コード例 #3
0
ファイル: CGEditor.java プロジェクト: raghunayak/mico
public void actionPerformed( ActionEvent e )
    {
        String s = e.getActionCommand();
        if (s == null)
            return;

	String menuname = (String)menumap.get (curnode.GetType(true));
	Hashtable templates = (Hashtable)menus.get (menuname);

        ConceptualGraph cg = (ConceptualGraph)templates.get(s);
        AutoUpdateOff ();
        CGNode top = ConvertInput (cg);
        CGArrow arrow = new CGArrow (0, 0, 0, 0);
        Add (arrow);
        ToBottom (arrow);
        curnode.AddChild (top, arrow);
        top.SetParent (curnode, arrow);
        Layout (curnode);
        AutoUpdateOn ();

        NotifyViewers ();
  }