Package org.apache.uima.taeconfigurator.model

Examples of org.apache.uima.taeconfigurator.model.ConfigGroup


    TreeItem item = addGroupToGUI(groupName, cg);
    // fill(commonParms, item); // don't add common parsm, they're added by definition
    addGroupToModel(cg);
    cg.setNames(groupNameArray);
    tree.setSelection(new TreeItem[] { item });
    return new ConfigGroup(cpd, cg);
  }
View Full Code Here


   * @param existing -
   *          null or an existing tree item being edited
   */
  private boolean addNewOrEditExistingGroup(String names, TreeItem existing) {
    valueChanged = true; // preset
    ConfigGroup mcg = null;
    String[] oldGroupNames = stringArray0;
    String[] newGroupNames = groupNamesToArray(names);
    String[] groupNamesToAdd;
    String[] groupNamesToDrop = stringArray0;

    if (null != existing) {
      mcg = getCorrespondingModelGroup(existing);
      oldGroupNames = mcg.getNameArray();

      groupNamesToDrop = setDiff(oldGroupNames, newGroupNames);
      groupNamesToAdd = setDiff(newGroupNames, oldGroupNames);
    } else {
      groupNamesToAdd = newGroupNames;
    }

    // it is legal to define a group name more than once, but the same set of group names
    // shouldn't be defined more than once
    if (groupNameAlreadyDefined(newGroupNames)) {
      Utility.popMessage("Group Already Defined",
              "This set of group names has already been defined." + "\n\nGroup: " + names,
              MessageDialog.ERROR);
      return false;
    }

    TreeItem item;
    if (existing == null) {
      ConfigurationGroup cg = new ConfigurationGroup_impl();
      cg.setConfigurationParameters(configurationParameterArray0);
      cg.setNames(groupNamesToArray(names));
      item = addGroupToGUI(names, cg);
      addGroupToModel(cg);
    } else { // editing existing group
      valueChanged = groupNamesToDrop.length != 0 || groupNamesToAdd.length != 0;
      item = existing;
      setGroupText(item, names);

      for (int i = 0; i < groupNamesToDrop.length; i++) {
        removeIncludedParmSettingsFromSingleGroup(groupNamesToDrop[i], mcg.getConfigParms());
      }
      mcg.setNameArray(groupNamesToArray(names));
      if (null != settings) {
        for (int i = 0; i < groupNamesToAdd.length; i++) {
          TreeItem settingsItem = getSettingsTreeGroup(groupNamesToAdd[i]);
          if (null == settingsItem) {
            settingsItem = new TreeItem(settingsTree, SWT.NONE);
            setGroupText(settingsItem, groupNamesToAdd[i]);
            settingsItem.setData(null);
            fill(mcg.getConfigParms(), settingsItem);
            fill(commonParms, settingsItem);
          } else {
            fillInFrontOfCommon(mcg.getConfigParms(), settingsItem);
          }
        }
      }

    }
View Full Code Here

  }

  protected TreeItem addGroupToGUI(String names, ConfigurationGroup cg) {
    TreeItem groupItem = new TreeItem(tree, SWT.NONE);
    setGroupText(groupItem, names);
    ConfigGroup mcg;
    if (names.equals(COMMON_GROUP))
      mcg = new ConfigGroup(cpd, ConfigGroup.COMMON);
    else if (names.equals(NOT_IN_ANY_GROUP))
      mcg = new ConfigGroup(cpd, ConfigGroup.NOT_IN_ANY_GROUP);
    else
      mcg = new ConfigGroup(cpd, cg);
    groupItem.setData(mcg);
    String[] nameArray = groupNamesToArray(names);
    if (null != settingsTree) {
      for (int i = 0; i < nameArray.length; i++) {
        TreeItem[] settingsItems = settingsTree.getItems();
View Full Code Here

    // cpd1 = ((CasConsumerDescription)delegate)
    // .getMetaData().getConfigurationParameterDeclarations();
    // else
    // throw new InternalErrorCDE("Invalid state");

    ConfigGroup noGroup = new ConfigGroup(cpd1, ConfigGroup.NOT_IN_ANY_GROUP);
    ConfigGroup commonGroup = new ConfigGroup(cpd1, ConfigGroup.COMMON);

    addDelegateGroupToGUI(parent, noGroup);
    addDelegateGroupToGUI(parent, commonGroup);
    ConfigurationGroup[] cgs = cpd1.getConfigurationGroups();
    if (cgs != null) {
      for (int i = 0; i < cgs.length; i++) {
        addDelegateGroupToGUI(parent, new ConfigGroup(cpd1, cgs[i]));
      }
    }
  }
View Full Code Here

    }
  }

  private void addNewParameter(ConfigurationParameter parm, ConfigGroup delegateGroup, String key) {

    ConfigGroup group = getCorrespondingModelGroup(delegateGroup);

    if (null == group) {
      group = parmSection.addGroup(delegateGroup);
    }
    ConfigurationParameter parmInGroup;
View Full Code Here

  }

  private ConfigGroup getCorrespondingModelGroup(ConfigGroup delegateGroup) {
    switch (delegateGroup.getKind()) {
      case ConfigGroup.NOT_IN_ANY_GROUP:
        return new ConfigGroup(cpd, ConfigGroup.NOT_IN_ANY_GROUP);
      case ConfigGroup.COMMON:
        return getCorrespondingModelGroup(getAllGroupNames(delegateGroup.getCPD()));
      case ConfigGroup.NAMED_GROUP:
        return getCorrespondingModelGroup(delegateGroup.getNameArray());
    }
View Full Code Here

  private ConfigGroup getCorrespondingModelGroup(String[] nameArray) {
    ConfigurationGroup[] cgs = cpd.getConfigurationGroups();
    for (int i = 0; i < cgs.length; i++) {
      if (setEquals(cgs[i].getNames(), nameArray)) {
        return new ConfigGroup(cpd, cgs[i]);
      }
    }
    return null;
  }
View Full Code Here

    TreeItem item = addGroupToGUI(groupName, cg);
    // fill(commonParms, item); // don't add common parsm, they're added by definition
    addGroupToModel(cg);
    cg.setNames(groupNameArray);
    tree.setSelection(new TreeItem[] { item });
    return new ConfigGroup(cpd, cg);
  }
