Beispiel #1
0
 private void updateMenuItems() {
   SetRedoMenuItemState cmd =
       (SetRedoMenuItemState) CommandManager.getInstance().getCommand("SetRedoMenuItemState");
   if (cmd != null) {
     cmd.setState(actions2redo() > 0);
     cmd.execute();
   }
   SetUndoMenuItemState cmd2 =
       (SetUndoMenuItemState) CommandManager.getInstance().getCommand("SetUndoMenuItemState");
   if (cmd2 != null) {
     cmd2.setState(actions2undo() > 0);
     cmd2.execute();
   }
 }
Beispiel #2
0
    public void actionPerformed(ActionEvent event) {
      String action = event.getActionCommand();
      if (action.equals(colorString)) {
        Color newColor = ColorChooser.getColor(colorTitleString, getColor());

        if (newColor != null) {
          setColor(newColor);
          currentColor = newColor;
        }

        CommandManager.getInstance().execute("RepaintWorkspace");
      } else if (action.equals(dashedString)) {
        dashed = !dashed;
        currentIsDashed = dashed;

        CommandManager.getInstance().execute("RepaintWorkspace");
      }
    }
Beispiel #3
0
  public static void registerDsListener() {

    UndoManager manager = new UndoManager(Constants.DEFAULT_NAME);
    instances.put(Constants.DEFAULT_NAME, manager);

    GetDsManager command = (GetDsManager) CommandManager.getInstance().getCommand("GetDsManager");
    if (command != null) {
      command.getManager().addDsEventListener(manager);
    }
  }