Package ch.rakudave.jnetmap.controller.command

Examples of ch.rakudave.jnetmap.controller.command.Command


          Constructor constructor = layoutC.getConstructor(new Class[] {Graph.class});
          Object o = constructor.newInstance(map);
          final Layout<Device, Connection> newLayout = (Layout<Device, Connection>) o;
          newLayout.setInitializer(vv.getGraphLayout());
          newLayout.setSize(vv.getSize());
      map.getHistory().execute(new Command() {
        @Override
        public Object undo() {
          map.setLayout(oldLayout);
          new Animator(new LayoutTransition<Device, Connection>(vv, newLayout, oldLayout)).start();
          vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
View Full Code Here


   * @param arg1
   * @return
   * @see edu.uci.ics.jung.graph.Hypergraph#addEdge(java.lang.Object, java.util.Collection)
   */
  public boolean addEdge(final Connection arg0, final Collection<? extends Device> arg1) {
    return (Boolean) getHistory().execute(new Command() {
      @Override
      public Object undo() {
        boolean b = graph.removeEdge(arg0);
        notifyListeners(new MapEvent(_this, Type.EDGE_REMOVED, arg0));
        return b;
View Full Code Here

   * @param arg2
   * @return
   * @see edu.uci.ics.jung.graph.Graph#addEdge(java.lang.Object, java.lang.Object, java.lang.Object)
   */
  public boolean addEdge(final Connection arg0, final Device arg1, final Device arg2) {
    return (Boolean) getHistory().execute(new Command() {
      @Override
      public Object undo() {
        arg1.removeInterface(arg1.getInterfaceFor(arg0));
        arg2.removeInterface(arg2.getInterfaceFor(arg0));
        boolean b = graph.removeEdge(arg0);
View Full Code Here

   * @param arg0
   * @return
   * @see edu.uci.ics.jung.graph.Hypergraph#addVertex(java.lang.Object)
   */
  public boolean addVertex(final Device arg0) {
    return (Boolean) getHistory().execute(new Command() {
      @Override
      public Object undo() {
        boolean b = graph.removeVertex(arg0);
        notifyListeners(new MapEvent(_this, Type.VERTEX_REMOVED, arg0));
        arg0.removeDeviceListener(_this);
View Full Code Here

   * @param arg0
   * @return
   * @see edu.uci.ics.jung.graph.Hypergraph#removeEdge(java.lang.Object)
   */
  public boolean removeEdge(final Connection arg0) {
    return (Boolean) getHistory().execute(new Command() {
      private Pair<Device> arg1 = getEndpoints(arg0);
      @Override
      public Object undo() {
        if (arg1.getFirst() != null) arg1.getFirst().addInterface(arg1.getFirst().getInterfaceFor(arg0));
        if (arg1.getSecond() != null) arg1.getSecond().addInterface(arg1.getSecond().getInterfaceFor(arg0));
View Full Code Here

   * @param arg0
   * @return
   * @see edu.uci.ics.jung.graph.Hypergraph#removeVertex(java.lang.Object)
   */
  public boolean removeVertex(final Device arg0) {
    return (Boolean) getHistory().execute(new Command() {
      HashMap<Pair<Device>, Connection> connectors = new HashMap<Pair<Device>, Connection>();
      HashMap<Connection, NetworkIF> oppositeIFs = new HashMap<Connection, NetworkIF>();
     
      @Override
      public Object undo() {
View Full Code Here

              oldDesc = d.getDesctription(), newDesc = deviceDesc.getText(),
              oldLocation = d.getLocation(), newLocation = deviceLocation.getText(),
              oldVendor = d.getVendor(), newVentor = deviceVendor.getText(),
              oldModel = d.getModel(), newModel = deviceModel.getText();
            //TODO skip new command if nothing has changed
            Controller.getCurrentMap().getHistory().execute(new Command() {
              @Override
              public Object undo() {
                d.setType(oldType);
                d.setOtherID(oldID);
                d.setName(oldName);
View Full Code Here

          @Override
          public void actionPerformed(ActionEvent e) {
            leftInterface.save();
            rightInterface.save();
            //TODO skip new command if nothing has changed
            Controller.getCurrentMap().getHistory().execute(new Command() {
              Connection.Type oltType = c.getType(), newType = (Connection.Type) connectionType.getSelectedItem();
              double oldBandwidth = c.getBandwidth(), newBandwidth;
              @Override
              public Object undo() {
                c.setType(oltType);
View Full Code Here

      });
    PreferencePanel p = new PreferencePanel() {
      @Override
      public void save() {
      //TODO skip new command if nothing has changed
        Controller.getCurrentMap().getHistory().execute(new Command() {
          String oldName = i.getName(), newName = name.getText(),
            newAddress = address.getText(),
            newSubnet = subnet.getText(), newGateway = gateway.getText(),
            oldMac = (isPhysical)?((PhysicalIF)i).getMacAddress():null, newMac = mac.getText();
          PingMethod newMethod = nameToMethod((String)method.getSelectedItem(), (Integer) port.getValue());
View Full Code Here

TOP

Related Classes of ch.rakudave.jnetmap.controller.command.Command

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.