Skip to content
Snippets Groups Projects
Commit c8d3f610 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Continued with the FlowEditor integration; Code Quality

parent 82298e40
No related branches found
No related tags found
No related merge requests found
...@@ -174,10 +174,21 @@ public final class CurrentAnalysisEditorBean { ...@@ -174,10 +174,21 @@ public final class CurrentAnalysisEditorBean {
// No code necessary // No code necessary
} }
/**
* Getter for the attribute {@link CurrentAnalysisEditorBean#projectsBean}.
*
* @return Delivers the value of the attribute.
*/
public ProjectsBean getProjectsBean() { public ProjectsBean getProjectsBean() {
return this.projectsBean; return this.projectsBean;
} }
/**
* Setter for the attribute {@link CurrentAnalysisEditorBean#projectsBean}.
*
* @param projectsBean
* The new value of the attribute.
*/
public void setProjectsBean(final ProjectsBean projectsBean) { public void setProjectsBean(final ProjectsBean projectsBean) {
this.projectsBean = projectsBean; this.projectsBean = projectsBean;
} }
...@@ -485,6 +496,13 @@ public final class CurrentAnalysisEditorBean { ...@@ -485,6 +496,13 @@ public final class CurrentAnalysisEditorBean {
} }
} }
/**
* Searches for input ports within the given class and returns them.
*
* @param clazz
* The class to be analyzed.
* @return A list containing the available input ports.
*/
public List<InputPort> getInputPorts(final Class<?> clazz) { public List<InputPort> getInputPorts(final Class<?> clazz) {
final ArrayList<InputPort> result = new ArrayList<InputPort>(); final ArrayList<InputPort> result = new ArrayList<InputPort>();
...@@ -500,6 +518,13 @@ public final class CurrentAnalysisEditorBean { ...@@ -500,6 +518,13 @@ public final class CurrentAnalysisEditorBean {
return result; return result;
} }
/**
* Searches for output ports within the given class and returns them.
*
* @param clazz
* The class to be analyzed.
* @return A list containing the available output ports.
*/
public List<OutputPort> getOutputPorts(final Class<?> clazz) { public List<OutputPort> getOutputPorts(final Class<?> clazz) {
final ArrayList<OutputPort> result = new ArrayList<OutputPort>(); final ArrayList<OutputPort> result = new ArrayList<OutputPort>();
...@@ -516,6 +541,13 @@ public final class CurrentAnalysisEditorBean { ...@@ -516,6 +541,13 @@ public final class CurrentAnalysisEditorBean {
return result; return result;
} }
/**
* Searches for repository ports within the given class and returns them.
*
* @param clazz
* The class to be analyzed.
* @return A list containing the available repository ports.
*/
public List<RepositoryPort> getRepositoryPorts(final Class<?> clazz) { public List<RepositoryPort> getRepositoryPorts(final Class<?> clazz) {
final ArrayList<RepositoryPort> result = new ArrayList<RepositoryPort>(); final ArrayList<RepositoryPort> result = new ArrayList<RepositoryPort>();
......
...@@ -219,10 +219,21 @@ public final class CurrentAnalysisEditorBeanV2 { ...@@ -219,10 +219,21 @@ public final class CurrentAnalysisEditorBeanV2 {
} }
} }
/**
* Getter for the attribute {@link CurrentAnalysisEditorBeanV2#projectsBean}.
*
* @return Delivers the value of the attribute.
*/
public ProjectsBean getProjectsBean() { public ProjectsBean getProjectsBean() {
return this.projectsBean; return this.projectsBean;
} }
/**
* Setter for the attribute {@link CurrentAnalysisEditorBeanV2#projectsBean}.
*
* @param projectsBean
* The new value of the attribute.
*/
public void setProjectsBean(final ProjectsBean projectsBean) { public void setProjectsBean(final ProjectsBean projectsBean) {
this.projectsBean = projectsBean; this.projectsBean = projectsBean;
} }
...@@ -240,6 +251,9 @@ public final class CurrentAnalysisEditorBeanV2 { ...@@ -240,6 +251,9 @@ public final class CurrentAnalysisEditorBeanV2 {
} }
} }
/**
* This method initializes this bean, based on the project name and everything.
*/
public void initialize() { public void initialize() {
synchronized (this) { synchronized (this) {
this.project = this.projectsBean.openProject(this.projectName); this.project = this.projectsBean.openProject(this.projectName);
...@@ -616,7 +630,7 @@ public final class CurrentAnalysisEditorBeanV2 { ...@@ -616,7 +630,7 @@ public final class CurrentAnalysisEditorBeanV2 {
// Make sure that the graph exists in the first place // Make sure that the graph exists in the first place
context.execute(CurrentAnalysisEditorBeanV2.JS_CMD_INIT_GRAPH); context.execute(CurrentAnalysisEditorBeanV2.JS_CMD_INIT_GRAPH);
// Initialize the listener for the clicks on the components // Initialize the listener for the clicks on the components
context.execute("graph.addListener(\"onClick\", function(node,info,e){document.getElementById('hiddenNode:clickedNodeID').value = node.id;document.getElementById('hiddenNode:link').click();});"); context.execute("graph.addListener(\"onClick\", nodeClickListener);");
// Paint all necessary components // Paint all necessary components
this.initializeGraphPlugins(); this.initializeGraphPlugins();
...@@ -642,20 +656,33 @@ public final class CurrentAnalysisEditorBeanV2 { ...@@ -642,20 +656,33 @@ public final class CurrentAnalysisEditorBeanV2 {
// TODO Now the connections between filters and repositories // TODO Now the connections between filters and repositories
} }
private String clickedNodeID;
private String clickedNodeType;
public void setClickedNodeID(final String id) { public void setClickedNodeID(final String id) {
System.out.println("clicked: " + id); this.clickedNodeID = id;
} }
public String getClickedNodeID() { public String getClickedNodeID() {
return ""; return this.clickedNodeID;
} }
public void setClickedNodeType(final String type) { public void setClickedNodeType(final String type) {
System.out.println("clicked: " + type); this.clickedNodeType = type;
} }
public String getClickedNodeType() { public String getClickedNodeType() {
return ""; return this.clickedNodeType;
}
public void nodeClicked() {
if (this.clickedNodeType.equalsIgnoreCase("Filter") || this.clickedNodeType.equalsIgnoreCase("Reader")) {
// Try to find the ID as a filter/reader
this.setSelectedPlugin(this.pluginMap.get(Integer.parseInt(this.clickedNodeID)));
} else {
// Try to find the ID as a repository
this.setSelectedRepository(this.repositoryMap.get(Integer.parseInt(this.clickedNodeID)));
}
} }
/** /**
......
...@@ -98,10 +98,21 @@ public class CurrentCockpitEditorBean { ...@@ -98,10 +98,21 @@ public class CurrentCockpitEditorBean {
// No code necessary // No code necessary
} }
/**
* Getter for the attribute {@link CurrentCockpitEditorBean#projectsBean}.
*
* @return Delivers the value of the attribute.
*/
public ProjectsBean getProjectsBean() { public ProjectsBean getProjectsBean() {
return this.projectsBean; return this.projectsBean;
} }
/**
* Setter for the attribute {@link CurrentCockpitEditorBean#projectsBean}.
*
* @param projectsBean
* The new value of the attribute.
*/
public void setProjectsBean(final ProjectsBean projectsBean) { public void setProjectsBean(final ProjectsBean projectsBean) {
this.projectsBean = projectsBean; this.projectsBean = projectsBean;
} }
......
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
window.onload = function() { window.onload = function() {
document.getElementById('hidden:link').onclick(); document.getElementById('hidden:link').onclick();
} }
nodeClickListener = function(node, info, e) {
document.getElementById('hiddenNodeProperties:clickedNodeID').value = node.id;
document.getElementById('hiddenNodeProperties:clickedNodeType').value = node.data.$nodeType;
document.getElementById('hiddenNodeProperties:cmdBtnSelection').click();
}
</script> </script>
</h:head> </h:head>
...@@ -36,10 +42,10 @@ ...@@ -36,10 +42,10 @@
<f:ajax event="click" listener="#{currentAnalysisEditorBeanV2.initializeGraph()}" /> <f:ajax event="click" listener="#{currentAnalysisEditorBeanV2.initializeGraph()}" />
</h:commandLink> </h:commandLink>
</h:form> </h:form>
<h:form id="hiddenNode" style="display:none"> <h:form id="hiddenNodeProperties" style="display:none">
<h:inputHidden id="clickedNodeID" value="#{currentAnalysisEditorBeanV2.clickedNodeID}"/> <h:inputHidden id="clickedNodeID" value="#{currentAnalysisEditorBeanV2.clickedNodeID}"/>
<h:inputHidden id="clickedNodeType" value="#{currentAnalysisEditorBeanV2.clickedNodeType}"/> <h:inputHidden id="clickedNodeType" value="#{currentAnalysisEditorBeanV2.clickedNodeType}"/>
<p:commandButton id="link" ajax="true" value="submit"/> <p:commandButton id="cmdBtnSelection" ajax="true" action="#{currentAnalysisEditorBeanV2.nodeClicked()}" update=":propertiesForm" value="submit"/>
</h:form> </h:form>
<p:layout id="layout" fullPage="true"> <p:layout id="layout" fullPage="true">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment