[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash ...
Christian Bauer
christian at hibernate.org
Sat Dec 29 21:33:26 EST 2007
User: cbauer
Date: 07/12/29 21:33:26
Modified: examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash
FlashPreferences.java Flash.java
Added: examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash
FlashPreferencesSupport.java
Log:
Complete overhaul of the preferences system
Revision Changes Path
1.5 +31 -36 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash/FlashPreferences.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FlashPreferences.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash/FlashPreferences.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- FlashPreferences.java 19 Dec 2007 04:29:26 -0000 1.4
+++ FlashPreferences.java 30 Dec 2007 02:33:26 -0000 1.5
@@ -1,59 +1,54 @@
package org.jboss.seam.wiki.plugin.flash;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.wiki.preferences.Preference;
-import org.jboss.seam.wiki.preferences.PreferenceVisibility;
-import org.jboss.seam.wiki.preferences.PreferenceSupport;
-import org.hibernate.validator.Range;
-import org.hibernate.validator.NotNull;
import org.hibernate.validator.Length;
+import org.hibernate.validator.Range;
+import org.jboss.seam.wiki.preferences.PreferenceVisibility;
+import org.jboss.seam.wiki.preferences.annotations.PreferenceProperty;
+import org.jboss.seam.wiki.preferences.annotations.Preferences;
import java.io.Serializable;
- at Name("flashPreferences")
- at Scope(ScopeType.CONVERSATION)
- at Preference(description = "Plugin: Flash", visibility = PreferenceVisibility.INSTANCE)
- at AutoCreate
-public class FlashPreferences extends PreferenceSupport implements Serializable {
-
- public String getCurrentUserVariable() { return "currentUser"; }
- public String getCurrentInstanceVariable() { return "renderedBaseDocument"; }
-
-// @Observer(value = {"PreferenceEditor.refresh.flashPreferences", "Render.startRenderDocument"}, create = false)
- public void refreshProperties() { super.refreshProperties(); }
+ at Preferences(name = "Flash", description = "#{messages['flash.preferences.Name']}")
+public class FlashPreferences implements Serializable {
- @Preference(description = "01. URL of flash movie", visibility = PreferenceVisibility.INSTANCE)
+ @PreferenceProperty(
+ description = "#{messages['flash.preferences.FlashURL']}",
+ visibility = PreferenceVisibility.INSTANCE
+ )
@Length(min = 0, max = 1024)
- private String flashURL;
+ private String url;
- @Preference(description = "02. Width of embedded flash object (pixel)", visibility = PreferenceVisibility.INSTANCE)
+ @PreferenceProperty(
+ description = "#{messages['flash.preferences.Width']}",
+ visibility = PreferenceVisibility.INSTANCE
+ )
@Range(min = 1l, max = 2000l)
- @NotNull
- private Long objectWidth;
+ private Long width;
- @Preference(description = "03. Height of embedded flash object (pixel)", visibility = PreferenceVisibility.INSTANCE)
+ @PreferenceProperty(
+ description = "#{messages['flash.preferences.Height']}",
+ visibility = PreferenceVisibility.INSTANCE
+ )
@Range(min = 1l, max = 2000l)
- @NotNull
- private Long objectHeight;
+ private Long height;
- @Preference(description = "04. Comma-separated list of allowed domain names", visibility = PreferenceVisibility.SYSTEM)
+ @PreferenceProperty(
+ description = "#{messages['flash.preferences.AllowedDomains']}",
+ visibility = PreferenceVisibility.SYSTEM
+ )
@Length(min = 3, max = 1024)
private String allowedDomains;
- public String getFlashURL() {
- return flashURL;
+ public String getUrl() {
+ return url;
}
- public Long getObjectWidth() {
- return objectWidth;
+ public Long getWidth() {
+ return width;
}
- public Long getObjectHeight() {
- return objectHeight;
+ public Long getHeight() {
+ return height;
}
public String getAllowedDomains() {
1.2 +9 -8 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash/Flash.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Flash.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash/Flash.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Flash.java 14 Nov 2007 10:55:24 -0000 1.1
+++ Flash.java 30 Dec 2007 02:33:26 -0000 1.2
@@ -1,33 +1,34 @@
package org.jboss.seam.wiki.plugin.flash;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.ScopeType;
import org.jboss.seam.log.Log;
import java.io.Serializable;
-import java.util.Arrays;
import java.net.URI;
+import java.util.Arrays;
@Name("flash")
@Scope(ScopeType.PAGE)
public class Flash implements Serializable {
- @In
- FlashPreferences flashPreferences;
-
@Logger
Log log;
+ @In("#{preferences.get('Flash', currentMacro)}")
+ FlashPreferences prefs;
+
public boolean isURLAllowed() {
- String allowedDomains = flashPreferences.getAllowedDomains();
+
+ String allowedDomains = prefs.getAllowedDomains();
if (allowedDomains == null || allowedDomains.length() == 0) return false;
String desiredDomainName;
try {
- URI uri = new URI(flashPreferences.getFlashURL());
+ URI uri = new URI(prefs.getUrl());
desiredDomainName = uri.getHost();
} catch (Exception ex) {
log.debug("Exception parsing flash movie URL into URI: " + ex.getMessage());
1.1 date: 2007/12/30 02:33:26; author: cbauer; state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/flash/FlashPreferencesSupport.java
Index: FlashPreferencesSupport.java
===================================================================
package org.jboss.seam.wiki.plugin.flash;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.wiki.preferences.metamodel.PreferencesSupport;
import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
import java.util.Set;
import java.util.HashSet;
@Name("flashPreferencesSupport")
public class FlashPreferencesSupport extends PreferencesSupport {
public Set<PreferenceEntity> getPreferenceEntities() {
return new HashSet<PreferenceEntity>() {{
add( createPreferenceEntity(FlashPreferences.class) );
}};
}
}
More information about the jboss-cvs-commits
mailing list