/* enable or disable fields depending on whether we are in browse/edit or add mode */ public void setAddMode(boolean adding, String selectedTab) { lbxItems.setDisabled(adding); if (selectedTab.equals("tabCategories")) { lbxSubCatItems.setDisabled(adding); btnAddSubCat.setDisabled(adding); btnRemoveSubCat.setDisabled(adding); disableInputFields(!adding); disableSubCatButtons(adding); _sb.setCategoryMembers(null); } if (adding) clearTextFields(); txtName.setText(""); lblMembers.setText("Members (0)"); }
/* adds a new subcategory - triggered by categories tab only */ public String btnConfirmAddSubCat_action() { String name = (String) txtSubCat.getText(); if ((name != null) && (name.length() > 0)) { NonHumanCategory category = getCurrentlySelectedCategory(); if (category != null) { if (category.addSubCategory(name)) { // won't add if duplicate _orgDataSet.updateNonHumanCategory(category); _sb.setSubCatAddMode(false); txtSubCat.setText(null); } else _msgPanel.error("Subcategory already exists: " + name); } } else _msgPanel.error("Please enter a subcategory to add."); return null; }
private void populateSimpleFields(String name, String desc, String notes) { txtName.setText(name); txtDesc.setText(desc); txtNotes.setText(notes); }