Author: sdzmitrovich
Date: 2008-01-15 12:42:36 -0500 (Tue, 15 Jan 2008)
New Revision: 5723
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy_all.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_down.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_first.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_last.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove_all.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_up.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/button.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1580
new template was added
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy_all.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_copy_all.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_down.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_down.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_first.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_first.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_last.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_last.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove_all.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_remove_all.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_up.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/arrow_up.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/button.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/button.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css 2008-01-15
17:42:36 UTC (rev 5723)
@@ -0,0 +1,47 @@
+.rich-shuttle-box {
+ background-color: #FFF;
+ border-color: #C0C0C0;
+ border-width: 1px;
+ border-style: solid;
+ overflow: auto;
+ //display:block;
+}
+
+.rich-shuttle-caption-label {
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+ font-weight: bold;
+}
+
+.rich-shuttle-button-content {
+ padding: 0 4px 0 1px;
+ text-align: left;
+ white-space: nowrap;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.rich-shuttle-button-content img {
+ margin-right: 2px;
+ vertical-align: middle;
+}
+
+.rich-shuttle-control {
+ border: 1px solid;
+ margin-bottom: 3px;
+ border-color: #C0C0C0;
+}
+
+.rich-shuttle-button {
+ background: top left repeat-x;
+ padding: 2px;
+ cursor: pointer;
+ background-color: #E3DED5;
+ color: #000;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.rich-shuttle-controls {
+ padding: 0 8px 5px 8px;
+}
\ No newline at end of file
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java 2008-01-15
17:42:36 UTC (rev 5723)
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class RichFacesListShuttleTemplate extends VpeAbstractTemplate {
+
+ /**
+ * source caption key
+ */
+ private static final String SOURCE_CAPTION = "sourceCaption";
+
+ /**
+ * target caption key
+ */
+ private static final String TARGET_CAPTION = "targetCaption";
+
+ /**
+ * path to css
+ */
+ private static final String STYLE_PATH = "shuttle/shuttle.css";
+
+ /**
+ * default value of width of box(list)
+ */
+ private static final String DEFAULT_LIST_WIDTH = "140px";
+
+ /**
+ * default value of height of box(list)
+ */
+ private static final String DEFAULT_LIST_HEIGHT = "140px";
+
+ /**
+ * attribute name of width of source list
+ */
+ private static final String ATTR_SOURCE_LIST_WIDTH = "sourceListWidth";
+
+ /**
+ * attribute name of width of target list
+ */
+ private static final String ATTR_TARGET_LIST_WIDTH = "targetListWidth";
+
+ /**
+ * attribute name of height of source list
+ */
+ private static final String ATTR_LISTS_HEIGHT = "listsHeight";
+
+ /**
+ * If this attribute in source node is "false", 'Copy All' and
'Remove All'
+ * controls aren't displayed
+ */
+ private static final String ATTR_FAST_MOVE_CONTROLS_VIZIBLE =
"fastMoveControlsVisible";
+
+ /**
+ * If this attribute in source node is "false", 'Top' and
'Bottom' controls
+ * aren't displayed.
+ */
+ private static final String ATTR_FAST_ORDER_CONTROLS_VIZIBLE =
"fastOrderControlsVisible";
+
+ /**
+ * If this attribute in source node is "false", 'Copy' and
'Remove' controls
+ * aren't displayed
+ */
+ private static final String ATTR_MOVE_CONTROLS_VIZIBLE =
"moveControlsVisible";
+
+ /**
+ * If this attribute in source node is "false", 'Up' and
'Down' controls
+ * aren't displayed.
+ */
+ private static final String ATTR_ORDER_CONTROLS_VIZIBLE =
"orderControlsVisible";
+
+ /**
+ * default button align
+ */
+ private static final String DEFAULT_BUTTON_ALIGN = "middle";
+
+ /**
+ * Customizes vertically a position of move/copy controls relatively to
+ * lists
+ */
+ private static final String ATTR_MOVE_CONTROLS_VERTICAL_ALIGN =
"moveControlsVerticalAlign";
+
+ /**
+ *
+ * Customizes vertically a position of order controls relatively to lists
+ */
+ private static final String ATTR_ORDER_CONTROLS_VERTICAL_ALIGN =
"orderControlsVerticalAlign";
+
+ /**
+ * button images
+ */
+ private static final Map<String, String> buttonImages;
+
+ static {
+ buttonImages = new HashMap<String, String>();
+
+ // images of the first set of buttons
+ buttonImages.put("copyAllControl", "shuttle/arrow_copy_all.gif");
+ buttonImages.put("copyControl", "shuttle/arrow_copy.gif");
+ buttonImages.put("removeControl", "shuttle/arrow_remove.gif");
+ buttonImages.put("removeAllControl",
"shuttle/arrow_remove_all.gif");
+
+ // images of the second set of buttons
+ buttonImages.put("topControl", "shuttle/arrow_first.gif");
+ buttonImages.put("upControl", "shuttle/arrow_up.gif");
+ buttonImages.put("downControl", "shuttle/arrow_down.gif");
+ buttonImages.put("bottomControl", "shuttle/arrow_last.gif");
+
+ }
+
+ /**
+ * default labels
+ */
+ private static final Map<String, String> defaultLabels;
+
+ static {
+ defaultLabels = new HashMap<String, String>();
+
+ // values of the first set of buttons
+ defaultLabels.put("copyAllControl", "Copy all");
+ defaultLabels.put("copyControl", "Copy");
+ defaultLabels.put("removeControl", "Remove");
+ defaultLabels.put("removeAllControl", "Remove All");
+
+ // images of the second set of buttons
+ defaultLabels.put("topControl", "First");
+ defaultLabels.put("upControl", "Up");
+ defaultLabels.put("downControl", "Down");
+ defaultLabels.put("bottomControl", "Last");
+
+ // caption labels
+ defaultLabels.put("sourceCaption", "");
+ defaultLabels.put("targetCaption", "");
+
+ }
+
+ /**
+ * "fast move" buttons block
+ */
+ private static final List<String> fastMoveButtons;
+
+ static {
+ fastMoveButtons = new ArrayList<String>();
+ fastMoveButtons.add("copyAllControl");
+ fastMoveButtons.add("removeAllControl");
+ }
+
+ /**
+ * "move" buttons block
+ */
+ private static final List<String> moveButtons;
+
+ static {
+ moveButtons = new ArrayList<String>();
+ moveButtons.add("copyControl");
+ moveButtons.add("removeControl");
+ }
+
+ /**
+ * "fast order" buttons block
+ */
+ private static final List<String> fastOrderButtons;
+
+ static {
+ fastOrderButtons = new ArrayList<String>();
+ fastOrderButtons.add("topControl");
+ fastOrderButtons.add("bottomControl");
+
+ }
+
+ /**
+ * "order" buttons block
+ */
+ private static final List<String> orderButtons;
+
+ static {
+ orderButtons = new ArrayList<String>();
+ orderButtons.add("upControl");
+ orderButtons.add("downControl");
+
+ }
+
+ /**
+ * labels for controls
+ */
+ private final Map<String, String> labels = new HashMap<String, String>();
+
+ /**
+ * source buttons
+ */
+ private final List<String> sourceButtons = new ArrayList<String>();
+
+ /**
+ * target buttons
+ */
+ private final List<String> targetButtons = new ArrayList<String>();
+
+ /**
+ * value of vertical-align attribute for source (copy/remove) buttons
+ */
+ private String sourceButtonsAlign;
+
+ /**
+ * value of vertical-align attribute for source (up/down/top/bottom) buttons
+ */
+ private String targetButtonsAlign;
+
+ /**
+ * value of height attribute of lists (source/target)
+ */
+ private String listsHeight;
+
+ /**
+ * value of width attribute of source list
+ */
+ private String sourceListsWidth;
+
+ /**
+ * value of width attribute of target list
+ */
+ private String targetListsWidth;
+
+ /**
+ *
+ */
+ public RichFacesListShuttleTemplate() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
+ * org.mozilla.interfaces.nsIDOMElement, java.lang.Object,
+ * java.lang.String, java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "shuttle");
+
+ // cast to Element
+ Element sourceElement = (Element) sourceNode;
+
+ // get children
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+
+ // prepare data
+ prepareData(sourceElement);
+
+ // create table element
+ nsIDOMElement basicTable = visualDocument.createElement(HTML.TAG_TABLE);
+ ComponentUtil.copyAttributes(sourceNode, basicTable);
+ VpeCreationData creationData = new VpeCreationData(basicTable);
+
+ // create caption
+ nsIDOMElement caption = createCaption(visualDocument);
+ if (caption != null)
+ basicTable.appendChild(caption);
+
+ // create "tr" tag
+ nsIDOMElement basicTr = visualDocument.createElement(HTML.TAG_TR);
+
+ // create source box
+ nsIDOMElement sourceBoxTd = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement sourceBox = createBox(visualDocument, creationData,
+ children);
+ sourceBox.setAttribute(HTML.ATTR_STYLE, "width:" + sourceListsWidth
+ + ";height:" + listsHeight + ";");
+ sourceBoxTd.appendChild(sourceBox);
+
+ // create source buttons
+ nsIDOMElement sourceButtonsTd = visualDocument
+ .createElement(HTML.TAG_TD);
+ nsIDOMElement sourceButtonsBlock = createButtonsBlock(visualDocument,
+ sourceButtons);
+ sourceButtonsTd.appendChild(sourceButtonsBlock);
+
+ // set vertical-align attribute for source buttons
+ sourceButtonsTd.setAttribute(HTML.ATTR_STYLE, "vertical-align: "
+ + sourceButtonsAlign);
+
+ // create target box
+ nsIDOMElement targetBoxTd = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement targetBox = createBox(visualDocument, creationData,
+ children);
+ targetBox.setAttribute(HTML.ATTR_STYLE, "width:" + targetListsWidth
+ + ";height:" + listsHeight + ";");
+ targetBoxTd.appendChild(targetBox);
+
+ // create target buttons
+ nsIDOMElement targetButtonsTd = visualDocument
+ .createElement(HTML.TAG_TD);
+ nsIDOMElement targetButtonsBlock = createButtonsBlock(visualDocument,
+ targetButtons);
+ targetButtonsTd.appendChild(targetButtonsBlock);
+
+ // set vertical-align attribute for target buttons
+ targetButtonsTd.setAttribute(HTML.ATTR_STYLE, "vertical-align: "
+ + targetButtonsAlign);
+
+ // add all blocks to "tr"
+ basicTr.appendChild(sourceBoxTd);
+ basicTr.appendChild(sourceButtonsTd);
+ basicTr.appendChild(targetBoxTd);
+ basicTr.appendChild(targetButtonsTd);
+
+ // add "tr" to table
+ basicTable.appendChild(basicTr);
+
+ return creationData;
+ }
+
+ /**
+ * create caption of listShuttle component
+ *
+ * caption is "tr" tag which contain two "td" tags
+ *
+ * @param sourceCaptionLabel
+ * @param targetCaptionLabel
+ * @param visualDocument
+ * @return
+ */
+ private nsIDOMElement createCaption(nsIDOMDocument visualDocument) {
+
+ // check sourceCaptionLabel
+ if ((labels.get(SOURCE_CAPTION).length() == 0)
+ && (labels.get(TARGET_CAPTION).length() == 0))
+ return null;
+
+ // basic element for caption is "tr" tag
+ nsIDOMElement caption = visualDocument.createElement(HTML.TAG_TR);
+
+ // create source caption label
+ caption.appendChild(createCaptionLabel(visualDocument, labels
+ .get(SOURCE_CAPTION)));
+ // create target caption label
+ caption.appendChild(createCaptionLabel(visualDocument, labels
+ .get(TARGET_CAPTION)));
+
+ return caption;
+
+ }
+
+ /**
+ * create caption label
+ *
+ * @param visualDocument
+ * @param label
+ * @return
+ */
+ private nsIDOMElement createCaptionLabel(nsIDOMDocument visualDocument,
+ String label) {
+
+ // create "td" for target caption label
+ nsIDOMElement captionLabelTd = visualDocument
+ .createElement(HTML.TAG_TD);
+
+ // set attributes
+ captionLabelTd.setAttribute(HTML.ATTR_COLSPAN, "2");
+ captionLabelTd.setAttribute(HTML.ATTR_CLASS,
+ "rich-shuttle-caption-label");
+
+ // add to "td" value of captionLabel
+ nsIDOMText captionLabelText = visualDocument.createTextNode(label);
+
+ captionLabelTd.appendChild(captionLabelText);
+
+ return captionLabelTd;
+
+ }
+
+ /**
+ * create box (list)
+ *
+ * @param visualDocument
+ * @param creationData
+ * @return
+ */
+ private nsIDOMElement createBox(nsIDOMDocument visualDocument,
+ VpeCreationData creationData, List<Node> children) {
+
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-box");
+ // create table element
+ nsIDOMElement box = visualDocument.createElement(HTML.TAG_TABLE);
+ // box.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-box");
+
+ // create "tr" for box
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ tr.setAttribute(HTML.ATTR_STYLE, "vertical-align:top");
+
+ VpeChildrenInfo trInfo = new VpeChildrenInfo(tr);
+ creationData.addChildrenInfo(trInfo);
+
+ // add children to "tr" element
+ for (Node child : children) {
+ if ("column".equals(child.getLocalName())) {
+ trInfo.addSourceChild(child);
+ }
+ }
+
+ // add "tr" to table
+ box.appendChild(tr);
+ div.appendChild(box);
+ return div;
+ }
+
+ /**
+ * create buttons block
+ *
+ * @param visualDocument
+ * @param buttonNames
+ * @return
+ */
+ private nsIDOMElement createButtonsBlock(nsIDOMDocument visualDocument,
+ List<String> buttonNames) {
+
+ // create "div"
+ nsIDOMElement buttonsBlock = visualDocument.createElement(HTML.TAG_DIV);
+ buttonsBlock.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-controls");
+
+ for (String buttonId : buttonNames) {
+
+ buttonsBlock.appendChild(createButton(visualDocument, labels
+ .get(buttonId), buttonImages.get(buttonId)));
+
+ }
+
+ return buttonsBlock;
+
+ }
+
+ /**
+ * create button
+ *
+ * @param visualDocument
+ * @param buttonValue
+ * @param buttonImage
+ * @return
+ */
+ private nsIDOMElement createButton(nsIDOMDocument visualDocument,
+ String buttonValue, String buttonImageFile) {
+
+ nsIDOMElement buttonSpace = visualDocument.createElement(HTML.TAG_DIV);
+ buttonSpace.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-control");
+
+ // button represent "div" element
+ nsIDOMElement button = visualDocument.createElement(HTML.TAG_DIV);
+ button.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-button");
+ button.setAttribute(HTML.ATTR_STYLE, ComponentUtil
+ .getBackgoundImgStyle("shuttle/button.gif"));
+
+ // button represent "div" element
+ nsIDOMElement buttonContent = visualDocument
+ .createElement(HTML.TAG_DIV);
+ buttonContent.setAttribute(HTML.ATTR_CLASS,
+ "rich-shuttle-button-content");
+
+ nsIDOMElement buttonImage = visualDocument.createElement(HTML.TAG_IMG);
+
+ buttonImage.setAttribute(HTML.ATTR_WIDTH, "15");
+ buttonImage.setAttribute(HTML.ATTR_HEIGHT, "15");
+ buttonImage
+ .setAttribute(HTML.ATTR_CLASS, "rich-shuttle-button-content");
+ ComponentUtil.setImg(buttonImage, buttonImageFile);
+
+ nsIDOMText buttonText = visualDocument.createTextNode(buttonValue);
+
+ buttonContent.appendChild(buttonImage);
+ buttonContent.appendChild(buttonText);
+
+ button.appendChild(buttonContent);
+ buttonSpace.appendChild(button);
+
+ return buttonSpace;
+
+ }
+
+ /**
+ * prepare data
+ *
+ * @param sourceElement
+ */
+ void prepareData(Element sourceElement) {
+
+ // prepare labels
+ labels.clear();
+
+ Set<String> labelsKeys = defaultLabels.keySet();
+ for (String key : labelsKeys) {
+
+ String label = sourceElement.getAttribute(key + "Label");
+ if (label != null)
+ labels.put(key, label);
+ else
+ labels.put(key, defaultLabels.get(key));
+ }
+
+ // prepare source buttons
+ sourceButtons.clear();
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_FAST_MOVE_CONTROLS_VIZIBLE)))
+ sourceButtons.addAll(fastMoveButtons);
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_MOVE_CONTROLS_VIZIBLE)))
+ sourceButtons
+ .addAll(sourceButtons.size() == 0 ? 0 : 1, moveButtons);
+
+ // prepare target buttons
+ targetButtons.clear();
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_FAST_ORDER_CONTROLS_VIZIBLE)))
+ targetButtons.addAll(fastOrderButtons);
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_ORDER_CONTROLS_VIZIBLE)))
+ targetButtons.addAll(targetButtons.size() == 0 ? 0 : 1,
+ orderButtons);
+
+ // prepare buttons attributes
+ sourceButtonsAlign = sourceElement
+ .getAttribute(ATTR_MOVE_CONTROLS_VERTICAL_ALIGN) != null ? sourceElement
+ .getAttribute(ATTR_MOVE_CONTROLS_VERTICAL_ALIGN)
+ : DEFAULT_BUTTON_ALIGN;
+
+ targetButtonsAlign = sourceElement
+ .getAttribute(ATTR_ORDER_CONTROLS_VERTICAL_ALIGN) != null ? sourceElement
+ .getAttribute(ATTR_ORDER_CONTROLS_VERTICAL_ALIGN)
+ : DEFAULT_BUTTON_ALIGN;
+
+ // prepare lists attributes
+ listsHeight = sourceElement.getAttribute(ATTR_LISTS_HEIGHT) != null ? sourceElement
+ .getAttribute(ATTR_LISTS_HEIGHT)
+ : DEFAULT_LIST_HEIGHT;
+
+ sourceListsWidth = sourceElement.getAttribute(ATTR_SOURCE_LIST_WIDTH) != null ?
sourceElement
+ .getAttribute(ATTR_SOURCE_LIST_WIDTH)
+ : DEFAULT_LIST_WIDTH;
+
+ targetListsWidth = sourceElement.getAttribute(ATTR_TARGET_LIST_WIDTH) != null ?
sourceElement
+ .getAttribute(ATTR_TARGET_LIST_WIDTH)
+ : DEFAULT_LIST_WIDTH;
+ }
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-15
17:40:34 UTC (rev 5722)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-15
17:42:36 UTC (rev 5723)
@@ -718,6 +718,42 @@
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
</vpe:template>
- </vpe:tag>
-
+ </vpe:tag>
+
+ <vpe:tag name="rich:listShuttle" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesListShuttleTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="column" />
+ </vpe:drop>
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="BlockFormat" addChildren="deny" />
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
</vpe:templates>
\ No newline at end of file