예제 #1
0
 protected void disableInputFields(boolean disable) {
   txtName.setDisabled(disable);
   txtDesc.setDisabled(disable);
   txtNotes.setDisabled(disable);
   cbbMembers.setDisabled(disable);
   cbbCategory.setDisabled(disable);
   cbbSubCategory.setDisabled(disable);
   btnAddSubCat.setDisabled(disable);
   btnRemoveSubCat.setDisabled(disable || subCatUnremovable());
 }
예제 #2
0
  /* sets or hides fields depending on which tab is shown */
  public void setVisibleComponents(nonHumanMgt.SelType sType) {
    boolean catTab = (sType == nonHumanMgt.SelType.category);

    // these only appear on the resources tab
    cbbCategory.setVisible(!catTab);
    lblSubCategory.setVisible(!catTab);
    cbbSubCategory.setVisible(!catTab);

    // these only appear on the categories tab
    lblMembers.setVisible(catTab);
    cbbMembers.setVisible(catTab);
    lbxSubCatItems.setVisible(catTab);
    btnAddSubCat.setVisible(catTab);
    btnRemoveSubCat.setVisible(catTab);

    // nullify lists
    if (catTab) {
      cbbCategory.setItems(null);
      cbbSubCategory.setItems(null);
    } else lbxSubCatItems.setItems(null);
  }
예제 #3
0
  /* saves a newly added resource to the org database */
  public boolean addResource(String name) {
    if (!_orgDataSet.isKnownNonHumanResourceName(name)) {
      String catID = (String) cbbCategory.getSelected();
      NonHumanCategory category = _orgDataSet.getNonHumanCategory(catID);
      String subCat = (String) cbbSubCategory.getSelected();

      NonHumanResource resource = _sb.getSelectedNonHumanResource();
      if (resource == null) resource = new NonHumanResource();
      resource.setName(name);
      resource.setCategory(category);
      resource.setSubCategory(subCat);
      resource.setDescription((String) txtDesc.getText());
      resource.setNotes((String) txtNotes.getText());
      String newID = _orgDataSet.addNonHumanResource(resource);
      if (_rm.successful(newID)) {
        updateSelectedResource(resource, false);
        _sb.setNhResourcesChoice(newID);
        return true;
      } else _msgPanel.error(_msgPanel.format(newID));
    } else addDuplicationError("Resource");

    return false;
  }
예제 #4
0
  /* fills ui with the selected resource's values */
  private void populateGUI(NonHumanResource resource, String id) {

    // selected resource is null after a selection change
    if (resource == null) {
      resource = _orgDataSet.getNonHumanResource(id);
      updateSelectedResource(resource);
    }
    if (resource != null) {
      populateSimpleFields(resource);
      NonHumanCategory category = resource.getCategory();
      String subCatName = resource.getSubCategoryName();
      if (category == null) {
        category = getFirstListedCategory(); // default
      }
      if (subCatName == null) subCatName = "None";
      if (category != null) {
        cbbCategory.setSelected(category.getID());
        _sb.setNhResourcesSubcategoryItems(getSubCategoryList(category));
        cbbSubCategory.setSelected(subCatName);
      } else _sb.setNhResourcesSubcategoryItems(null); // no categories defined
    }
    _sb.setNhResourcesSubcategoryList(null); // empty the category tab list box
  }
예제 #5
0
 protected void clearCombos() {
   cbbCategory.setSelected(null);
   cbbSubCategory.setSelected(null);
   cbbCategory.setItems(null);
   cbbSubCategory.setItems(null);
 }