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 {
public abstract void removeController(String controllerName);
public abstract String getFamily(String controllerName);
public abstract String getSubfamily(String controllerName);
public void addConfigurationChangeListener(ServerConfigurationChangeListener listener) {
DataNotificationClient.getInstance().addConfigurationChangeListener(listener);
......
......@@ -24,17 +24,19 @@ public class ClientServantDescriptor {
private String name;
private String type;
private String family;
private String subfamily;
boolean isCommand;
boolean isVisible;
boolean isEnabled;
boolean isFavourite;
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.name = name;
this.type = type;
this.family = family;
this.subfamily = subfamily;
this.isCommand = isCommand;
this.isVisible = isVisible;
this.isEnabled = isEnabled;
......@@ -71,6 +73,10 @@ public class ClientServantDescriptor {
public String getFamily() {
return family;
}
public String getSubfamily() {
return subfamily;
}
public boolean isCommand() {
return isCommand;
......@@ -93,7 +99,7 @@ public class ClientServantDescriptor {
}
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
return servantManager.getPropertiesForGeneric();
}
public String getType(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
......@@ -121,47 +120,60 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
}
return null;
}
public Map getInstalledControllers() {
Map<String, List<String>> installedControllers = new TreeMap<String, List<String>>();
private Map getInstalledControllers(boolean testCommand) {
Map<String, Map<String, List<String>>> installedControllers = new TreeMap<String, Map<String, List<String>>>();
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
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();
List<String> familyMembers = installedControllers.get(family);
String subfamily = descriptor.getSubfamily();
Map<String, List<String>> familyMembers = installedControllers.get(family);
if (familyMembers == null) {
familyMembers = new ArrayList<String>();
familyMembers = new TreeMap<String, List<String>>();
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;
}
public Map getInstalledControllers() {
return getInstalledControllers(false);
}
public Map getInstalledCommands() {
Map<String, List<String>> installedCommands = new TreeMap<String, List<String>>();
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;
return getInstalledControllers(true);
}
......@@ -236,6 +248,14 @@ public class CorbaControllerManager extends ControllerManager implements ServerC
}
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) {
......
......@@ -207,7 +207,8 @@ public class CorbaServantManager {
ClientServantDescriptor descriptor = new ClientServantDescriptor(pbServant.getID(),
pbServant.getName(),
pbServant.getClientType(),
pbServant.getFamily(),
pbServant.getFamily(),
pbServant.getSubfamily(),
pbServant.getCommand(),
pbServant.getVisible(),
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