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

Continued with the connections.

parent 7aceb13f
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,10 @@ import java.util.Map; ...@@ -25,6 +25,10 @@ import java.util.Map;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped; import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext; 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 * 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 { ...@@ -61,6 +65,13 @@ public class CurrentThemeBean {
/* Use the default theme. */ /* Use the default theme. */
this.theme = CurrentThemeBean.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 { ...@@ -80,5 +91,11 @@ public class CurrentThemeBean {
*/ */
public final void setTheme(final String theme) { public final void setTheme(final String theme) {
this.theme = 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);
} }
} }
...@@ -51,6 +51,7 @@ import kieker.webgui.common.Connection; ...@@ -51,6 +51,7 @@ import kieker.webgui.common.Connection;
import kieker.webgui.common.FileManager; import kieker.webgui.common.FileManager;
import kieker.webgui.common.PluginClassLoader; import kieker.webgui.common.PluginClassLoader;
import kieker.webgui.common.PluginFinder; import kieker.webgui.common.PluginFinder;
import kieker.webgui.converter.MIPluginToStringConverter;
import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EList;
...@@ -340,6 +341,10 @@ public class SelectedMainProjectBean { ...@@ -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). * 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() { public void submitConnections() {
// TODO: Implement for (final Connection connection : connections) {
if (connection.isValid()) {
connection.getOutputPort().getSubscribers().add(connection.getInputPort());
}
}
} }
} }
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
package kieker.webgui.common; package kieker.webgui.common;
import kieker.analysis.model.analysisMetaModel.MIAnalysisPlugin;
import kieker.analysis.model.analysisMetaModel.MIInputPort; import kieker.analysis.model.analysisMetaModel.MIInputPort;
import kieker.analysis.model.analysisMetaModel.MIOutputPort; import kieker.analysis.model.analysisMetaModel.MIOutputPort;
import kieker.analysis.model.analysisMetaModel.MIPlugin; import kieker.analysis.model.analysisMetaModel.MIPlugin;
......
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;
}
}
...@@ -26,6 +26,23 @@ ...@@ -26,6 +26,23 @@
var="plugin" var="plugin"
itemLabel="#{plugin.name}" itemLabel="#{plugin.name}"
itemValue="#{plugin}"/> 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> </h:selectOneMenu>
</f:facet> </f:facet>
</p:cellEditor> </p:cellEditor>
...@@ -33,7 +50,7 @@ ...@@ -33,7 +50,7 @@
<p:column headerText="Destination" style="width:125px"> <p:column headerText="Destination" style="width:125px">
<p:cellEditor> <p:cellEditor>
<f:facet name="output"> <f:facet name="output" rendered="#{not empty connection.destination}">
<h:outputText value="#{connection.destination.name}"/> <h:outputText value="#{connection.destination.name}"/>
</f:facet> </f:facet>
<f:facet name="input"> <f:facet name="input">
...@@ -42,18 +59,31 @@ ...@@ -42,18 +59,31 @@
var="plugin" var="plugin"
itemLabel="#{plugin.name}" itemLabel="#{plugin.name}"
itemValue="#{plugin}"/> 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> </h:selectOneMenu>
</f:facet> </f:facet>
</p:cellEditor> </p:cellEditor>
</p:column> </p:column>
<p:column headerText="Valid" style="width:50px"> <p:column headerText="Valid" style="width:50px" >
<c:if test="#{connection.valid}"> <h:outputText rendered="#{connection.valid}" value="True"/>
<h:outputText value="True"/> <h:outputText rendered="#{not connection.valid}" value="False"/>
</c:if>
<c:otherwise>
<h:outputText value="False"/>
</c:otherwise>
</p:column> </p:column>
<p:column headerText="Options" style="width:50px"> <p:column headerText="Options" style="width:50px">
......
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