Module category support added.
This commit is contained in:
parent
ef1af2e96c
commit
35edd35039
Binary file not shown.
|
@ -6,6 +6,7 @@ import java.util.UUID;
|
|||
public class Module {
|
||||
private UUID id;
|
||||
private String name;
|
||||
private String category;
|
||||
private Set<ModuleConfiguration> configurations;
|
||||
|
||||
public UUID getId() {
|
||||
|
@ -24,6 +25,14 @@ public class Module {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Set<ModuleConfiguration> getConfigurations() {
|
||||
return configurations;
|
||||
}
|
||||
|
|
|
@ -11,4 +11,6 @@ public @interface Module {
|
|||
String id();
|
||||
|
||||
String name();
|
||||
|
||||
String category();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import haflow.module.Module;
|
|||
import haflow.module.ModuleConfiguration;
|
||||
import haflow.module.ModuleMetadata;
|
||||
|
||||
@Module(id = "70d027c3-a4bd-61b5-5063-134ff71f8122", name = "End")
|
||||
@ModuleConfiguration(configurationKeys = { "aaa" }, configurationDisplayNames = { "bbb" })
|
||||
@Module(id = "70d027c3-a4bd-61b5-5063-134ff71f8122", name = "End", category = "Basic")
|
||||
@ModuleConfiguration(configurationKeys = { "ccc" }, configurationDisplayNames = { "ddd" })
|
||||
public class EndModule implements ModuleMetadata {
|
||||
|
||||
public Document generate(Map<String, String> configurations) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import haflow.module.Module;
|
|||
import haflow.module.ModuleConfiguration;
|
||||
import haflow.module.ModuleMetadata;
|
||||
|
||||
@Module(id = "9208d7d2-a8ff-2493-64c2-36f50bc95752", name = "Start")
|
||||
@Module(id = "9208d7d2-a8ff-2493-64c2-36f50bc95752", name = "Start", category = "Basic")
|
||||
@ModuleConfiguration(configurationKeys = { "aaa" }, configurationDisplayNames = { "bbb" })
|
||||
public class StartModule implements ModuleMetadata {
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package haflow.module.general;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import haflow.module.Module;
|
||||
import haflow.module.ModuleConfiguration;
|
||||
import haflow.module.ModuleMetadata;
|
||||
|
||||
@Module(id = "5da600a8-aa63-968a-ca46-9085e0e0bd2e", name = "Java", category = "General")
|
||||
@ModuleConfiguration(configurationKeys = { "eee" }, configurationDisplayNames = { "fff" })
|
||||
public class JavaModule implements ModuleMetadata {
|
||||
|
||||
public Document generate(Map<String, String> configurations) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -36,6 +36,7 @@ public class ModuleHelper {
|
|||
ModuleBriefModel moduleBriefModel = new ModuleBriefModel();
|
||||
moduleBriefModel.setId(module.getId());
|
||||
moduleBriefModel.setName(module.getName());
|
||||
moduleBriefModel.setCategory(module.getCategory());
|
||||
moduleBriefModel
|
||||
.setConfigurations(new HashSet<ConfigurationModel>());
|
||||
for (ModuleConfiguration configuration : module.getConfigurations()) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
public class ModuleBriefModel {
|
||||
private UUID id;
|
||||
private String name;
|
||||
private String category;
|
||||
private Set<ConfigurationModel> configurations;
|
||||
|
||||
@XmlElement
|
||||
|
@ -31,6 +32,15 @@ public class ModuleBriefModel {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "configurations")
|
||||
@XmlElement(name = "configuration")
|
||||
public Set<ConfigurationModel> getConfigurations() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
public class ModuleModel {
|
||||
private UUID id;
|
||||
private String name;
|
||||
private String category;
|
||||
private Set<ConfigurationModel> configurations;
|
||||
|
||||
@XmlElement
|
||||
|
@ -30,7 +31,16 @@ public class ModuleModel {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@XmlElement
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "configurations")
|
||||
@XmlElement(name = "configuration")
|
||||
public Set<ConfigurationModel> getConfigurations() {
|
||||
|
|
|
@ -33,8 +33,7 @@ public class ModuleLoader {
|
|||
"haflow", true);
|
||||
for (String className : classNames) {
|
||||
Class<?> moduleClass = Class.forName(className);
|
||||
if (moduleClass
|
||||
.isAnnotationPresent(haflow.module.Module.class)) {
|
||||
if (moduleClass.isAnnotationPresent(haflow.module.Module.class)) {
|
||||
Object obj = moduleClass.newInstance();
|
||||
if (obj instanceof ModuleMetadata) {
|
||||
ModuleMetadata metadata = (ModuleMetadata) obj;
|
||||
|
@ -43,6 +42,8 @@ public class ModuleLoader {
|
|||
haflow.module.Module.class).id()));
|
||||
module.setName(moduleClass.getAnnotation(
|
||||
haflow.module.Module.class).name());
|
||||
module.setCategory(moduleClass.getAnnotation(
|
||||
haflow.module.Module.class).category());
|
||||
module.setConfigurations(new HashSet<ModuleConfiguration>());
|
||||
if (moduleClass
|
||||
.isAnnotationPresent(haflow.module.ModuleConfiguration.class)) {
|
||||
|
|
|
@ -52,7 +52,6 @@ HAFlow.Main.prototype.initFlowListData = function() {
|
|||
dataType : "json",
|
||||
success : function(data, status) {
|
||||
_currentInstance.flowList = data;
|
||||
|
||||
_currentInstance.initModuleListData();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
|
@ -96,7 +95,6 @@ HAFlow.Main.prototype.initUserInterface = function() {
|
|||
this.initMainMenu();
|
||||
this.initBottomTabs();
|
||||
this.initFlowList();
|
||||
this.initModuleList();
|
||||
this.ui.refresh();
|
||||
};
|
||||
|
||||
|
@ -256,14 +254,6 @@ HAFlow.Main.prototype.initFlowListTree = function() {
|
|||
tree.startup();
|
||||
};
|
||||
|
||||
HAFlow.Main.prototype.initModuleList = function() {
|
||||
var moduleListPane = new dijit.layout.ContentPane({
|
||||
id : this.moduleListContainerId,
|
||||
title : "Modules"
|
||||
});
|
||||
this.ui.trailingContainer.addChild(moduleListPane);
|
||||
};
|
||||
|
||||
HAFlow.Main.prototype.initFlowContainer = function() {
|
||||
var _currentInstance = this;
|
||||
this.ui.centerContainer.watch("selectedChildWidget", function(name, from,
|
||||
|
@ -366,14 +356,26 @@ HAFlow.Main.prototype.saveFlowName = function(instance, flowId) {
|
|||
};
|
||||
|
||||
HAFlow.Main.prototype.paintModuleList = function() {
|
||||
var text = "";
|
||||
var i;
|
||||
for (i = 0; i < this.moduleList.modules.length; i++) {
|
||||
text += "<div class=\"module\" id=\"module_"
|
||||
if (dijit.byId(this.moduleListContainerId + "_"
|
||||
+ this.moduleList.modules[i].category) == null) {
|
||||
var moduleListPane = new dijit.layout.ContentPane({
|
||||
id : this.moduleListContainerId + "_"
|
||||
+ this.moduleList.modules[i].category,
|
||||
title : this.moduleList.modules[i].category
|
||||
});
|
||||
this.ui.trailingContainer.addChild(moduleListPane);
|
||||
}
|
||||
text = "<div class=\"module\" id=\"module_"
|
||||
+ this.moduleList.modules[i].id + "\"><div>"
|
||||
+ this.moduleList.modules[i].name + "</div></div>";
|
||||
$(
|
||||
"#" + this.moduleListContainerId + "_"
|
||||
+ this.moduleList.modules[i].category).append(text);
|
||||
}
|
||||
$("#" + this.moduleListContainerId).html(text);
|
||||
this.ui.refresh();
|
||||
|
||||
};
|
||||
|
||||
HAFlow.Main.prototype.onModuleAdded = function(instance, flowId, event, ui) {
|
||||
|
|
Loading…
Reference in New Issue