You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/08/12 13:24:05 UTC
svn commit: r1513106 - in /myfaces/tobago/trunk/tobago-example:
tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/
tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/
tobago-example-addressbook/src/main/...
Author: lofwyr
Date: Mon Aug 12 11:24:05 2013
New Revision: 1513106
URL: http://svn.apache.org/r1513106
Log:
example: select item icons, logging
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java
myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java
myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/WEB-INF/faces-config.xml
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java?rev=1513106&r1=1513105&r2=1513106&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java Mon Aug 12 11:24:05 2013
@@ -30,6 +30,7 @@ import org.apache.myfaces.tobago.event.S
import org.apache.myfaces.tobago.example.addressbook.Address;
import org.apache.myfaces.tobago.example.addressbook.AddressDao;
import org.apache.myfaces.tobago.example.addressbook.Picture;
+import org.apache.myfaces.tobago.model.SelectItem;
import org.apache.myfaces.tobago.model.SheetState;
import org.apache.myfaces.tobago.util.VariableResolverUtils;
import org.slf4j.Logger;
@@ -41,7 +42,6 @@ import javax.faces.application.FacesMess
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
-import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.inject.Inject;
import javax.inject.Named;
@@ -50,9 +50,11 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
@Named("controller")
@WindowScoped
@@ -63,6 +65,8 @@ public class Controller implements Seria
private static final String OUTCOME_LIST = "list";
private static final String OUTCOME_EDITOR = "editor";
+ public static final Map<Locale, String> FLAGS;
+
private List<Address> currentAddressList;
private Address currentAddress;
private SheetState selectedAddresses;
@@ -93,6 +97,13 @@ public class Controller implements Seria
private FileItem uploadedFile;
private boolean renderFileUploadPopup;
+ static {
+ FLAGS = new HashMap<Locale, String>(3);
+ FLAGS.put(Locale.GERMAN, "image/addressbook/icon/flag-de.png");
+ FLAGS.put(Locale.UK, "image/addressbook/icon/flag-gb.png");
+ FLAGS.put(Locale.US, "image/addressbook/icon/flag-us.png");
+ }
+
@PostConstruct
public void init() {
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -414,7 +425,7 @@ public class Controller implements Seria
Iterator supportedLocales = application.getSupportedLocales();
while (supportedLocales.hasNext()) {
Locale locale = (Locale) supportedLocales.next();
- SelectItem item = new SelectItem(locale, locale.getDisplayName(language));
+ SelectItem item = new SelectItem(locale, locale.getDisplayName(language), null, FLAGS.get(locale));
languages.add(item);
}
Collections.sort(languages, new SelectItemComparator());
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/faces-config.xml?rev=1513106&r1=1513105&r2=1513106&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/WEB-INF/faces-config.xml Mon Aug 12 11:24:05 2013
@@ -35,7 +35,9 @@
</application>
<lifecycle>
+<!--
<phase-listener>org.apache.myfaces.tobago.util.DebugPhaseListener</phase-listener>
+-->
<phase-listener>org.apache.myfaces.tobago.example.addressbook.web.StartupPhaseListener</phase-listener>
</lifecycle>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java?rev=1513106&r1=1513105&r2=1513106&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Controller.java Mon Aug 12 11:24:05 2013
@@ -29,6 +29,7 @@ import org.apache.myfaces.tobago.event.S
import org.apache.myfaces.tobago.example.addressbook.Address;
import org.apache.myfaces.tobago.example.addressbook.AddressDao;
import org.apache.myfaces.tobago.example.addressbook.Picture;
+import org.apache.myfaces.tobago.model.SelectItem;
import org.apache.myfaces.tobago.model.SheetState;
import org.apache.myfaces.tobago.util.VariableResolverUtils;
import org.slf4j.Logger;
@@ -43,15 +44,16 @@ import javax.faces.application.FacesMess
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
-import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
@Component("controller")
@Scope("session")
@@ -62,6 +64,8 @@ public class Controller {
private static final String OUTCOME_LIST = "list";
private static final String OUTCOME_EDITOR = "editor";
+ public static final Map<Locale, String> FLAGS;
+
private List<Address> currentAddressList;
private Address currentAddress;
private SheetState selectedAddresses;
@@ -91,6 +95,13 @@ public class Controller {
private FileItem uploadedFile;
private boolean renderFileUploadPopup;
+ static {
+ FLAGS = new HashMap<Locale, String>(3);
+ FLAGS.put(Locale.GERMAN, "image/addressbook/icon/flag-de.png");
+ FLAGS.put(Locale.UK, "image/addressbook/icon/flag-gb.png");
+ FLAGS.put(Locale.US, "image/addressbook/icon/flag-us.png");
+ }
+
@PostConstruct
public void init() {
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -417,7 +428,7 @@ public class Controller {
Iterator supportedLocales = application.getSupportedLocales();
while (supportedLocales.hasNext()) {
Locale locale = (Locale) supportedLocales.next();
- SelectItem item = new SelectItem(locale, locale.getDisplayName(language));
+ SelectItem item = new SelectItem(locale, locale.getDisplayName(language), null, FLAGS.get(locale));
languages.add(item);
}
Collections.sort(languages, new SelectItemComparator());
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/WEB-INF/faces-config.xml?rev=1513106&r1=1513105&r2=1513106&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/WEB-INF/faces-config.xml Mon Aug 12 11:24:05 2013
@@ -37,7 +37,9 @@
</application>
<lifecycle>
+<!--
<phase-listener>org.apache.myfaces.tobago.util.DebugPhaseListener</phase-listener>
+-->
<phase-listener>org.apache.myfaces.tobago.example.addressbook.web.StartupPhaseListener</phase-listener>
</lifecycle>