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

Replaced the locale-property with the browser's configuration of the user.

parent 3e3a178c
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package kieker.webgui.beans.session; package kieker.webgui.beans.session;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -40,7 +39,6 @@ import kieker.webgui.beans.application.GlobalPropertiesBean; ...@@ -40,7 +39,6 @@ import kieker.webgui.beans.application.GlobalPropertiesBean;
@SessionScoped @SessionScoped
public final class CurrentConfigurationBean { public final class CurrentConfigurationBean {
private String locale;
private String lookAndFeel; private String lookAndFeel;
private String gridColor; private String gridColor;
private int gridSize; private int gridSize;
...@@ -160,26 +158,6 @@ public final class CurrentConfigurationBean { ...@@ -160,26 +158,6 @@ public final class CurrentConfigurationBean {
} }
} }
public void setLocale(final String locale) {
synchronized (this) {
this.locale = locale;
CurrentConfigurationBean.saveValueInCookie(this.globalPropertiesBean.getLanguageCookieName(), locale);
}
}
public String getLocale() {
synchronized (this) {
return this.locale;
}
}
public Locale getLocaleObject() {
synchronized (this) {
return new Locale(this.locale);
}
}
/** /**
* This method tries to load the default values of the properties from the {@link GlobalPropertiesBean} and the faces context. * This method tries to load the default values of the properties from the {@link GlobalPropertiesBean} and the faces context.
*/ */
...@@ -197,8 +175,6 @@ public final class CurrentConfigurationBean { ...@@ -197,8 +175,6 @@ public final class CurrentConfigurationBean {
this.gridColor = this.globalPropertiesBean.getAnalysisEditorDefaultGridColor(); this.gridColor = this.globalPropertiesBean.getAnalysisEditorDefaultGridColor();
this.gridSize = Integer.parseInt(this.globalPropertiesBean.getAnalysisEditorDefaultGridSize()); this.gridSize = Integer.parseInt(this.globalPropertiesBean.getAnalysisEditorDefaultGridSize());
this.locale = "en";
} }
} }
...@@ -220,9 +196,6 @@ public final class CurrentConfigurationBean { ...@@ -220,9 +196,6 @@ public final class CurrentConfigurationBean {
if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())) { if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())) {
this.gridSize = Integer.parseInt(((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())).getValue()); this.gridSize = Integer.parseInt(((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())).getValue());
} }
if (cookies.containsKey(this.globalPropertiesBean.getLanguageCookieName())) {
this.locale = ((Cookie) cookies.get(this.globalPropertiesBean.getLanguageCookieName())).getValue();
}
} }
} }
......
...@@ -19,6 +19,7 @@ package kieker.webgui.beans.session; ...@@ -19,6 +19,7 @@ package kieker.webgui.beans.session;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty; import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped; import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import kieker.webgui.beans.application.GlobalPropertiesBean; import kieker.webgui.beans.application.GlobalPropertiesBean;
...@@ -43,9 +44,6 @@ public final class UserBean { ...@@ -43,9 +44,6 @@ public final class UserBean {
@ManagedProperty(value = "#{globalPropertiesBean}") @ManagedProperty(value = "#{globalPropertiesBean}")
private GlobalPropertiesBean globalPropertiesBean; private GlobalPropertiesBean globalPropertiesBean;
@ManagedProperty(value = "#{currentConfigurationBean}")
private CurrentConfigurationBean currentConfigurationBean;
/** /**
* Default constructor. <b>Do not use this constructor. This bean is JSF managed.</b> * Default constructor. <b>Do not use this constructor. This bean is JSF managed.</b>
*/ */
...@@ -112,22 +110,14 @@ public final class UserBean { ...@@ -112,22 +110,14 @@ public final class UserBean {
this.globalPropertiesBean = globalPropertiesBean; this.globalPropertiesBean = globalPropertiesBean;
} }
public CurrentConfigurationBean getCurrentConfigurationBean() {
return this.currentConfigurationBean;
}
public void setCurrentConfigurationBean(final CurrentConfigurationBean currentConfigurationBean) {
this.currentConfigurationBean = currentConfigurationBean;
}
/** /**
* This method shows the welcome message using the growl component and the global properties. * This method shows the welcome message using the growl component and the global properties.
*/ */
public void showWelcomeMessage() { public void showWelcomeMessage() {
if (this.globalPropertiesBean != null) { if (this.globalPropertiesBean != null) {
final String finalMsg = String.format(UserBean.WELCOME_MSG_TEMPLATE, final String finalMsg = String.format(UserBean.WELCOME_MSG_TEMPLATE,
this.globalPropertiesBean.getShortWelcomeMessage(this.currentConfigurationBean.getLocaleObject()), this.globalPropertiesBean.getShortWelcomeMessage(FacesContext.getCurrentInstance().getELContext().getLocale()),
this.globalPropertiesBean.getWelcomeMessage(this.currentConfigurationBean.getLocaleObject())); this.globalPropertiesBean.getWelcomeMessage(FacesContext.getCurrentInstance().getELContext().getLocale()));
RequestContext.getCurrentInstance().execute(finalMsg); RequestContext.getCurrentInstance().execute(finalMsg);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<f:event type="preRenderView" listener="#{currentAnalysisEditorBean.initialize()}" /> <f:event type="preRenderView" listener="#{currentAnalysisEditorBean.initialize()}" />
</f:metadata> </f:metadata>
<f:view locale="#{currentConfigurationBean.locale}"> <f:view>
<h:head> <h:head>
<title>Kieker.WebGUI</title> <title>Kieker.WebGUI</title>
<!-- Load the necessary CSS files. --> <!-- Load the necessary CSS files. -->
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<f:viewParam name="projectName" value="#{currentControllerBean.projectName}"/> <f:viewParam name="projectName" value="#{currentControllerBean.projectName}"/>
</f:metadata> </f:metadata>
<f:view locale="#{currentConfigurationBean.locale}"> <f:view>
<h:head> <h:head>
<title>Kieker.WebGUI</title> <title>Kieker.WebGUI</title>
<link rel="stylesheet" type="text/css" href="../css/Common.css" /> <link rel="stylesheet" type="text/css" href="../css/Common.css" />
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
xmlns:p="http://primefaces.org/ui" xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"> xmlns:f="http://java.sun.com/jsf/core">
<f:view locale="#{currentConfigurationBean.locale}"> <f:view>
<h:head> <h:head>
<title>Kieker.WebGUI</title> <title>Kieker.WebGUI</title>
<link rel="stylesheet" type="text/css" href="../css/Common.css" /> <link rel="stylesheet" type="text/css" href="../css/Common.css" />
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
xmlns:p="http://primefaces.org/ui" xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"> xmlns:f="http://java.sun.com/jsf/core">
<f:view locale="#{currentConfigurationBean.locale}"> <f:view>
<h:head> <h:head>
<title>Kieker.WebGUI</title> <title>Kieker.WebGUI</title>
<link rel="stylesheet" type="text/css" href="../css/Common.css" /> <link rel="stylesheet" type="text/css" href="../css/Common.css" />
......
...@@ -241,4 +241,12 @@ ...@@ -241,4 +241,12 @@
background: url('../img/icons/ManageLibraries.png') no-repeat !important; background: url('../img/icons/ManageLibraries.png') no-repeat !important;
height:16px; height:16px;
width:16px; width:16px;
}
.rightAlignedColumn {
text-align: right !important;
}
.normalColumn {
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<h:form> <h:form>
<p:tabView> <p:tabView>
<p:tab title="#{localizedMessages.common}"> <p:tab title="#{localizedMessages.common}">
<h:panelGrid columns="2" cellpadding="10"> <h:panelGrid columns="2" cellpadding="10" columnClasses="rightAlignedColumn, normalColumn">
<h:outputText value="#{localizedMessages.lookAndFeel}:" /> <h:outputText value="#{localizedMessages.lookAndFeel}:" />
<p:themeSwitcher value="#{currentConfigurationBean.lookAndFeel}" style="width:150px" effect="fade"> <p:themeSwitcher value="#{currentConfigurationBean.lookAndFeel}" style="width:150px" effect="fade">
<f:selectItem itemLabel="#{localizedMessages.chooseTheme}" itemValue="" /> <f:selectItem itemLabel="#{localizedMessages.chooseTheme}" itemValue="" />
...@@ -18,24 +18,24 @@ ...@@ -18,24 +18,24 @@
</p:themeSwitcher> </p:themeSwitcher>
<h:outputText value="#{localizedMessages.language}:"/> <h:outputText value="#{localizedMessages.language}:"/>
<p:selectOneMenu value="#{currentConfigurationBean.locale}" style="width:150px"> <p:selectOneMenu value="#{facesContext.ELContext.locale.toString()}" style="width:150px" disabled="true">
<f:selectItem itemValue="en" itemLabel="English"/> <f:selectItem itemValue="en" itemLabel="English"/>
<f:selectItem itemValue="de" itemLabel="Deutsch"/> <f:selectItem itemValue="de" itemLabel="Deutsch"/>
</p:selectOneMenu> </p:selectOneMenu>
</h:panelGrid> </h:panelGrid>
</p:tab> </p:tab>
<p:tab title="#{localizedMessages.analysisEditor}"> <p:tab title="#{localizedMessages.analysisEditor}">
<h:panelGrid columns="2" cellpadding="10"> <h:panelGrid columns="2" cellpadding="10" columnClasses="rightAlignedColumn, normalColumn">
<h:outputText value="#{localizedMessages.toolPalette}:"/> <h:outputText value="#{localizedMessages.toolPalette}:"/>
<p:selectOneMenu style="width:150px"> <p:selectOneMenu style="width: 100%">
<f:selectItem itemLabel="#{localizedMessages.lists}"/> <f:selectItem itemLabel="#{localizedMessages.lists}"/>
</p:selectOneMenu> </p:selectOneMenu>
<h:outputText value="#{localizedMessages.gridSize}:"/> <h:outputText value="#{localizedMessages.gridSize}:"/>
<p:spinner value="#{currentConfigurationBean.gridSize}" valueChangeListener="#{currentAnalysisEditorBean.gridSizeListener}" suffix=" [px]"/> <p:spinner style="width: 100%" value="#{currentConfigurationBean.gridSize}" valueChangeListener="#{currentAnalysisEditorBean.gridSizeListener}" suffix=" [px]"/>
<h:outputText value="#{localizedMessages.gridColor}:"/> <h:outputText value="#{localizedMessages.gridColor}:"/>
<p:colorPicker value="#{currentConfigurationBean.gridColor}" valueChangeListener="#{currentAnalysisEditorBean.gridColorListener}"/> <p:colorPicker style="width: 100%" value="#{currentConfigurationBean.gridColor}" valueChangeListener="#{currentAnalysisEditorBean.gridColorListener}"/>
</h:panelGrid> </h:panelGrid>
</p:tab> </p:tab>
<p:tab title="#{localizedMessages.analysisController}" disabled="true"> <p:tab title="#{localizedMessages.analysisController}" disabled="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