Ejemplo n.º 1
0
  /**
   * Create an 'empty' BootDashViewModel with no run targets. Targets can be added by adding them to
   * the runTarget's LiveSet.
   */
  public BootDashViewModel(BootDashModelContext context, RunTargetType... runTargetTypes) {
    runTargets = new LiveSet<RunTarget>(new LinkedHashSet<RunTarget>());
    models = new BootDashModelManager(context, runTargets);

    manager = new RunTargetPropertiesManager(context, runTargetTypes);
    List<RunTarget> existingtargets = manager.getStoredTargets();
    runTargets.addAll(existingtargets);
    runTargets.addListener(manager);

    this.runTargetTypes = new LinkedHashSet<RunTargetType>(Arrays.asList(runTargetTypes));
    filterBox = new TagFilterBoxModel();
    toggleFiltersModel = new ToggleFiltersModel();
    filter = Filters.compose(filterBox.getFilter(), toggleFiltersModel.getFilter());
    devtoolsProcessTracker = DevtoolsUtil.createProcessTracker(this);
  }
Ejemplo n.º 2
0
  public void removeTarget(RunTarget toRemove, UserInteractions userInteraction) {

    if (toRemove != null) {
      RunTarget found = null;
      for (RunTarget existingTarget : runTargets.getValues()) {
        if (existingTarget.getId().equals(toRemove.getId())) {
          found = existingTarget;
          break;
        }
      }
      if (found != null
          && userInteraction.confirmOperation(
              "Deleting run target: " + found.getName(),
              "Are you sure that you want to delete "
                  + found.getName()
                  + "? All information regarding this target will be permanently removed.")) {
        runTargets.remove(found);
      }
    }
  }
Ejemplo n.º 3
0
 public List<DesiredLRPResponse> refreshDesiredLRPs() {
   List<DesiredLRPResponse> lrps = getReceptor().getDesiredLRPs();
   Set<String> activeProcessGuids = new HashSet<String>(lrps.size());
   for (DesiredLRPResponse dlrp : lrps) {
     activeProcessGuids.add(dlrp.getProcessGuid());
   }
   ArrayList<BootDashElement> newElements = new ArrayList<BootDashElement>();
   for (DesiredLRPResponse lrp : lrps) {
     String id = lrp.getProcessGuid();
     LatticeBootDashElement el = ensureElement(id);
     newElements.add(el);
     el.setDesiredLrp(lrp);
     elementByProcessGuid.put(id, el);
   }
   elements.replaceAll(newElements);
   return lrps;
 }
Ejemplo n.º 4
0
 private synchronized LatticeBootDashElement ensureElement(String processGuid) {
   LatticeBootDashElement existing;
   LatticeBootDashElement created = null;
   synchronized (this) {
     existing = elementByProcessGuid.get(processGuid);
     if (existing == null) {
       created =
           existing =
               new LatticeBootDashElement(
                   this,
                   ltcTarget,
                   processGuid,
                   PropertyStoreFactory.createSubStore(processGuid, store));
       elementByProcessGuid.put(processGuid, created);
     }
   }
   if (created != null) {
     elements.add(created);
   }
   return existing;
 }