diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java index 1aa8fa9120e43dae2c8447bb09ced0170b81dc99..c29d6b7f40e6659b001b1a7d8738ae9b4375067a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java @@ -25,6 +25,10 @@ import java.util.Map; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + +import kieker.webgui.beans.application.ThemeSwitcherBean; /** * This bean can be used for a single session of a user and stores the currently used theme (look and feel) for this user. Currently the default value being used is @@ -61,6 +65,13 @@ public class CurrentThemeBean { /* Use the default theme. */ this.theme = CurrentThemeBean.DEFAULT_THEME; } + + /* Try to find the cookie for the theme. */ + final Map<String, Object> cookies = FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap(); + + if (cookies.containsKey("theme")) { + this.theme = ((Cookie) cookies.get("theme")).getValue(); + } } /** @@ -80,5 +91,11 @@ public class CurrentThemeBean { */ public final void setTheme(final String theme) { this.theme = theme; + + /* Set the cookie theme. */ + final Cookie cookie = new Cookie("theme", theme); + + final HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addCookie(cookie); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java index 649189664e94fac0edc74ed4ba0038f4fd683fa7..21ac75fe2ec01c4a5b9e48dc4edcecb99f5c266a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java @@ -51,6 +51,7 @@ import kieker.webgui.common.Connection; import kieker.webgui.common.FileManager; import kieker.webgui.common.PluginClassLoader; import kieker.webgui.common.PluginFinder; +import kieker.webgui.converter.MIPluginToStringConverter; import org.eclipse.emf.common.util.EList; @@ -340,6 +341,10 @@ public class SelectedMainProjectBean { * This method "submits" the current connections to the main project (In other words: The connections will be stored within the main project). */ public void submitConnections() { - // TODO: Implement + for (final Connection connection : connections) { + if (connection.isValid()) { + connection.getOutputPort().getSubscribers().add(connection.getInputPort()); + } + } } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java index 5b6ca329b1f93c49fe4d38774cb09d08bb8b5e5e..e317cef73b2fefba229349ea8306e622b3f64e5e 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java @@ -20,6 +20,7 @@ package kieker.webgui.common; +import kieker.analysis.model.analysisMetaModel.MIAnalysisPlugin; import kieker.analysis.model.analysisMetaModel.MIInputPort; import kieker.analysis.model.analysisMetaModel.MIOutputPort; import kieker.analysis.model.analysisMetaModel.MIPlugin; diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..e54843940335e1de2697b5e60432e1331182402e --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java @@ -0,0 +1,44 @@ +package kieker.webgui.converter; + +import java.util.concurrent.ConcurrentHashMap; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.FacesConverter; +import kieker.analysis.model.analysisMetaModel.MIPlugin; +import kieker.analysis.model.analysisMetaModel.MIPort; + +/** + * + * @author Nils Christian Ehmke + */ +@FacesConverter(value = MIPortToStringConverter.NAME) +public class MIPortToStringConverter implements Converter { + /** + * This is the name of this converter. + */ + public static final String NAME = "kieker.webgui.converter.MIPortToStringConverter"; + /** + * This field stores the mapping. + */ + private static ConcurrentHashMap<String, MIPort> map = new ConcurrentHashMap<String, MIPort>(); + + /** + * Creates a new instance of this class. + */ + public MIPortToStringConverter() { + /* No code necessary. */ + } + + @Override + public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { + return MIPortToStringConverter.map.get(string); + } + + @Override + public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { + final String result = o.toString(); + MIPortToStringConverter.map.put(result, (MIPort) o); + return result; + } +} diff --git a/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml b/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml index 85bb469c1a44d119177f8f6209ea744157033e2a..00356efc8fea1ad1038d93d012d5dd129fdbccb7 100644 --- a/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml +++ b/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml @@ -26,6 +26,23 @@ var="plugin" itemLabel="#{plugin.name}" itemValue="#{plugin}"/> + <p:ajax event="change" update=":connectionDialogForm"></p:ajax> + </h:selectOneMenu> + </f:facet> + </p:cellEditor> + </p:column> + + <p:column headerText="Output Port" style="width: 125px"> + <p:cellEditor> + <f:facet name="output" rendered="#{not empty connection.outputPort}"> + <h:outputText value="#{connection.outputPort.name}"/> + </f:facet> + <f:facet name="input"> + <h:selectOneMenu converter="kieker.webgui.converter.MIPortToStringConverter" value="#{connection.outputPort}"> + <f:selectItems value="#{connection.source.outputPorts}" + var="port" + itemLabel="#{port.name}" + itemValue="#{port}"/> </h:selectOneMenu> </f:facet> </p:cellEditor> @@ -33,7 +50,7 @@ <p:column headerText="Destination" style="width:125px"> <p:cellEditor> - <f:facet name="output"> + <f:facet name="output" rendered="#{not empty connection.destination}"> <h:outputText value="#{connection.destination.name}"/> </f:facet> <f:facet name="input"> @@ -42,18 +59,31 @@ var="plugin" itemLabel="#{plugin.name}" itemValue="#{plugin}"/> + <p:ajax event="change" update=":connectionDialogForm"></p:ajax> + </h:selectOneMenu> + </f:facet> + </p:cellEditor> + </p:column> + + <p:column headerText="Input Port" style="width: 125px"> + <p:cellEditor> + <f:facet name="output" rendered="#{not empty connection.inputPort}"> + <h:outputText value="#{connection.inputPort.name}"/> + </f:facet> + <f:facet name="input"> + <h:selectOneMenu converter="kieker.webgui.converter.MIPortToStringConverter" value="#{connection.inputPort}"> + <f:selectItems value="#{connection.destination.inputPorts}" + var="port" + itemLabel="#{port.name}" + itemValue="#{port}"/> </h:selectOneMenu> </f:facet> </p:cellEditor> </p:column> - <p:column headerText="Valid" style="width:50px"> - <c:if test="#{connection.valid}"> - <h:outputText value="True"/> - </c:if> - <c:otherwise> - <h:outputText value="False"/> - </c:otherwise> + <p:column headerText="Valid" style="width:50px" > + <h:outputText rendered="#{connection.valid}" value="True"/> + <h:outputText rendered="#{not connection.valid}" value="False"/> </p:column> <p:column headerText="Options" style="width:50px">