labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r793023 - /labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java
Date Fri, 10 Jul 2009 16:31:08 GMT
Author: simoneg
Date: Fri Jul 10 16:31:08 2009
New Revision: 793023

URL: http://svn.apache.org/viewvc?rev=793023&view=rev
Log:
LABS-352 : minor initial refactoring for introducing pieces.

Modified:
    labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java

Modified: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java?rev=793023&r1=793022&r2=793023&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java
(original)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/BeanFormProducer.java
Fri Jul 10 16:31:08 2009
@@ -74,7 +74,7 @@
 			if (actions != null) {
 				int i = 0;
 				for (FormAction action : this.actions) {
-					out.write("<input type=\"submit\" name=\"" + this.code + ".__action_" + i +"\" value=\"");
+					out.write("<input type=\"submit\" name=\"" + this.code + ".__action_" + i +"\" id=\"__action_"
+ i + "\" value=\"");
 					out.write(new LocalizableString(action.getLabel()).toString());
 					out.write("\"/>");									
 					i++;
@@ -156,15 +156,7 @@
 	}
 
 	@Override
-	protected void createMain(Node node, Writer out) throws IOException {
-		if (node instanceof FieldNode) {
-			createField((FieldNode) node, out);
-		} else {
-			super.createMain(node, out);
-		}
-	}
-
-	protected void createField(FieldNode node, Writer out) throws IOException {
+	protected void createFieldNodeOutput(FieldNode node, Writer out) throws IOException {
 		PropertyInfo property = node.getProperty();
 		if (property.getType().isEnum() || MagmaBeanSupport.class.isAssignableFrom(property.getType()))
{
 			createSelectionListField(node, out);
@@ -187,21 +179,6 @@
 		}
 		
 	}
-	
-	protected void createBooleanField(FieldNode node, Writer out) throws IOException {
-		StringBuilder sb = new StringBuilder();
-		sb.append("MagmaField CheckBox");
-		commonFieldClasses(node, sb);
-		createAdditionalInfo(node, sb.toString(), out);	
-		out.append("<input type=\"checkbox\"");
-		createNameAndId(node, out);
-		out.append(" value=\"true\"");
-		Boolean bool = (Boolean) ViewUtils.getNodeValue(node, bean);
-		if (bool != null && bool.booleanValue()) {
-			out.append(" checked=\"checked\"");
-		}
-		out.append("/>");
-	}
 
 	protected void createSelectionListField(FieldNode node, Writer out) throws IOException {
 		PropertyInfo property = node.getProperty();
@@ -241,7 +218,7 @@
 	}
 	
 	
-	private void createRadioField(FieldNode node, List<?> elements, Writer out) throws
IOException {
+	protected void createRadioField(FieldNode node, List<?> elements, Writer out) throws
IOException {
 		StringBuilder sb = new StringBuilder();
 		sb.append("MagmaField RadioButton");
 		commonFieldClasses(node, sb);
@@ -260,7 +237,7 @@
 
 
 
-	private void createRadioButton(FieldNode node, Writer out, int i, Object object) throws
IOException {
+	protected void createRadioButton(FieldNode node, Writer out, int i, Object object) throws
IOException {
 		String val = node.getProperty().toString(object);
 		out.append("<input type=\"radio\"");
 		createNameAndId(node, out, Integer.toString(i));
@@ -306,9 +283,7 @@
 		out.append("</select>");		
 	}
 
-
-
-	private void createDropDownOption(FieldNode node, Writer out, Object object) throws IOException
{
+	protected void createDropDownOption(FieldNode node, Writer out, Object object) throws IOException
{
 		String val = node.getProperty().toString(object);
 		out.append("<option value=\"");
 		out.append(val);
@@ -328,6 +303,23 @@
 		}
 		out.append("</option>");
 	}
+	
+	
+	protected void createBooleanField(FieldNode node, Writer out) throws IOException {
+		StringBuilder sb = new StringBuilder();
+		sb.append("MagmaField CheckBox");
+		commonFieldClasses(node, sb);
+		createAdditionalInfo(node, sb.toString(), out);	
+		out.append("<input type=\"checkbox\"");
+		createNameAndId(node, out);
+		out.append(" value=\"true\"");
+		Boolean bool = (Boolean) ViewUtils.getNodeValue(node, bean);
+		if (bool != null && bool.booleanValue()) {
+			out.append(" checked=\"checked\"");
+		}
+		out.append("/>");
+	}
+
 
 	protected void createTextField(FieldNode node, Writer out) throws IOException {
 		PropertyInfo property = node.getProperty();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message