View Full Code Here

   * @param existing -
   *          null or an existing tree item being edited
   */
  private boolean addNewOrEditExistingGroup(String names, TreeItem existing) {
    valueChanged = true; // preset
    ConfigGroup mcg = null;
    String[] oldGroupNames = stringArray0;
    String[] newGroupNames = groupNamesToArray(names);
    String[] groupNamesToAdd;
    String[] groupNamesToDrop = stringArray0;

    if (null != existing) {
      mcg = getCorrespondingModelGroup(existing);
      oldGroupNames = mcg.getNameArray();

      groupNamesToDrop = setDiff(oldGroupNames, newGroupNames);
      groupNamesToAdd = setDiff(newGroupNames, oldGroupNames);
    } else {
      groupNamesToAdd = newGroupNames;
    }

    // it is legal to define a group name more than once, but the same set of group names
    // shouldn't be defined more than once
    if (groupNameAlreadyDefined(newGroupNames)) {
      Utility.popMessage("Group Already Defined",
              "This set of group names has already been defined." + "\n\nGroup: " + names,
              MessageDialog.ERROR);
      return false;
    }

    TreeItem item;
    if (existing == null) {
      ConfigurationGroup cg = new ConfigurationGroup_impl();
      cg.setConfigurationParameters(configurationParameterArray0);
      cg.setNames(groupNamesToArray(names));
      item = addGroupToGUI(names, cg);
      addGroupToModel(cg);
    } else { // editing existing group
      valueChanged = groupNamesToDrop.length != 0 || groupNamesToAdd.length != 0;
      item = existing;
      setGroupText(item, names);

      for (int i = 0; i < groupNamesToDrop.length; i++) {
        removeIncludedParmSettingsFromSingleGroup(groupNamesToDrop[i], mcg.getConfigParms());
      }
      mcg.setNameArray(groupNamesToArray(names));
      if (null != settings) {
        for (int i = 0; i < groupNamesToAdd.length; i++) {
          TreeItem settingsItem = getSettingsTreeGroup(groupNamesToAdd[i]);
          if (null == settingsItem) {
            settingsItem = new TreeItem(settingsTree, SWT.NONE);
            setGroupText(settingsItem, groupNamesToAdd[i]);
            settingsItem.setData(null);
            fill(mcg.getConfigParms(), settingsItem);
            fill(commonParms, settingsItem);
          } else {
            fillInFrontOfCommon(mcg.getConfigParms(), settingsItem);
          }
        }
      }

    }
View Full Code Here

    // cpd1 = ((CasConsumerDescription)delegate)
    // .getMetaData().getConfigurationParameterDeclarations();
    // else
    // throw new InternalErrorCDE("Invalid state");

    ConfigGroup noGroup = new ConfigGroup(cpd1, ConfigGroup.NOT_IN_ANY_GROUP);
    ConfigGroup commonGroup = new ConfigGroup(cpd1, ConfigGroup.COMMON);

    addDelegateGroupToGUI(parent, noGroup);
    addDelegateGroupToGUI(parent, commonGroup);
    ConfigurationGroup[] cgs = cpd1.getConfigurationGroups();
    if (cgs != null) {
      for (int i = 0; i < cgs.length; i++) {
        addDelegateGroupToGUI(parent, new ConfigGroup(cpd1, cgs[i]));
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.taeconfigurator.model.ConfigGroup

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.