You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ha...@apache.org on 2008/06/15 02:25:30 UTC
svn commit: r667911 - in
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist:
AbstractHtmlSelectManyPicklist.java HtmlPicklistRenderer.java
Author: hazems
Date: Sat Jun 14 17:25:30 2008
New Revision: 667911
URL: http://svn.apache.org/viewvc?rev=667911&view=rev
Log:
Promoting the selectManyPicklist component.
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java?rev=667911&r1=667910&r2=667911&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java Sat Jun 14 17:25:30 2008
@@ -29,13 +29,54 @@
* tagClass = "org.apache.myfaces.custom.picklist.HtmlSelectManyPicklistTag"
*
* @author Bruno Aranda (latest modification by $Author: lu4242 $)
- * @version $Revision: 663481 $ $Date: 2008-06-05 10:00:34 +0300 (Thu, 05 Jun 2008) $
+ * @version $Revision: 667663 $ $Date: 2008-06-14 00:53:17 +0300 (Sat, 14 Jun 2008) $
*/
-public class AbstractHtmlSelectManyPicklist extends HtmlSelectManyListbox
+public abstract class AbstractHtmlSelectManyPicklist extends HtmlSelectManyListbox
{
public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyPicklist";
public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.PicklistRenderer";
+ /**
+ * Define the text that goes inside the add button
+ *
+ * @JSFProperty
+ */
+ public abstract String getAddButtonText();
+
+ /**
+ * Define the text that goes inside the remove button
+ *
+ * @JSFProperty
+ */
+ public abstract String getRemoveButtonText();
+
+ /**
+ * CSS style to be applied to the button
+ *
+ * @JSFProperty
+ */
+ public abstract String getAddButtonStyle();
+
+ /**
+ * CSS style to be applied to the button
+ *
+ * @JSFProperty
+ */
+ public abstract String getRemoveButtonStyle();
+
+ /**
+ * CSS styleClass to be applied to the button
+ *
+ * @JSFProperty
+ */
+ public abstract String getAddButtonStyleClass();
+
+ /**
+ * CSS styleClass to be applied to the button
+ *
+ * @JSFProperty
+ */
+ public abstract String getRemoveButtonStyleClass();
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java?rev=667911&r1=667910&r2=667911&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java Sat Jun 14 17:25:30 2008
@@ -121,6 +121,20 @@
HtmlSelectManyPicklist picklist = (HtmlSelectManyPicklist) uiComponent;
+ String addButtonText = picklist.getAddButtonText();
+ String removeButtonText = picklist.getRemoveButtonText();
+ String addButtonStyle = picklist.getAddButtonStyle();
+ String removeButtonStyle = picklist.getRemoveButtonStyle();
+ String addButtonStyleClass = picklist.getAddButtonStyleClass();
+ String removeButtonStyleClass = picklist.getRemoveButtonStyleClass();
+
+ //Set the default values for addButtonText and removeButtonText
+ if(addButtonText == null || addButtonText.length() == 0)
+ addButtonText = ">";
+
+ if(removeButtonText == null || removeButtonText.length() == 0)
+ removeButtonText = "<";
+
encodeJavascript(facesContext, uiComponent);
String availableListClientId = uiComponent.getClientId(facesContext)
@@ -167,13 +181,13 @@
+ "','" + hiddenFieldCliendId + "')";
encodeSwapButton(facesContext, uiComponent, javascriptAddToSelected,
- ">");
+ addButtonText, addButtonStyle, addButtonStyleClass);
writer.startElement(HTML.BR_ELEM, uiComponent);
writer.endElement(HTML.BR_ELEM);
- encodeSwapButton(facesContext, uiComponent,
- javascriptRemoveFromSelected, "<");
+ encodeSwapButton(facesContext, uiComponent, javascriptRemoveFromSelected,
+ removeButtonText, removeButtonStyle, removeButtonStyleClass);
writer.endElement(HTML.TD_ELEM);
@@ -203,12 +217,15 @@
}
private void encodeSwapButton(FacesContext facesContext,
- UIComponent uiComponent, String javaScriptFunction, String text)
+ UIComponent uiComponent, String javaScriptFunction,
+ String text, String style, String styleClass)
throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HTML.INPUT_ELEM, uiComponent);
+ writer.writeAttribute(HTML.STYLE_ATTR, style, null);
+ writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_BUTTON,
JSFAttr.TYPE_ATTR);
writer.writeAttribute(HTML.ONCLICK_ATTR, javaScriptFunction, null);