Package com.cburch.logisim.gui.main

Examples of com.cburch.logisim.gui.main.Selection$Event


        }

        @Override
        public void actionPerformed(ActionEvent e) {
            Object src = e.getSource();
            Selection sel = proj.getSelection();
            if (src == del) {
                proj.doAction(SelectionActions.clear(sel));
            } else if (src == cut) {
                proj.doAction(SelectionActions.cut(sel));
            } else if (src == copy) {
View Full Code Here


        }
    }

    @Override
    public void select(Canvas canvas) {
        Selection sel = canvas.getSelection();
        if (!selectionsAdded.contains(sel)) {
            sel.addListener(selListener);
        }
    }
View Full Code Here

    }

    @Override
    public void mousePressed(Canvas canvas, Graphics g, MouseEvent e) {
        Project proj = canvas.getProject();
        Selection sel = proj.getSelection();
        Circuit circuit = canvas.getCircuit();
        start = Location.create(e.getX(), e.getY());
        curDx = 0;
        curDy = 0;
        moveGesture = null;

        // if the user clicks into the selection,
        // selection is being modified
        Collection<Component> in_sel = sel.getComponentsContaining(start, g);
        if (!in_sel.isEmpty()) {
            if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
                setState(proj, MOVING);
                proj.repaintCanvas();
                return;
            } else {
                Action act = SelectionActions.drop(sel, in_sel);
                if (act != null) {
                    proj.doAction(act);
                }
            }
        }

        // if the user clicks into a component outside selection, user
        // wants to add/reset selection
        Collection<Component> clicked = circuit.getAllContaining(start, g);
        if (!clicked.isEmpty()) {
            if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
                if (sel.getComponentsContaining(start).isEmpty()) {
                    Action act = SelectionActions.dropAll(sel);
                    if (act != null) {
                        proj.doAction(act);
                    }
                }
            }
            for (Component comp : clicked) {
                if (!in_sel.contains(comp)) {
                    sel.add(comp);
                }
            }
            setState(proj, MOVING);
            proj.repaintCanvas();
            return;
View Full Code Here

                        clearCanvasMessage(canvas, dx, dy);
                        repl = result.getReplacementMap();
                    } else {
                        repl = null;
                    }
                    Selection sel = proj.getSelection();
                    proj.doAction(SelectionActions.translate(sel, dx, dy, repl));
                }
            }
            moveGesture = null;
            proj.repaintCanvas();
        } else if (state == RECT_SELECT) {
            Bounds bds = Bounds.create(start).add(start.getX() + curDx,
                start.getY() + curDy);
            Circuit circuit = canvas.getCircuit();
            Selection sel = proj.getSelection();
            Collection<Component> in_sel = sel.getComponentsWithin(bds, g);
            for (Component comp : circuit.getAllWithin(bds, g)) {
                if (!in_sel.contains(comp)) sel.add(comp);
            }
            Action act = SelectionActions.drop(sel, in_sel);
            if (act != null) {
                proj.doAction(act);
            }
View Full Code Here

    private void processKeyEvent(Canvas canvas, KeyEvent e, int type) {
        HashMap<Component, KeyConfigurator> handlers = keyHandlers;
        if (handlers == null) {
            handlers = new HashMap<Component, KeyConfigurator>();
            Selection sel = canvas.getSelection();
            for (Component comp : sel.getComponents()) {
                ComponentFactory factory = comp.getFactory();
                AttributeSet attrs = comp.getAttributeSet();
                Object handler = factory.getFeature(KeyConfigurator.class, attrs);
                if (handler != null) {
                    KeyConfigurator base = (KeyConfigurator) handler;
View Full Code Here

        } else {
            dx = Math.max(e.getX() - start.getX(), -bds.getX());
            dy = Math.max(e.getY() - start.getY(), -bds.getY());
        }

        Selection sel = proj.getSelection();
        if (sel.shouldSnap()) {
            dx = Canvas.snapXToGrid(dx);
            dy = Canvas.snapYToGrid(dy);
        }
        curDx = dx;
        curDy = dy;
View Full Code Here

      Event[] events = history.getLatestPage();

      System.out.println("Events In the latestPage are : ");
      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " + anEvent.getClass().getName()
            + "  FullFormattedMessage: "
            + anEvent.getFullFormattedMessage());
      }
    } catch (Exception e)
    {
      System.out.println("Caught Exception : " + " Name : "
          + e.getClass().getName() + " Message : " + e.getMessage()
View Full Code Here

                {
                    ArrayOfEvent aoe = (ArrayOfEvent) value;
                    Event[] evts = aoe.getEvent();
                    for (int evtID = 0; evtID < evts.length; ++evtID)
                    {
                        Event anEvent = evts[evtID];
                        System.out.println("\n----------" + "\n Event ID: "
                                + anEvent.getKey() + "\n Event: "
                                + anEvent.getClass().getName()
                                + "\n FullFormattedMessage: "
                                + anEvent.getFullFormattedMessage()
                                + "\n VM Reference: "
                                + anEvent.getVm().getVm().get_value()
                                + "\n----------\n");
                    }
                } else if (value instanceof VmEvent)
                {
                    VmEvent anEvent = (VmEvent) value;
                    System.out.println("\n----------" + "\n Event ID: "
                            + anEvent.getKey() + "\n Event: "
                            + anEvent.getClass().getName()
                            + "\n FullFormattedMessage: "
                            + anEvent.getFullFormattedMessage()
                            + "\n VM Reference: "
                            + anEvent.getVm().getVm().get_value()
                            + "\n----------\n");
                }
                System.out.println("===============");
            }
        }
View Full Code Here

        evtMgr.createCollectorForEvents(eventFilter);
      Event[] events = ehc.getLatestPage();

      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " +
            anEvent.getClass().getName());
      }
    }
    si.getServerConnection().logout();
  }
View Full Code Here

    ServiceInstance si = new ServiceInstance(
        new URL(args[0]), args[1], args[2], true);

    // get the latest event and print it out
    EventManager evtMgr = si.getEventManager();
    Event latestEvent = evtMgr.getLatestEvent();
    printEvent(latestEvent);

    // create a filter spec for querying events
    EventFilterSpec efs = new EventFilterSpec();
    // limit to only error and warning
View Full Code Here

TOP

Related Classes of com.cburch.logisim.gui.main.Selection$Event

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.