summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/ibm/ServerWizard2/ServerWizard2.java2
-rw-r--r--src/com/ibm/ServerWizard2/controller/TargetWizardController.java9
-rw-r--r--src/com/ibm/ServerWizard2/model/Attribute.java9
-rw-r--r--src/com/ibm/ServerWizard2/model/SystemModel.java28
-rw-r--r--src/com/ibm/ServerWizard2/model/Target.java22
-rw-r--r--src/com/ibm/ServerWizard2/view/MainDialog.java37
6 files changed, 81 insertions, 26 deletions
diff --git a/src/com/ibm/ServerWizard2/ServerWizard2.java b/src/com/ibm/ServerWizard2/ServerWizard2.java
index e469616..130b533 100644
--- a/src/com/ibm/ServerWizard2/ServerWizard2.java
+++ b/src/com/ibm/ServerWizard2/ServerWizard2.java
@@ -23,7 +23,7 @@ public class ServerWizard2 {
*/
public final static Logger LOGGER = Logger.getLogger(ServerWizard2.class.getName());
public final static int VERSION_MAJOR = 2;
- public final static int VERSION_MINOR = 2;
+ public final static int VERSION_MINOR = 10;
public final static String PROPERTIES_FILE = "serverwiz.preferences";
public static String GIT_LOCATION = "";
diff --git a/src/com/ibm/ServerWizard2/controller/TargetWizardController.java b/src/com/ibm/ServerWizard2/controller/TargetWizardController.java
index ad033d0..dc22f74 100644
--- a/src/com/ibm/ServerWizard2/controller/TargetWizardController.java
+++ b/src/com/ibm/ServerWizard2/controller/TargetWizardController.java
@@ -6,6 +6,7 @@ import java.io.InputStreamReader;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
+import java.util.TreeMap;
import java.util.Vector;
import org.apache.logging.log4j.Level;
@@ -41,6 +42,10 @@ public class TargetWizardController {
return this.modelCreationMode;
}
+ public TreeMap<String,Boolean> getAttributeFilters() {
+ return model.getAttributeFilters();
+ }
+
public void init() {
try {
String libraryLocation = ServerWizard2.GIT_LOCATION + File.separator + this.LIBRARY_NAME;
@@ -81,8 +86,8 @@ public class TargetWizardController {
public void deleteTarget(Target target) {
model.deleteTarget(target);
}
- public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path) {
- return model.getAttributesAndGlobals(targetInstance, path, !this.modelCreationMode);
+ public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path, String filter) {
+ return model.getAttributesAndGlobals(targetInstance, path, !this.modelCreationMode, filter);
}
public void addTargetInstance(Target targetModel, Target parentTarget,
diff --git a/src/com/ibm/ServerWizard2/model/Attribute.java b/src/com/ibm/ServerWizard2/model/Attribute.java
index 17b346c..b0eaecb 100644
--- a/src/com/ibm/ServerWizard2/model/Attribute.java
+++ b/src/com/ibm/ServerWizard2/model/Attribute.java
@@ -7,6 +7,7 @@ import org.w3c.dom.Node;
public class Attribute implements java.io.Serializable {
private static final long serialVersionUID = 1L;
+ public String show = "";
public String name = "";
public String group = "";
public AttributeValue value;
@@ -31,6 +32,7 @@ public class Attribute implements java.io.Serializable {
public Attribute(Attribute a) {
this.name = a.name;
+ this.show = a.show;
this.desc = a.desc;
this.group = a.group;
this.persistency = a.persistency;
@@ -123,12 +125,11 @@ public class Attribute implements java.io.Serializable {
if (SystemModel.isElementDefined(attribute,"writeable")) {
writeable=true;
}
- if (SystemModel.isElementDefined(attribute,"serverwizHide") ||
- name.equals("MODEL") || name.equals("TYPE") || name.equals("CLASS")) {
+ if (name.equals("MODEL") || name.equals("TYPE") || name.equals("CLASS")) {
hide=true;
}
- if (SystemModel.isElementDefined(attribute,"serverwizReadonly")) {
- readonly=true;
+ if (SystemModel.isElementDefined(attribute,"serverwizShow")) {
+ show = SystemModel.getElement(attribute, "serverwizShow");
}
Node simpleType = attribute.getElementsByTagName("simpleType").item(0);
if (simpleType!=null) {
diff --git a/src/com/ibm/ServerWizard2/model/SystemModel.java b/src/com/ibm/ServerWizard2/model/SystemModel.java
index 9038239..2c160ec 100644
--- a/src/com/ibm/ServerWizard2/model/SystemModel.java
+++ b/src/com/ibm/ServerWizard2/model/SystemModel.java
@@ -48,6 +48,7 @@ public class SystemModel {
private HashMap<String, Attribute> attributes = new HashMap<String, Attribute>();
private TreeMap<String, Vector<String>> attributeGroups = new TreeMap<String, Vector<String>>();
private TreeMap<String, Errata> errata = new TreeMap<String, Errata>();
+ private TreeMap<String, Boolean> attributeFilters = new TreeMap<String, Boolean>();
// List of targets in current system
private Vector<Target> targetList = new Vector<Target>();
@@ -68,7 +69,11 @@ public class SystemModel {
public Vector<Target> getBusTypes() {
return busTypes;
}
+ public TreeMap<String,Boolean> getAttributeFilters() {
+ return this.attributeFilters;
+ }
+
public Target getTarget(String t) {
return targetLookup.get(t);
}
@@ -525,11 +530,11 @@ public class SystemModel {
* Returns a vector of attributes located in the target and global settings
* associated with a particular target instance
*/
- public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path, Boolean showGlobalSettings) {
+ public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path, Boolean showGlobalSettings, String filter) {
Vector<Field> attributes = new Vector<Field>();
for (Map.Entry<String, Attribute> entry : targetInstance.getAttributes().entrySet()) {
Attribute attribute = entry.getValue();
- if (!attribute.isHidden()) {
+ if (attribute.show.equals(filter) || filter.isEmpty()) {
if (attribute.isGlobal() && showGlobalSettings) {
if (!path.isEmpty()) {
Field field = getGlobalSetting(path, attribute.name);
@@ -666,10 +671,12 @@ public class SystemModel {
}
grp.add(a.name);
}
-
if (a.getValue().getType().equals("enumeration")) {
a.getValue().setEnumerator(enumerations.get(a.value.getFields().get(0).name));
}
+ if (!a.show.isEmpty()) {
+ this.attributeFilters.put(a.show,true);
+ }
}
}
@@ -841,13 +848,16 @@ public class SystemModel {
/////////////////////////////////////////////////////////////////
// Utility static methods
public static String getElement(Element a, String e) {
- Node n = a.getElementsByTagName(e).item(0);
- if (n != null) {
- Node cn = n.getChildNodes().item(0);
- if (cn == null) {
- return "";
+ NodeList nl = a.getChildNodes();
+ for (int i=0;i<nl.getLength();i++){
+ Node n = nl.item(i);
+ if (n.getNodeName().equals(e)) {
+ Node cn = n.getChildNodes().item(0);
+ if (cn == null) {
+ return "";
+ }
+ return cn.getNodeValue();
}
- return cn.getNodeValue();
}
return "";
}
diff --git a/src/com/ibm/ServerWizard2/model/Target.java b/src/com/ibm/ServerWizard2/model/Target.java
index 2641380..5691062 100644
--- a/src/com/ibm/ServerWizard2/model/Target.java
+++ b/src/com/ibm/ServerWizard2/model/Target.java
@@ -350,18 +350,26 @@ public class Target implements Comparable<Target>, java.io.Serializable {
parentType.add(e.getChildNodes().item(0).getNodeValue());
}
NodeList attributeList = target.getElementsByTagName("attribute");
+ boolean aerror = false;
for (int i = 0; i < attributeList.getLength(); ++i) {
String attrId = SystemModel.getElement((Element) attributeList.item(i), "id");
Attribute attributeLookup = attrMap.get(attrId);
if (attributeLookup == null) {
- throw new NullPointerException("Invalid attribute id: " + attrId + "(" + type + ")");
- }
- Attribute a = new Attribute(attributeLookup);
- if (a.value==null) {
- throw new NullPointerException("Unknown attribute value type: " + attrId + "(" + type + ")");
+ aerror = true;
+ System.out.println("Invalid attribute id: " + attrId + "(" + type + ")");
+ } else {
+ Attribute a = new Attribute(attributeLookup);
+ if (a.value==null) {
+ aerror = true;
+ System.out.println("Unknown attribute value type: " + attrId + "(" + type + ")");
+ } else {
+ attributes.put(a.name, a);
+ a.value.readInstanceXML((Element) attributeList.item(i));
+ }
}
- attributes.put(a.name, a);
- a.value.readInstanceXML((Element) attributeList.item(i));
+ }
+ if (aerror == true) {
+ throw new NullPointerException("Attribute import error");
}
}
diff --git a/src/com/ibm/ServerWizard2/view/MainDialog.java b/src/com/ibm/ServerWizard2/view/MainDialog.java
index 9e277e9..17a076a 100644
--- a/src/com/ibm/ServerWizard2/view/MainDialog.java
+++ b/src/com/ibm/ServerWizard2/view/MainDialog.java
@@ -114,10 +114,12 @@ public class MainDialog extends Dialog {
private Composite compositeDir;
private Button btnHideBusses;
private Button btnShowHidden;
+ private Combo showFilter;
private AttributeEditingSupport attributeEditor;
private Label label;
private Label label_1;
+ private Composite composite_1;
/**
* Create the dialog.
*
@@ -206,13 +208,23 @@ public class MainDialog extends Dialog {
+ "Select and Instance type. You can optionally enter a custom name. Then click 'Add Instance' button.");
columnName.setResizable(true);
+
+ composite_1 = new Composite(sashForm_1, SWT.NONE);
+
+ showFilter = new Combo(composite_1, SWT.READ_ONLY);
+ showFilter.setFont(SWTResourceManager.getFont("Arial", 9, SWT.READ_ONLY));
+ showFilter.setBounds(118, 0, 336, 23);
+
+ Label lblAttributeFilter = new Label(composite_1, SWT.NONE);
+ lblAttributeFilter.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
+ lblAttributeFilter.setBounds(15, 3, 97, 15);
+ lblAttributeFilter.setText("Attribute Filter:");
// Create attribute table
viewer = new TableViewer(sashForm_1, SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.FULL_SELECTION | SWT.BORDER);
this.createAttributeTable();
- sashForm_1.setWeights(new int[] { 1, 1 });
// //////////////////////////////////////////////////////////
// Tab folders
@@ -374,6 +386,14 @@ public class MainDialog extends Dialog {
this.initInstanceMode();
sashForm.setWeights(new int[] { 1, 1 });
columnName.pack();
+ sashForm_1.setWeights(new int[] {302, 37, 171});
+
+ showFilter.removeAll();
+ showFilter.add("");
+ for (String a : controller.getAttributeFilters().keySet()) {
+ showFilter.add(a);
+ }
+
return container;
}
@@ -693,7 +713,12 @@ public class MainDialog extends Dialog {
//A target is selected so show the associated attributes
TreeItem item = tree.getSelection()[0];
ConnectionEndpoint ep = this.getEndpoint(item, null);
- attributes = controller.getAttributesAndGlobals(targetInstance, "/"+ep.getName());
+ int s = showFilter.getSelectionIndex();
+ String show = "";
+ if (s>-1) {
+ show = showFilter.getItem(s);
+ }
+ attributes = controller.getAttributesAndGlobals(targetInstance, "/"+ep.getName(),show);
viewer.setInput(attributes);
viewer.refresh();
@@ -1077,6 +1102,12 @@ public class MainDialog extends Dialog {
}
private void addEvents() {
+ showFilter.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ updateView();
+ }
+ });
btnShowHidden.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
@@ -1212,7 +1243,7 @@ public class MainDialog extends Dialog {
public void widgetSelected(SelectionEvent arg0) {
if (listBusses.getSelectionCount() > 0) {
Connection conn = (Connection) listBusses.getData(listBusses.getSelection()[0]);
- attributes = controller.getAttributesAndGlobals(conn.busTarget, "");
+ attributes = controller.getAttributesAndGlobals(conn.busTarget, "","");
viewer.setInput(attributes);
viewer.refresh();
}
OpenPOWER on IntegriCloud