Author: asakharov
Date: 2007-10-10 08:13:45 -0400 (Wed, 10 Oct 2007)
New Revision: 4087
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
Log:
vpe richFaces panelMenuItem
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css 2007-10-10
12:13:19 UTC (rev 4086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css 2007-10-10
12:13:45 UTC (rev 4087)
@@ -0,0 +1,68 @@
+
+.dr-pmenu-top-group-div {
+ border-color:#C4C0B9;
+}
+
+.dr-pmenu-top-group-div {
+ border:1px solid;
+ margin-bottom:3px;
+ padding:1px;
+ border-color:#C4C0B9;
+
+}
+
+.dr-pmenu-top-group {
+ background-color:#D4CFC7;
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ font-weight:bold;
+}
+
+.dr-pmenu-top-group {
+ background-position:left top;
+ background-repeat:repeat-x;
+ cursor:pointer;
+ height:20px;
+ padding:2px 1px 2px 2px;
+ width:100%;
+}
+
+.dr-pmenu-nowrap {
+ white-space:nowrap;
+}
+
+element.style {
+ width:100%;
+}
+
+.dr-pmenu-selected-item {
+ font-style:italic;
+}
+
+.dr-pmenu-group-self-label {
+ padding-left:5px;
+ width:100%;
+}
+
+
+
+
+
+.dr-pmenu-item {
+ border-top:1px solid;
+ cursor:pointer;
+ margin-top:1px;
+ padding:2px 1px 1px;
+}
+
+.dr-pmenu-item {
+ border-top-color: #C4C0B9;
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+}
+
+.dr-pmenu-nowrap {
+ white-space:nowrap;
+}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2007-10-10
12:13:19 UTC (rev 4086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2007-10-10
12:13:45 UTC (rev 4087)
@@ -1,16 +1,142 @@
+/*******************************************************************************
+ * 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.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
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.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.Text;
public class RichFacesPanelMenuItemTemplate extends VpeAbstractTemplate {
+ private static final String STYLE_PATH = "/panelMenuItem/style.css";
+
+ private static final String PANEL_MENU_ITEM_CLASS = "dr-pmenu-item";
+
+ private static final String NO_SIZE_VALUE = "0";
+
+ private static final String DEFAULT_SIZE_VALUE = "16";
+
+ private static final String PANEL_MENU_NOWARP_CLASS = "dr-pmenu-nowrap";
+
+ private static final String PANEL_MENU_LABLE_CLASS =
"dr-pmenu-group-self-label";
+
+ private static final String PANEL_MENU_ITEM = "panelMenuItem";
+
+ private static final String IMG_POINTS_SRC = "/panelMenuItem/points.gif";
+
+ private static final String IMG_SPACER_SRC = "/panelMenuItem/spacer.gif";
+
+ private static final String EMPTY_DIV_STYLE = "display: none;";
+
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
Document visualDocument) {
- // TODO Auto-generated method stub
+
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, PANEL_MENU_ITEM);
+
+ Element sourceElement = (Element) sourceNode;
+
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ div.setAttribute("style", EMPTY_DIV_STYLE);
+ div.setAttribute("vpeSupport", PANEL_MENU_ITEM);
+ VpeCreationData creationData = new VpeCreationData(div);
+ if (sourceElement.getParentNode().getNodeName().endsWith(
+ ":panelMenuGroup")
+ || (sourceElement.getParentNode().getNodeName()
+ .endsWith(":panelMenu"))) {
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ div.appendChild(table);
+ table.setAttribute("class", PANEL_MENU_ITEM_CLASS);
+ table.setAttribute("cellpadding", NO_SIZE_VALUE);
+ table.setAttribute("cellspacing", NO_SIZE_VALUE);
+ table.setAttribute("border", NO_SIZE_VALUE);
+
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ table.appendChild(tr);
+
+ Element tdNowrap = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(tdNowrap);
+ tdNowrap.setAttribute("class", PANEL_MENU_NOWARP_CLASS);
+
+ Element imgSpacer1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ tdNowrap.appendChild(imgSpacer1);
+ imgSpacer1.setAttribute("width", DEFAULT_SIZE_VALUE);
+ imgSpacer1.setAttribute("vspace", NO_SIZE_VALUE);
+ imgSpacer1.setAttribute("hspace", NO_SIZE_VALUE);
+ imgSpacer1.setAttribute("height", DEFAULT_SIZE_VALUE);
+ ComponentUtil.setImg(imgSpacer1, IMG_SPACER_SRC);
+
+ Element imgPoints = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ tdNowrap.appendChild(imgPoints);
+ imgPoints.setAttribute("width", DEFAULT_SIZE_VALUE);
+ imgPoints.setAttribute("vspace", NO_SIZE_VALUE);
+ imgPoints.setAttribute("hspace", NO_SIZE_VALUE);
+ imgPoints.setAttribute("height", DEFAULT_SIZE_VALUE);
+ ComponentUtil.setImg(imgPoints, IMG_POINTS_SRC);
+
+ Element tdLable = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(tdLable);
+ tdLable.setAttribute("class", PANEL_MENU_LABLE_CLASS);
+ tdLable.setAttribute("style", "element.style");
+ String value = sourceElement.getAttribute("label");
+ Text text = visualDocument.createTextNode(value == null ? ""
+ : value);
+ tdLable.appendChild(text);
+
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(td);
+
+ Element imgSpacer2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ td.appendChild(imgSpacer2);
+ imgSpacer2.setAttribute("width", DEFAULT_SIZE_VALUE);
+ imgSpacer2.setAttribute("vspace", NO_SIZE_VALUE);
+ imgSpacer2.setAttribute("hspace", NO_SIZE_VALUE);
+ imgSpacer2.setAttribute("height", DEFAULT_SIZE_VALUE);
+ ComponentUtil.setImg(imgSpacer2, IMG_SPACER_SRC);
+
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+
+ if (!children.isEmpty()) {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(tdLable);
+ creationData.addChildrenInfo(childInfo);
+ for (Node child : children) {
+ if (!(child.getNodeName().endsWith(":panelMenuGroup") || child
+ .getNodeName().endsWith(":panelMenu"))) {
+ childInfo.addSourceChild(child);
+ }
+ }
+ }
+ }
+ return creationData;
+ }
+
+ public static VpeCreationData encode(VpeCreationData creationData, Element
sourceElement, Document visualDocument, Element parentVisualElement, boolean active){
return null;
}
}