예제 #1
0
 public void addCurrentSketch() {
   if (selector.showRegions.isSelected()) {
     Page page = SketchletEditor.getInstance().getCurrentPage();
     SketchEntryEyeSlot mslot = new SketchEntryEyeSlot(page, this);
     slots.add(mslot);
     SketchExitEyeSlot mslot2 = new SketchExitEyeSlot(page, this);
     slots.add(mslot2);
     KeyboardActionsEyeSlot kslot = new KeyboardActionsEyeSlot(page, this);
     slots.add(kslot);
     VariablesEventsEyeSlot vslot = new VariablesEventsEyeSlot(page, this);
     slots.add(vslot);
     for (ActiveRegion region : page.getRegions().getRegions()) {
       RegionEyeSlot rs = new RegionEyeSlot(region, this);
       slots.add(rs);
     }
   }
 }
예제 #2
0
  public void load() {
    slots.removeAllElements();
    int n = 0;
    if (selector.showVariables.isSelected()) {
      for (String strVar : VariablesBlackboard.getInstance().getVariablesList()) {
        Variable v = VariablesBlackboard.getInstance().getVariable(strVar);
        if (v != null && !v.getName().isEmpty()) {
          VariableEyeSlot slot = new VariableEyeSlot(v, this);
          slots.add(slot);
          n++;
        }
      }
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
      n = 0;
    }

    if (selector.showTimers.isSelected()) {
      for (Timer t : Timers.getGlobalTimers().getTimers()) {
        TimerEyeSlot slot = new TimerEyeSlot(t, this);
        slots.add(slot);
        n++;
      }
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
      n = 0;
    }

    if (selector.showMacros.isSelected()) {
      for (Macro m : Macros.globalMacros.macros) {
        MacroEyeSlot slot = new MacroEyeSlot(m, this);
        slots.add(slot);
        n++;
      }
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
      n = 0;
    }
    if (selector.showScreenActions.isSelected()) {
      for (ScreenScript sc : ScreenScripts.getPublicScriptRunner().getScripts()) {
        ScreenActionEyeSlot slot = new ScreenActionEyeSlot(sc, this);
        slots.add(slot);
        n++;
      }
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
      n = 0;
    }
    if (selector.showScripts.isSelected()) {
      for (ScriptPluginProxy sc : VariablesBlackboard.getScripts()) {
        ScriptEyeSlot slot = new ScriptEyeSlot(sc, this);
        slots.add(slot);
        n++;
      }
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
      n = 0;
    }

    if (selector.showSketches.isSelected()) {
      for (Page s : SketchletEditor.getProject().getPages()) {
        EyeSlot slot = new SketchEyeSlot(s, this);
        if (s == SketchletEditor.getInstance().getCurrentPage() && n > 0) {
          slots.add(new EmptyEyeSlot(this));
        }
        slots.add(slot);
        if (s == SketchletEditor.getInstance().getCurrentPage()) {
          addCurrentSketch();
          slots.add(new EmptyEyeSlot(this));
          n = 0;
        } else {
          n++;
        }
      }
    } else {
      addCurrentSketch();
      n++;
    }
    if (n > 0) {
      slots.add(new EmptyEyeSlot(this));
    }

    for (int i = 0; i < slots.size(); i++) {
      for (int j = 0; j < slots.size(); j++) {
        slots.elementAt(i).addRelatedSlot(slots.elementAt(j));
      }
    }

    for (int i = 0; i < slots.size(); i++) {
      Collections.sort(
          slots.elementAt(i).relatedSlotsInfo,
          new Comparator() {

            public int compare(Object obj1, Object obj2) {
              if (obj1 instanceof EyeSlotRelation && obj2 instanceof EyeSlotRelation) {
                return ((EyeSlotRelation) obj1)
                    .description.compareTo(((EyeSlotRelation) obj2).description);
              }
              return 0;
            }
          });
    }
  }