예제 #1
0
  private void addNewRow(ProtocolDiscriminatorVoCollection newdiscriminatorCollection) {
    for (int i = 0; i < newdiscriminatorCollection.size(); i++) {
      grdDiscriminatorsRow newRow = form.grdDiscriminators().getRows().newRow();

      newRow.setcolPriority(newdiscriminatorCollection.get(i).getPriority().getText());
      newRow.setcolDiscriminator(
          newdiscriminatorCollection.get(i).getDiscriminator().getDiscriminatorName());
      newRow.setValue(newdiscriminatorCollection.get(i));
    }
  }
예제 #2
0
  private void populateDiscriminatorsGrid(
      ProtocolDiscriminatorVoCollection newdiscriminatorCollection) {
    grdDiscriminatorsRowCollection addedDiscriminatorCollection =
        form.grdDiscriminators().getRows();

    if (addedDiscriminatorCollection.size() == 0) {
      addNewRow(newdiscriminatorCollection);
    } else {
      ProtocolDiscriminatorVoCollection remainingDiscriminatorCollection =
          new ProtocolDiscriminatorVoCollection();

      for (int x = 0; x < newdiscriminatorCollection.size(); x++) {
        remainingDiscriminatorCollection.add(newdiscriminatorCollection.get(x));
      }

      for (int a = newdiscriminatorCollection.size() - 1; a >= 0; a--) {
        for (int n = addedDiscriminatorCollection.size() - 1; n >= 0; n--) {
          if (addedDiscriminatorCollection
              .get(n)
              .getcolDiscriminator()
              .equals(
                  newdiscriminatorCollection.get(a).getDiscriminator().getDiscriminatorName())) {
            addedDiscriminatorCollection
                .get(n)
                .setcolPriority(newdiscriminatorCollection.get(a).getPriority().toString());
            addedDiscriminatorCollection.get(n).setValue(newdiscriminatorCollection.get(a));
            remainingDiscriminatorCollection.remove(a);
          }
        }
      }

      addNewRow(remainingDiscriminatorCollection);
    }
  }
예제 #3
0
  @Override
  protected void onImbSortClick() throws PresentationLogicException {

    ProtocolDiscriminatorVoCollection discriminatorCollection = getDiscriminators();

    if (discriminatorCollection != null) {
      discriminatorCollection.sort(new StringComparator(SortOrder.ASCENDING));
      form.grdDiscriminators().getRows().clear();
      populateDiscriminatorsGrid(discriminatorCollection);
      updateControlsState();
    }
  }
예제 #4
0
  private ProtocolDiscriminatorVoCollection getDiscriminators() {
    grdDiscriminatorsRowCollection discriminators = form.grdDiscriminators().getRows();

    ProtocolDiscriminatorVoCollection discriminatorCollection =
        new ProtocolDiscriminatorVoCollection();

    for (int i = 0; i < discriminators.size(); i++) {
      discriminatorCollection.add(discriminators.get(i).getValue());
    }

    return discriminatorCollection;
  }
예제 #5
0
  @Override
  protected void onContextMenuItemClick(int menuItemID, Control sender)
      throws PresentationLogicException {
    switch (menuItemID) {
      case GenForm.ContextMenus.EmergencyNamespace.ManchesterTriageProtocol.Add:
        engine.open(form.getForms().Emergency.DiscriminatorSelectDialog);
        break;

      case GenForm.ContextMenus.EmergencyNamespace.ManchesterTriageProtocol.Remove:
        form.grdDiscriminators().removeSelectedRow();
        updateControlsState();
        break;

      case GenForm.ContextMenus.EmergencyNamespace.ManchesterTriageProtocol.MoveUp:
        form.grdDiscriminators().moveUp();
        updateControlsState();
        break;

      case GenForm.ContextMenus.EmergencyNamespace.ManchesterTriageProtocol.MoveDowm:
        form.grdDiscriminators().moveDown();
        updateControlsState();
        break;

      case GenForm.ContextMenus.EmergencyNamespace.ManchesterTriageProtocol.Sort:
        ProtocolDiscriminatorVoCollection discriminatorCollection = getDiscriminators();

        if (discriminatorCollection != null) {
          discriminatorCollection.sort(new StringComparator(SortOrder.ASCENDING));
          form.grdDiscriminators().getRows().clear();
          populateDiscriminatorsGrid(discriminatorCollection);
          updateControlsState();
        }

        break;
    }
  }