Commit a081dcad authored by yannick legoc's avatar yannick legoc
Browse files

Implemented family and subfamily default values

family images xml file is in module
parent 9602af20
...@@ -70,6 +70,7 @@ public abstract class ControllerManager { ...@@ -70,6 +70,7 @@ public abstract class ControllerManager {
public abstract void removeController(String controllerName); public abstract void removeController(String controllerName);
public abstract String getFamily(String controllerName); public abstract String getFamily(String controllerName);
public abstract String getSubfamily(String controllerName);
public void addConfigurationChangeListener(ServerConfigurationChangeListener listener) { public void addConfigurationChangeListener(ServerConfigurationChangeListener listener) {
DataNotificationClient.getInstance().addConfigurationChangeListener(listener); DataNotificationClient.getInstance().addConfigurationChangeListener(listener);
......
...@@ -24,17 +24,19 @@ public class ClientServantDescriptor { ...@@ -24,17 +24,19 @@ public class ClientServantDescriptor {
private String name; private String name;
private String type; private String type;
private String family; private String family;
private String subfamily;
boolean isCommand; boolean isCommand;
boolean isVisible; boolean isVisible;
boolean isEnabled; boolean isEnabled;
boolean isFavourite; boolean isFavourite;
boolean isRoot; boolean isRoot;
public ClientServantDescriptor(int ID, String name, String type, String family, boolean isCommand, boolean isVisible, boolean isEnabled, boolean isFavourite, boolean isRoot) { public ClientServantDescriptor(int ID, String name, String type, String family, String subfamily, boolean isCommand, boolean isVisible, boolean isEnabled, boolean isFavourite, boolean isRoot) {
this.id = ID; this.id = ID;
this.name = name; this.name = name;
this.type = type; this.type = type;
this.family = family; this.family = family;
this.subfamily = subfamily;
this.isCommand = isCommand; this.isCommand = isCommand;
this.isVisible = isVisible; this.isVisible = isVisible;
this.isEnabled = isEnabled; this.isEnabled = isEnabled;
...@@ -71,6 +73,10 @@ public class ClientServantDescriptor { ...@@ -71,6 +73,10 @@ public class ClientServantDescriptor {
public String getFamily() { public String getFamily() {
return family; return family;
} }
public String getSubfamily() {
return subfamily;
}
public boolean isCommand() { public boolean isCommand() {
return isCommand; return isCommand;
...@@ -93,7 +99,7 @@ public class ClientServantDescriptor { ...@@ -93,7 +99,7 @@ public class ClientServantDescriptor {
} }
public String toString() { public String toString() {
return "ClientServantDescriptor " + type + " " + name + " : enabled = " + isEnabled + " visible = " + isVisible + " favourite = " + isFavourite; return "ClientServantDescriptor " + type + " " + name + " : enabled = " + isEnabled + " visible = " + isVisible + " favourite = " + isFavourite + " family = " + family + " subfamily = " + subfamily;
} }
} }
\ No newline at end of file
...@@ -112,8 +112,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC ...@@ -112,8 +112,7 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
return servantManager.getPropertiesForGeneric(); return servantManager.getPropertiesForGeneric();
} }
public String getType(String controllerName) { public String getType(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName); ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) { if (descriptor != null) {
...@@ -121,47 +120,60 @@ public class CorbaControllerManager extends ControllerManager implements ServerC ...@@ -121,47 +120,60 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
} }
return null; return null;
} }
public Map getInstalledControllers() { private Map getInstalledControllers(boolean testCommand) {
Map<String, List<String>> installedControllers = new TreeMap<String, List<String>>();
Map<String, Map<String, List<String>>> installedControllers = new TreeMap<String, Map<String, List<String>>>();
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator(); Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) { while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next(); ClientServantDescriptor descriptor = it.next();
if (descriptor.isEnabled() && descriptor.isVisible()) {
boolean testCommandOk = true;
if (testCommand && !descriptor.isCommand()) {
testCommandOk = false;
}
if (testCommandOk && descriptor.isEnabled() && descriptor.isVisible()) {
String family = descriptor.getFamily(); String family = descriptor.getFamily();
List<String> familyMembers = installedControllers.get(family); String subfamily = descriptor.getSubfamily();
Map<String, List<String>> familyMembers = installedControllers.get(family);
if (familyMembers == null) { if (familyMembers == null) {
familyMembers = new ArrayList<String>(); familyMembers = new TreeMap<String, List<String>>();
installedControllers.put(family, familyMembers); installedControllers.put(family, familyMembers);
} }
familyMembers.add(descriptor.getName());
if (subfamily.equals("none")) {
familyMembers.put(descriptor.getName(), new ArrayList<String>());
} else {
List<String> subfamilyMembers = familyMembers.get(subfamily);
if (subfamilyMembers == null) {
subfamilyMembers = new ArrayList<String>();
familyMembers.put(subfamily, subfamilyMembers);
}
subfamilyMembers.add(descriptor.getName());
}
} }
} }
return installedControllers; return installedControllers;
} }
public Map getInstalledControllers() {
return getInstalledControllers(false);
}
public Map getInstalledCommands() { public Map getInstalledCommands() {
Map<String, List<String>> installedCommands = new TreeMap<String, List<String>>(); return getInstalledControllers(true);
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
if (descriptor.isCommand() && descriptor.isEnabled() && descriptor.isVisible()) {
String family = descriptor.getFamily();
List familyMembers = installedCommands.get(family);
if (familyMembers == null) {
familyMembers = new ArrayList();
installedCommands.put(family, familyMembers);
}
familyMembers.add(descriptor.getName());
}
}
return installedCommands;
} }
...@@ -236,6 +248,14 @@ public class CorbaControllerManager extends ControllerManager implements ServerC ...@@ -236,6 +248,14 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
} }
return null; return null;
} }
public String getSubfamily(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
return descriptor.getSubfamily();
}
return null;
}
public LinkedHashSet<String> getControllersOfTypeInDisplayOrder(String controllerType, boolean onlyVisibleOnes) { public LinkedHashSet<String> getControllersOfTypeInDisplayOrder(String controllerType, boolean onlyVisibleOnes) {
......
...@@ -207,7 +207,8 @@ public class CorbaServantManager { ...@@ -207,7 +207,8 @@ public class CorbaServantManager {
ClientServantDescriptor descriptor = new ClientServantDescriptor(pbServant.getID(), ClientServantDescriptor descriptor = new ClientServantDescriptor(pbServant.getID(),
pbServant.getName(), pbServant.getName(),
pbServant.getClientType(), pbServant.getClientType(),
pbServant.getFamily(), pbServant.getFamily(),
pbServant.getSubfamily(),
pbServant.getCommand(), pbServant.getCommand(),
pbServant.getVisible(), pbServant.getVisible(),
pbServant.getEnabled(), pbServant.getEnabled(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment