JBoss Tools SVN: r3732 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources: scrollableDataTable and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-20 09:22:34 -0400 (Thu, 20 Sep 2007)
New Revision: 3732
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_aerial.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_hybrid.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_road.png
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Create resources.
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css 2007-09-20 13:22:34 UTC (rev 3732)
@@ -0,0 +1,117 @@
+.dr-table {
+ border-top: 1px solid;
+ border-left: 1px solid;
+ border-color: #C4C0B9;
+}
+
+.dr-table-cell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-cell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-header {
+ background-color: #D4CFC7;
+ background-position: top left;
+ background-repeat: repeat-x;
+}
+
+.dr-table-header-continue {
+ background-color: #D4CFC7;
+}
+
+.dr-table-headercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ color: #000000;
+ text-align: center;
+ font-weight: bold;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-subheader {
+ background-color: #F1EEE9;
+}
+
+.dr-table-subheadercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: center;
+ font-size: 11px;
+ font-color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-footercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ color: #000000;
+ text-align: left;
+ font-weight: bold;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-subfootercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: left;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-header {
+ background-color: #F1EEE9;
+}
+
+.dr-subtable-headercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: center;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-footercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: left;
+}
+
+.dr-spr {
+ display: block;
+}
+
+.dr-table-hidden {
+ overflow: hidden;
+ border: solid 1px #C4C0C9;
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_aerial.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_aerial.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_hybrid.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_hybrid.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_road.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/virtualEarth/earth_road.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
17 years, 3 months
JBoss Tools SVN: r3731 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-20 08:39:42 -0400 (Thu, 20 Sep 2007)
New Revision: 3731
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Create template for <rich:scrollableDataTable> component.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-20 11:41:40 UTC (rev 3730)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-20 12:39:42 UTC (rev 3731)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces;
/**
@@ -18,6 +18,21 @@
*/
public class HtmlComponentUtil {
+ /** HTML TAG COLGROUP */
+ public static final String HTML_TAG_COLGROUP = "colgroup";
+
+ /** scope */
+ public static final String HTML_SCOPE_ATTR = "scope";
+
+ /** HTML TAG CAPTION */
+ public static final String HTML_TAG_CAPTION = "caption";
+
+ /** HTML TAG TFOOT */
+ public static final String HTML_TAG_TFOOT = "tfoot";
+
+ /** HTML TAG THEAD */
+ public static final String HTML_TAG_THEAD = "thead";
+
/** HTML TAG DL */
public static final String HTML_TAG_DL = "dl";
@@ -62,7 +77,7 @@
/** HTML_HEIGHT_ATTR * */
public static final String HTML_HEIGHT_ATTR = "height";
-
+
/** HTML_CLASS_ATTR * */
public static final String HTML_STYLECLASS_ATTR = "styleClass";
@@ -77,13 +92,13 @@
/** HTML_ALIGN_LEFT_VALUE * */
public static final String HTML_ALIGN_LEFT_VALUE = "left";
-
+
/** HTML_ALIGN_RIGHT_VALUE * */
public static final String HTML_ALIGN_RIGHT_VALUE = "right";
/** HTML_ALIGN_CENTER_VALUE * */
- public static final String HTML_ALIGN_CENTER_VALUE = "center";
-
+ public static final String HTML_ALIGN_CENTER_VALUE = "center";
+
/** HTML_ATR_WIDTH */
public static final String HTML_ATR_WIDTH = "width";
@@ -104,34 +119,34 @@
/** HTML_TABLE_ATR_ */
public static final String FILE_PROTOCOL = "file://";
-
+
/** HTML_COLSPAN_ATTR * */
public static final String HTML_COLSPAN_ATTR = "colspan";
-
+
/** HTML_ROWSPAN_ATTR * */
public static final String HTML_ROWSPAN_ATTR = "rowspan";
-
+
/** HTML_SIZE_ATTR * */
public static final String HTML_SIZE_ATTR = "size";
-
+
/** HTML_TYPE_ATTR * */
public static final String HTML_TYPE_ATTR = "type";
-
+
/** HTML_VALUE_ATTR * */
public static final String HTML_VALUE_ATTR = "value";
-
+
/** CSS_BORDER_WIDTH */
public static final String CSS_BORDER_WIDTH = "border-width";
-
+
/** CSS_BORDER_STYLE */
public static final String CSS_BORDER_STYLE = "border-style";
-
- /** HTML_WIDTH_ATTR * */
- public static final String HTML_WIDTH_ATTR = "width";
-
- /** HTML_ATTR_VALIGN */
- public static final String HTML_ATTR_VALIGN = "valign";
-
- /** HTML_ATTR_VALIGN_MIDDLE_VALUE */
- public static final String HTML_ATTR_VALIGN_MIDDLE_VALUE = "middle";
+
+ /** HTML_WIDTH_ATTR * */
+ public static final String HTML_WIDTH_ATTR = "width";
+
+ /** HTML_ATTR_VALIGN */
+ public static final String HTML_ATTR_VALIGN = "valign";
+
+ /** HTML_ATTR_VALIGN_MIDDLE_VALUE */
+ public static final String HTML_ATTR_VALIGN_MIDDLE_VALUE = "middle";
}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2007-09-20 12:39:42 UTC (rev 3731)
@@ -0,0 +1,695 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.util.ArrayList;
+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.NodeList;
+
+/**
+ * Displays template for scrollableDataTable
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class RichFacesScrollableDataTableTemplate extends VpeAbstractTemplate {
+
+ final static String DEFAULT_HEIGHT = "500px";
+ final static String DEFAULT_WIDTH = "700px";
+ final static String HEADER = "header";
+ final static String HEADER_CLASS = "headerClass";
+ final static String FOOTER = "footer";
+ final static String FOOTER_CLASS = "footerClass";
+ final static String CAPTION_CLASS = "captionClass";
+ final static String CAPTION_STYLE = "captionStyle";
+ final static String SPACE = " ";
+
+ private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
+ private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
+
+ private static int NUM_ROW = 5;
+
+ /**
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ Element sourceElement = (Element) sourceNode;
+
+ String width = sourceElement
+ .getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR);
+ String height = sourceElement
+ .getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR);
+
+ // -----------CommonTable
+ Element tableCommon = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ VpeCreationData creationData = new VpeCreationData(tableCommon);
+
+ Element tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ Element tr2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ tableCommon.appendChild(tr1);
+ tableCommon.appendChild(tr2);
+
+ // ---------tr2
+ Element tr2_TD = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr2.appendChild(tr2_TD);
+
+ Element tr2_td_DIV = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ tr2_td_DIV.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ STYLE_FOR_LOW_SCROLL);
+ tr2_TD.appendChild(tr2_td_DIV);
+
+ // --------------------------------------------
+
+ // ---------------------tr1------------------------
+ Element tr1_TD1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr1.appendChild(tr1_TD1);
+
+ Element tr1_TD2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr1.appendChild(tr1_TD2);
+
+ Element tr1_td2_DIV = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ tr1_td2_DIV.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ STYLE_FOR_RIGHT_SCROLL);
+ tr1_TD2.appendChild(tr1_td2_DIV);
+
+ // -------------------------------------------------------
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ tr1_TD1.appendChild(div);
+ div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-table-hidden");
+
+ String divStyle = HtmlComponentUtil.HTML_WIDTH_ATTR + " : "
+ + (width == null ? DEFAULT_WIDTH : width) + ";"
+ + HtmlComponentUtil.HTML_HEIGHT_ATTR + " : "
+ + (height == null ? DEFAULT_HEIGHT : height) + ";";
+
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, divStyle);
+
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ ComponentUtil.copyAttributes(sourceNode, table);
+ table.removeAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT);
+ div.appendChild(table);
+
+ ComponentUtil.setCSSLink(pageContext,
+ "scrollableDataTable/scrollableDataTable.css",
+ "richFacesDataTable");
+ String tableClass = sourceElement
+ .getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ table
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-table rich-table "
+ + (tableClass == null ? "" : tableClass));
+
+ // Encode colgroup definition.
+ ArrayList<Element> columns = getColumns(sourceElement);
+ int columnsLength = getColumnsCount(sourceElement, columns);
+ Element colgroup = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_COLGROUP);
+ colgroup.setAttribute(HtmlComponentUtil.HTML_TAG_SPAN, String
+ .valueOf(columnsLength));
+ table.appendChild(colgroup);
+
+ // Encode Caption
+ encodeCaption(creationData, sourceElement, visualDocument, table);
+
+ // Encode Header
+ Element header = ComponentUtil.getFacet(sourceElement, HEADER);
+ ArrayList<Element> columnsHeaders = getColumnsWithFacet(columns, HEADER);
+ if (header != null || !columnsHeaders.isEmpty()) {
+ Element thead = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_THEAD);
+ table.appendChild(thead);
+ String headerClass = (String) sourceElement
+ .getAttribute(HEADER_CLASS);
+ if (header != null) {
+ encodeTableHeaderOrFooterFacet(creationData, thead,
+ columnsLength, visualDocument, header,
+ "dr-table-header rich-table-header",
+ "dr-table-header-continue rich-table-header-continue",
+ "dr-table-headercell rich-table-headercell",
+ headerClass, HtmlComponentUtil.HTML_TAG_TD);
+ }
+ if (!columnsHeaders.isEmpty()) {
+ Element tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ thead.appendChild(tr);
+ String styleClass = encodeStyleClass(null,
+ "dr-table-subheader rich-table-subheader", null,
+ headerClass);
+ if (styleClass != null) {
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClass);
+ }
+ encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ columnsHeaders,
+ "dr-table-subheadercell rich-table-subheadercell",
+ headerClass, HEADER, HtmlComponentUtil.HTML_TAG_TD);
+ }
+ }
+
+ // Encode Footer
+ Element footer = ComponentUtil.getFacet(sourceElement, FOOTER);
+ ArrayList<Element> columnsFooters = getColumnsWithFacet(columns, FOOTER);
+ if (footer != null || !columnsFooters.isEmpty()) {
+ Element tfoot = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TFOOT);
+ table.appendChild(tfoot);
+ String footerClass = (String) sourceElement
+ .getAttribute(FOOTER_CLASS);
+ if (!columnsFooters.isEmpty()) {
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ tfoot.appendChild(tr);
+ String styleClass = encodeStyleClass(null,
+ "dr-table-subfooter rich-table-subfooter", null,
+ footerClass);
+ if (styleClass != null) {
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClass);
+ }
+ encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ columnsFooters,
+ "dr-table-subfootercell rich-table-subfootercell",
+ footerClass, FOOTER, HtmlComponentUtil.HTML_TAG_TD);
+ }
+ if (footer != null) {
+ encodeTableHeaderOrFooterFacet(creationData, tfoot,
+ columnsLength, visualDocument, footer,
+ "dr-table-footer rich-table-footer",
+ "dr-table-footer-continue rich-table-footer-continue",
+ "dr-table-footercell rich-table-footercell",
+ footerClass, HtmlComponentUtil.HTML_TAG_TD);
+ }
+ }
+
+ Element tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ table.appendChild(tbody);
+
+ // Create mapping to Encode body
+ for (int i = 0; i < NUM_ROW; i++) {
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ boolean firstRow = true;
+ Element tr = null;
+ VpeChildrenInfo trInfo = null;
+ for (Node child : children) {
+ if (child.getNodeName().endsWith(":column")) {
+ String breakBefore = ((Element) child)
+ .getAttribute("breakBefore");
+ if (breakBefore != null
+ && breakBefore.equalsIgnoreCase("true")) {
+ tr = null;
+ }
+ if (tr == null) {
+ tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ if (firstRow) {
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-table-firstrow rich-table-firstrow");
+ firstRow = false;
+ } else {
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-table-row rich-table-row");
+ }
+ trInfo = new VpeChildrenInfo(tr);
+ tbody.appendChild(tr);
+ creationData.addChildrenInfo(trInfo);
+ }
+ trInfo.addSourceChild(child);
+ } else if (child.getNodeName().endsWith(":columnGroup")) {
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
+ creationData, (Element) child, visualDocument,
+ tbody);
+ tr = null;
+ } else if (child.getNodeName().endsWith(":subTable")) {
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
+ creationData, (Element) child, visualDocument,
+ tbody);
+ tr = null;
+ } else {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(tbody);
+ childInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childInfo);
+ tr = null;
+ }
+ }
+ }
+
+ return creationData;
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param sourceElement
+ * @param visualDocument
+ * @param table
+ */
+ protected void encodeCaption(VpeCreationData creationData,
+ Element sourceElement, Document visualDocument,
+ Element table) {
+ // Encode caption
+ Element captionFromFacet = ComponentUtil.getFacet(sourceElement,
+ HtmlComponentUtil.HTML_TAG_CAPTION);
+ if (captionFromFacet != null) {
+ String captionClass = (String) table.getAttribute(CAPTION_CLASS);
+ String captionStyle = (String) table.getAttribute(CAPTION_STYLE);
+
+ Element caption = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_CAPTION);
+ table.appendChild(caption);
+ if (captionClass != null && captionClass.length() > 0) {
+ captionClass = "dr-table-caption rich-table-caption "
+ + captionClass;
+ } else {
+ captionClass = "dr-table-caption rich-table-caption";
+ }
+ caption.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ captionClass);
+ if (captionStyle != null && captionStyle.length() > 0) {
+ caption.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ captionStyle);
+ }
+
+ VpeChildrenInfo cap = new VpeChildrenInfo(caption);
+ cap.addSourceChild(captionFromFacet);
+ creationData.addChildrenInfo(cap);
+ }
+
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param parentTr
+ * @param visualDocument
+ * @param headersOrFooters
+ * @param skinCellClass
+ * @param headerClass
+ * @param facetName
+ * @param element
+ */
+ public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
+ Element parentTr, Document visualDocument,
+ ArrayList<Element> headersOrFooters, String skinCellClass,
+ String headerClass, String facetName, String element) {
+ for (Element column : headersOrFooters) {
+ String classAttribute = facetName + "Class";
+ String columnHeaderClass = column.getAttribute(classAttribute);
+ Element td = visualDocument.createElement(element);
+ parentTr.appendChild(td);
+ String styleClass = encodeStyleClass(null, skinCellClass,
+ headerClass, columnHeaderClass);
+ td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ td.setAttribute("scop", "col");
+ String colspan = column
+ .getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
+ if (colspan != null && colspan.length() > 0) {
+ td.setAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN, colspan);
+ }
+ Element facetBody = ComponentUtil.getFacet(column, facetName);
+
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
+ child.addSourceChild(facetBody);
+ creationData.addChildrenInfo(child);
+ }
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param parentTheadOrTfood
+ * @param columns
+ * @param visualDocument
+ * @param facetBody
+ * @param skinFirstRowClass
+ * @param skinRowClass
+ * @param skinCellClass
+ * @param facetBodyClass
+ * @param element
+ */
+ protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ Element parentTheadOrTfood, int columns,
+ Document visualDocument, Element facetBody,
+ String skinFirstRowClass, String skinRowClass,
+ String skinCellClass, String facetBodyClass, String element) {
+ boolean isColumnGroup = facetBody.getNodeName()
+ .endsWith(":columnGroup");
+ boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
+ if (isColumnGroup) {
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ facetBody, visualDocument, parentTheadOrTfood);
+ } else if (isSubTable) {
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ facetBody, visualDocument, parentTheadOrTfood);
+ } else {
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ parentTheadOrTfood.appendChild(tr);
+
+ String styleClass = encodeStyleClass(null, skinFirstRowClass,
+ facetBodyClass, null);
+ if (styleClass != null) {
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ }
+ String style = ComponentUtil.getHeaderBackgoundImgStyle();
+ tr.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+
+ Element td = visualDocument.createElement(element);
+ tr.appendChild(td);
+
+ styleClass = encodeStyleClass(null, skinCellClass, facetBodyClass,
+ null);
+ if (styleClass != null) {
+ td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ }
+
+ if (columns > 0) {
+ td.setAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN, String
+ .valueOf(columns));
+ }
+ td.setAttribute(HtmlComponentUtil.HTML_SCOPE_ATTR,
+ HtmlComponentUtil.HTML_TAG_COLGROUP);
+
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
+ child.addSourceChild(facetBody);
+ creationData.addChildrenInfo(child);
+ }
+ }
+
+ /**
+ *
+ * @param parentSourceElement
+ * @return list of columns
+ */
+ public static ArrayList<Element> getColumns(Element parentSourceElement) {
+ ArrayList<Element> columns = new ArrayList<Element>();
+ NodeList children = parentSourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if ((child instanceof Element)
+ && child.getNodeName().endsWith(":column")) {
+ columns.add((Element) child);
+ }
+ }
+ return columns;
+ }
+
+ /**
+ *
+ * @param columns
+ * @param facetName
+ * @return list of columns with facet
+ */
+ public static ArrayList<Element> getColumnsWithFacet(
+ ArrayList<Element> columns, String facetName) {
+ ArrayList<Element> columnsWithFacet = new ArrayList<Element>();
+ for (Element column : columns) {
+ Element body = ComponentUtil.getFacet(column, facetName);
+ if (body != null) {
+ columnsWithFacet.add(column);
+ }
+ }
+ return columnsWithFacet;
+ }
+
+ /**
+ *
+ * @param parentPredefined
+ * @param predefined
+ * @param parent
+ * @param custom
+ * @return
+ */
+ public static String encodeStyleClass(Object parentPredefined,
+ Object predefined, Object parent, Object custom) {
+ StringBuffer styleClass = new StringBuffer();
+ // Construct predefined classes
+ if (null != parentPredefined) {
+ styleClass.append(parentPredefined).append(SPACE);
+ } else if (null != predefined) {
+ styleClass.append(predefined).append(SPACE);
+ }
+ // Append class from parent component.
+ if (null != parent) {
+ styleClass.append(parent).append(SPACE);
+ }
+ if (null != custom) {
+ styleClass.append(custom);
+ }
+ if (styleClass.length() > 0) {
+ return styleClass.toString();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * @param columns
+ * @return
+ */
+ protected int getColumnsCount(Element sourceElement,
+ ArrayList<Element> columns) {
+ int count = 0;
+ // check for exact value in component
+ Integer span = null;
+ try {
+ span = Integer.valueOf(sourceElement.getAttribute("columns"));
+ } catch (Exception e) {
+ // Ignore bad attribute
+ }
+ if (null != span && span.intValue() != Integer.MIN_VALUE) {
+ count = span.intValue();
+ } else {
+ // calculate max html columns count for all columns/rows children.
+ count = calculateRowColumns(sourceElement, columns);
+ }
+ return count;
+ }
+
+ /*
+ * Calculate max number of columns per row. For rows, recursive calculate
+ * max length.
+ */
+ private int calculateRowColumns(Element sourceElement,
+ ArrayList<Element> columns) {
+ int count = 0;
+ int currentLength = 0;
+ for (Element column : columns) {
+ if (ComponentUtil.isRendered(column)) {
+ if (column.getNodeName().endsWith(":columnGroup")) {
+ // Store max calculated value of previsous rows.
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ // Calculate number of columns in row.
+ currentLength = calculateRowColumns(sourceElement,
+ getColumns(column));
+ // Store max calculated value
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ } else if (column.getNodeName().equals(
+ sourceElement.getPrefix() + ":column")) {
+ String breakBeforeStr = column.getAttribute("breakBefore");
+ boolean breakBefore = false;
+ if (breakBeforeStr != null) {
+ try {
+ breakBefore = Boolean.getBoolean(breakBeforeStr);
+ } catch (Exception e) {
+ // Ignore bad attribute
+ }
+ }
+ // For new row, save length of previsous.
+ if (breakBefore) {
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ }
+ String colspanStr = column
+ .getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
+ Integer colspan = null;
+ try {
+ colspan = Integer.valueOf(colspanStr);
+ } catch (Exception e) {
+ // Ignore
+ }
+ // Append colspan of this column
+ if (null != colspan
+ && colspan.intValue() != Integer.MIN_VALUE) {
+ currentLength += colspan.intValue();
+ } else {
+ currentLength++;
+ }
+ } else if (column.getNodeName().endsWith(":column")) {
+ // UIColumn always have colspan == 1.
+ currentLength++;
+ }
+
+ }
+ }
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ return count;
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Attribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument,
+ Element visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ // @Override
+ // public void removeAttribute(VpePageContext pageContext,
+ // Element sourceElement, nsIDOMDocument visualDocument,
+ // nsIDOMNode visualNode, Object data, String name) {
+ // nsIDOMElement visualElement = (nsIDOMElement) visualNode
+ // .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ // if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR)) {
+ // String style = visualElement
+ // .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // visualElement.removeAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // style += "; " + HtmlComponentUtil.HTML_WIDTH_ATTR + " : "
+ // + DEFAULT_WIDTH + ";";
+ // visualElement
+ // .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ //
+ // } else
+ //
+ // if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR)) {
+ // String style = visualElement
+ // .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // visualElement.removeAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // style += "; " + HtmlComponentUtil.HTML_HEIGHT_ATTR + " : "
+ // + DEFAULT_HEIGHT + ";";
+ // visualElement
+ // .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ //
+ // } else {
+ // visualElement.removeAttribute(name);
+ // }
+ // }
+ //
+ // @Override
+ // public void setAttribute(VpePageContext pageContext, Element
+ // sourceElement,
+ // nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data,
+ // String name, String value) {
+ // nsIDOMElement visualElement = (nsIDOMElement) visualNode
+ // .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ // if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR)) {
+ // String style = visualElement
+ // .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // visualElement.removeAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // style += "; " + HtmlComponentUtil.HTML_WIDTH_ATTR + " : " + value
+ // + ";";
+ // visualElement
+ // .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ //
+ // }
+ //
+ // if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR)) {
+ // String style = visualElement
+ // .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // visualElement.removeAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ // style += "; " + HtmlComponentUtil.HTML_HEIGHT_ATTR + " : " + value
+ // + ";";
+ // visualElement
+ // .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ //
+ // }
+ // visualElement.setAttribute(name, value);
+ // }
+
+}
+// html code
+// <table style="border: 1px solid;">
+// <tr>
+// <td>
+// <table>
+// <tr>
+// <td>
+// <input type="text"/>ibsert content
+// sdfsdfsdf
+// </td>
+// </tr>
+// </table>
+// </td>
+// <td>
+// <div style="overflow: scroll; width: 17px; height: 100%;">
+// </div>
+// </td>
+// </tr>
+// <tr>
+// <td>
+// <div style="overflow: scroll; width: 100%; height: 17px;">
+// </div>
+// </td>
+// </tr>
+// <table/>
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
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 2007-09-20 11:41:40 UTC (rev 3730)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-20 12:39:42 UTC (rev 3731)
@@ -533,4 +533,45 @@
</span>
</vpe:template>
</vpe:tag>
+
+ <vpe:tag name="rich:scrollableDataTable" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesScrollableDataTableTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <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:pseudoContent defaultText="yes"/>
+ </vpe:template>
+ </vpe:tag>
+
</vpe:templates>
\ No newline at end of file
17 years, 3 months
JBoss Tools SVN: r3730 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-20 07:41:40 -0400 (Thu, 20 Sep 2007)
New Revision: 3730
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Create template for <rich:insert>, <rich:message>, <rich:messages>, <rich:toolTip>, <rich:effect>, <rich:virtualEarth>, <rich:changeExpandListener>
<rich:nodeSelectListener> components.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2007-09-20 11:41:40 UTC (rev 3730)
@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="lib" path="lib/jhighlight-1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF 2007-09-20 11:41:40 UTC (rev 3730)
@@ -15,3 +15,5 @@
org.eclipse.ui.ide
Eclipse-LazyStart: true
Bundle-Vendor: Red Hat, Inc.
+Bundle-ClassPath: lib/jhighlight-1.0.jar,
+ .
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties 2007-09-20 11:41:40 UTC (rev 3730)
@@ -4,7 +4,8 @@
.,\
resources/,\
templates/,\
- plugin.xml
+ plugin.xml,\
+ lib/jhighlight-1.0.jar
src.includes = src/,\
resources/,\
templates/
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/x-jar
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -281,6 +281,22 @@
img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
}
}
+
+ /**
+ * Open file
+ *
+ * @param pageContext
+ * Page Context
+ * @param fileName
+ * file name
+ * @return file
+ */
+ public static File openFile(VpePageContext pageContext, String fileName) {
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ File file = new File(inputPath.toOSString() + File.separator + fileName);
+ return file;
+ }
/**
* Returns locale of user input
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -62,6 +62,9 @@
/** HTML_HEIGHT_ATTR * */
public static final String HTML_HEIGHT_ATTR = "height";
+
+ /** HTML_CLASS_ATTR * */
+ public static final String HTML_STYLECLASS_ATTR = "styleClass";
/** HTML_CLASS_ATTR * */
public static final String HTML_CLASS_ATTR = "class";
@@ -74,6 +77,9 @@
/** HTML_ALIGN_LEFT_VALUE * */
public static final String HTML_ALIGN_LEFT_VALUE = "left";
+
+ /** HTML_ALIGN_RIGHT_VALUE * */
+ public static final String HTML_ALIGN_RIGHT_VALUE = "right";
/** HTML_ALIGN_CENTER_VALUE * */
public static final String HTML_ALIGN_CENTER_VALUE = "center";
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringBufferInputStream;
+import java.util.HashMap;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+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.VpeCreationData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import com.uwyn.jhighlight.renderer.Renderer;
+import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
+
+/**
+ *
+ * @author ezheleznyakov(a)exadel.com
+ *
+ */
+public class RichFacesInsertTemplate extends VpeAbstractTemplate {
+
+ private static String SRC_ATTR_NAME = "src";
+ private static String HIGHTLIGHT_ATTR_NAME = "highlight";
+
+ private static String CODE_TAG = "code>";
+
+ private static String CLASS = "class=";
+
+ private static String STYLE = "style=";
+
+ private static String OPEN_BRACKET = "{";
+ private static String CLOSE_BRACKET = "}";
+
+ private static String SPACE = " ";
+
+ private static String SPAN_TAG = "<span style=\"color: rgb(255,255,255)\">_</span>";
+
+ private static String EMPTY_STRING = "";
+
+ private static String HTML = "html";
+ private static String XHTML = "xhtml";
+ private static String XML = "xml";
+ private static String JAVA = "java";
+ private static String CPP = "cpp";
+ private static String GROOVY = "groovy";
+ private static String LZX = "lzx";
+
+ private Document visualDocument;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ this.visualDocument = visualDocument;
+
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ String srcValue = ((Element) sourceNode).getAttribute(SRC_ATTR_NAME);
+ String highlightValue = ((Element) sourceNode)
+ .getAttribute(HIGHTLIGHT_ATTR_NAME);
+
+ VpeCreationData vpeCreationData = new VpeCreationData(div);
+
+ File file = ComponentUtil.openFile(pageContext, srcValue);
+ String finalStr = "";
+ String buf = "";
+
+ if (srcValue == null)
+ return vpeCreationData;
+
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ new FileInputStream(file)));
+
+ while ((buf = br.readLine()) != null)
+ finalStr += buf + "\n";
+
+ } catch (Exception e) {
+ finalStr = "Resources " + srcValue + " not found.";
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "color: red; "
+ + "font-weight: bold;");
+ Text text = visualDocument.createTextNode(finalStr);
+ div.appendChild(text);
+ return vpeCreationData;
+ }
+
+ if (!serchInSupportedTypes(highlightValue))
+ return vpeCreationData;
+
+ if (highlightValue == null) {
+ finalStr = finalStr.replace('\n', ' ');
+ Text text = visualDocument.createTextNode(finalStr);
+ div.appendChild(text);
+ return vpeCreationData;
+ }
+
+ Renderer renderer = XhtmlRendererFactory.getRenderer(highlightValue);
+ String transformStr = null;
+ try {
+ transformStr = renderer.highlight("", finalStr, "utf-8", false);
+ transformStr = convertString(transformStr, highlightValue);
+ Node node = parseTransformString(transformStr);
+ buildVisualNode(node, div);
+ } catch (IOException e1) {
+ return vpeCreationData;
+ }
+ return vpeCreationData;
+ }
+
+ /**
+ *
+ * @param str
+ * @param highlightValue
+ * highlight attribute value
+ */
+ private String convertString(String str, String highlightValue) {
+
+ HashMap<String, String> map = new HashMap<String, String>();
+
+ if (highlightValue.equalsIgnoreCase(HTML)
+ || highlightValue.equalsIgnoreCase(XHTML)
+ || highlightValue.equalsIgnoreCase(LZX))
+ highlightValue = XML;
+ if (highlightValue.equalsIgnoreCase(GROOVY))
+ highlightValue = JAVA;
+ if (highlightValue.equalsIgnoreCase("c++"))
+ highlightValue = CPP;
+
+ String sym = "." + highlightValue + "_";
+
+ for (int i = 0; i < str.length();) {
+ int start = str.indexOf(sym, i);
+ if (start == -1)
+ break;
+ int startBracket = str.indexOf(OPEN_BRACKET, start);
+ String key = str.substring(start + 1, startBracket - 1);
+ int endBracket = str.indexOf(CLOSE_BRACKET, startBracket);
+ String value = str.substring(startBracket + 2, endBracket - 2);
+ i = endBracket;
+ map.put(key, value);
+ }
+
+ int start = str.indexOf(CODE_TAG);
+ int end = str.indexOf(CODE_TAG, start + 1);
+ str = str.substring(start - 1, end + 5);
+
+ str = str.replaceAll(CLASS, STYLE);
+
+ Set<String> set = map.keySet();
+
+ for (String key : set) {
+ String value = map.get(key);
+ str = str.replaceAll(key, value);
+ }
+ str = str.replace(SPACE, SPAN_TAG);
+ return str;
+ }
+
+ /**
+ *
+ * @param fileTransform
+ */
+ @SuppressWarnings("deprecation")
+ public Node parseTransformString(String transformString) {
+
+ DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+
+ DocumentBuilder builder = null;
+ Document doc = null;
+ Node node = null;
+ try {
+ builder = fact.newDocumentBuilder();
+ doc = builder.parse(new StringBufferInputStream(transformString));
+ node = doc.getElementsByTagName("code").item(0);
+ } catch (Exception e) {
+ return node;
+ }
+ return node;
+ }
+
+ /**
+ *
+ * @param highlightValue
+ * value of highlight attribute
+ * @return true of highlight value correct
+ */
+
+ private boolean serchInSupportedTypes(String highlightValue) {
+
+ if (highlightValue == null)
+ return true;
+
+ if (highlightValue.trim().equals(EMPTY_STRING))
+ return false;
+
+ Set<?> set = XhtmlRendererFactory.getSupportedTypes();
+
+ for (Object object : set)
+ if (highlightValue.equalsIgnoreCase((String) object))
+ return true;
+
+ return false;
+ }
+
+ /**
+ *
+ * @param node
+ * @param el
+ * @return
+ */
+ private void buildVisualNode(Node node, Element el) {
+
+ if (node instanceof Text) {
+ Text text = visualDocument.createTextNode(node.getTextContent());
+ el.appendChild(text);
+
+ } else {
+ Element elem = visualDocument.createElement(node.getNodeName());
+ el.appendChild(elem);
+
+ for (int i = 0; i < node.getAttributes().getLength(); i++)
+ elem.setAttribute(node.getAttributes().item(i).getNodeName(),
+ node.getAttributes().item(i).getNodeValue());
+
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ buildVisualNode(node.getChildNodes().item(i), elem);
+ }
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Attribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Element visualNode,
+ Object data, String name, String value) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -0,0 +1,512 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+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.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ *
+ * @author ezheleznyakov(a)exadel.com
+ *
+ */
+public class RichFacesMessageTemplate extends VpeAbstractTemplate {
+
+ protected static String PASSED_LABEL_ATTRIBUTE_NAME = "passedLabel";
+ protected static String LABEL_CLASS_ATTRIBUTE_NAME = "labelClass";
+ protected static String MARKER_CLASS_ATTRIBUTE_NAME = "markerClass";
+ protected static String MARKER_STYLE_ATTRIBUTE_NAME = "markerStyle";
+
+ protected static String ERROR_MARKER_CLASS_ATTRIBUTE_NAME = "errorMarkerClass";
+ protected static String ERROR_LABEL_CLASS_ATTRIBUTE_NAME = "errorLabelClass";
+ protected static String ERROR_CLASS_ATTRIBUTE_NAME = "errorClass";
+
+ protected static String FATAL_MARKER_CLASS_ATTRIBUTE_NAME = "fatalMarkerClass";
+ protected static String FATAL_LABEL_CLASS_ATTRIBUTE_NAME = "fatalLabelClass";
+ protected static String FATAL_CLASS_ATTRIBUTE_NAME = "fatalClass";
+
+ protected static String INFO_MARKER_CLASS_ATTRIBUTE_NAME = "infoMarkerClass";
+ protected static String INFO_LABEL_CLASS_ATTRIBUTE_NAME = "infoLabelClass";
+ protected static String INFO_CLASS_ATTRIBUTE_NAME = "infoClass";
+
+ protected static String WARN_MARKER_CLASS_ATTRIBUTE_NAME = "warnMarkerClass";
+ protected static String WARN_LABEL_CLASS_ATTRIBUTE_NAME = "warnLabelClass";
+ protected static String WARN_CLASS_ATTRIBUTE_NAME = "warnClass";
+
+ protected static String ERROR_MESSAGE = "Error message";
+ protected static String FATAL_MESSAGE = "Fatal message";
+ protected static String INFO_MESSAGE = "Info message";
+ protected static String WARNING_MESSAGE = "Warning message";
+
+ protected String passedLabelValue;
+ protected String labelClassValue;
+ protected String markerClassValue;
+ protected String markerStyleValue;
+ protected String errorMarkerClassValue;
+ protected String errorLabelClassValue;
+ protected String errorClassValue;
+ protected String fatalMarkerClassValue;
+ protected String fatalLabelClassValue;
+ protected String fatalClassValue;
+ protected String infoMarkerClassValue;
+ protected String infoLabelClassValue;
+ protected String infoClassValue;
+ protected String warnMarkerClassValue;
+ protected String warnLabelClassValue;
+ protected String warnClassValue;
+ protected String styleValue;
+ protected String styleClassValue;
+
+ protected static String[] markers = { "passedMarker", "errorMarker",
+ "fatalMarker", "infoMarker", "warnMarker" };
+
+ protected static String FACET_TAG_NAME = "f:facet";
+
+ protected static String NAME_ATTRIBUTE_NAME = "name";
+
+ private Element td1; // passed marker
+ private Element td2; // passed label
+
+ private Element tr2; // error message
+ private Element td3; // error marker
+ private Element td4; // error label
+
+ private Element tr3; // fatal message
+ private Element td5; // fatal marker
+ private Element td6; // fatal label
+
+ private Element tr4; // info message
+ private Element td7; // info marker
+ private Element td8; // info label
+
+ private Element tr5; // warn message
+ private Element td9; // warn marker
+ private Element td10; // warn label
+
+ protected VpeCreationData creationData;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ passedLabelValue = ((Element) sourceNode)
+ .getAttribute(PASSED_LABEL_ATTRIBUTE_NAME);
+ labelClassValue = ((Element) sourceNode)
+ .getAttribute(LABEL_CLASS_ATTRIBUTE_NAME);
+ markerClassValue = ((Element) sourceNode)
+ .getAttribute(MARKER_CLASS_ATTRIBUTE_NAME);
+ markerStyleValue = ((Element) sourceNode)
+ .getAttribute(MARKER_STYLE_ATTRIBUTE_NAME);
+
+ errorMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_MARKER_CLASS_ATTRIBUTE_NAME);
+ errorLabelClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_LABEL_CLASS_ATTRIBUTE_NAME);
+ errorClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_CLASS_ATTRIBUTE_NAME);
+
+ fatalMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_MARKER_CLASS_ATTRIBUTE_NAME);
+ fatalLabelClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_LABEL_CLASS_ATTRIBUTE_NAME);
+ fatalClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_CLASS_ATTRIBUTE_NAME);
+
+ infoMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_MARKER_CLASS_ATTRIBUTE_NAME);
+ infoLabelClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_LABEL_CLASS_ATTRIBUTE_NAME);
+ infoClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_CLASS_ATTRIBUTE_NAME);
+
+ warnMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_MARKER_CLASS_ATTRIBUTE_NAME);
+ warnLabelClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_LABEL_CLASS_ATTRIBUTE_NAME);
+ warnClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_CLASS_ATTRIBUTE_NAME);
+
+ styleValue = ((Element) sourceNode)
+ .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ styleClassValue = ((Element) sourceNode)
+ .getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+
+ createRichMessage(visualDocument, sourceNode);
+
+ return creationData;
+ }
+
+ protected void createRichMessage(Document visualDocument, Node sourceNode) {
+
+ // -------------------create common table
+ Element tableHeader = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ creationData = new VpeCreationData(tableHeader);
+
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ // in this td append not f:facet
+ Element td01 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ Element td02 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // ----------------create second table
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ if (styleValue != null && !styleValue.trim().equals(""))
+ table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleValue);
+ if (styleClassValue != null && !styleClassValue.trim().equals(""))
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClassValue);
+
+ // Create first row PASSED
+ Element tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ td1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ td1.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+
+ // set markerClass
+ if (markerClassValue != null && !markerClassValue.trim().equals(""))
+ td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ markerClassValue);
+
+ // set markerStyle
+ if (markerStyleValue != null && !markerStyleValue.trim().equals(""))
+ td1.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ markerStyleValue);
+
+ td2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set labelClass
+ if (labelClassValue != null && !labelClassValue.trim().equals(""))
+ td2
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ labelClassValue);
+
+ Text passedText = visualDocument
+ .createTextNode(passedLabelValue == null ? ""
+ : passedLabelValue);
+ // ---------------------------------------------------------------------
+
+ // Create second row ERROR
+ tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ // set errorClass
+ if (errorClassValue != null && !errorClassValue.trim().equals(""))
+ tr2
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorClassValue);
+
+ td3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td3.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+
+ // set errorMarkerClass
+ if (errorMarkerClassValue != null
+ && !errorMarkerClassValue.trim().equals(""))
+ td3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorMarkerClassValue);
+
+ td4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set errorLabelClass
+ if (errorLabelClassValue != null
+ && !errorLabelClassValue.trim().equals(""))
+ td4.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorLabelClassValue);
+
+ Text errorText = visualDocument.createTextNode(ERROR_MESSAGE);
+ // ---------------------------------------------------------------------
+
+ // Create third row FATAL
+ tr3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ // set fatalClass
+ if (fatalClassValue != null && !fatalClassValue.trim().equals(""))
+ tr3
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalClassValue);
+
+ td5 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td5.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+
+ // set fatalMarkerClass
+ if (fatalMarkerClassValue != null
+ && !fatalMarkerClassValue.trim().equals(""))
+ td5.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalMarkerClassValue);
+
+ td6 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set fatalLabelClass
+ if (fatalLabelClassValue != null
+ && !fatalLabelClassValue.trim().equals(""))
+ td6.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalLabelClassValue);
+
+ Text fatalText = visualDocument.createTextNode(FATAL_MESSAGE);
+ // ---------------------------------------------------------------------
+
+ // Create four row INFO
+ tr4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ // set infoClass
+ if (infoClassValue != null && !infoClassValue.trim().equals(""))
+ tr4.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, infoClassValue);
+
+ td7 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td7.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+
+ // set infoMarkerClass
+ if (infoMarkerClassValue != null
+ && !infoMarkerClassValue.trim().equals(""))
+ td7.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ infoMarkerClassValue);
+
+ td8 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set infoLabelClass
+ if (infoLabelClassValue != null
+ && !infoLabelClassValue.trim().equals(""))
+ td8.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ infoLabelClassValue);
+
+ Text infoText = visualDocument.createTextNode(INFO_MESSAGE);
+ // ---------------------------------------------------------------------
+
+ // Create fifth row WARNING
+ tr5 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ // set warnClass
+ if (warnClassValue != null && !warnClassValue.trim().equals(""))
+ tr5.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, warnClassValue);
+
+ td9 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td9.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+
+ // set warnMarkerClass
+ if (warnMarkerClassValue != null
+ && !warnMarkerClassValue.trim().equals(""))
+ td9.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ warnMarkerClassValue);
+
+ td10 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set warnLabelClass
+ if (warnLabelClassValue != null
+ && !warnLabelClassValue.trim().equals(""))
+ td10.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ warnLabelClassValue);
+
+ Text warnText = visualDocument.createTextNode(WARNING_MESSAGE);
+
+ NodeList nodeList = sourceNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+
+ if (!(nodeList.item(i) instanceof Element))
+ continue;
+
+ Element elemFacet = (Element) nodeList.item(i);
+ if (elemFacet.getNodeName().equalsIgnoreCase(FACET_TAG_NAME)
+ && searchInMarker(elemFacet
+ .getAttribute(NAME_ATTRIBUTE_NAME))) {
+
+ String markerName = elemFacet.getAttribute(NAME_ATTRIBUTE_NAME)
+ .trim();
+ // if f:facet not empty
+ if (elemFacet.getChildNodes().getLength() != 0)
+ if (markers[0].equalsIgnoreCase(markerName)) {
+ createVisualFacet(td1, elemFacet);
+ } else if (markers[1].equalsIgnoreCase(markerName)) {
+ createVisualFacet(td3, elemFacet);
+ } else if (markers[2].equalsIgnoreCase(markerName)) {
+ createVisualFacet(td5, elemFacet);
+ } else if (markers[3].equalsIgnoreCase(markerName)) {
+ createVisualFacet(td7, elemFacet);
+ } else if (markers[4].equalsIgnoreCase(markerName)) {
+ createVisualFacet(td9, elemFacet);
+ }
+ }
+ }
+
+ addNotFacetComponent(td01, sourceNode);
+
+ tableHeader.appendChild(tr);
+ tr.appendChild(td01);
+ tr.appendChild(td02);
+ td02.appendChild(table);
+
+ table.appendChild(tr1);
+ tr1.appendChild(td1);
+ tr1.appendChild(td2);
+ td2.appendChild(passedText);
+
+ table.appendChild(tr2);
+ tr2.appendChild(td3);
+ tr2.appendChild(td4);
+ td4.appendChild(errorText);
+
+ table.appendChild(tr3);
+ tr3.appendChild(td5);
+ tr3.appendChild(td6);
+ td6.appendChild(fatalText);
+
+ table.appendChild(tr4);
+ tr4.appendChild(td7);
+ tr4.appendChild(td8);
+ td8.appendChild(infoText);
+
+ table.appendChild(tr5);
+ tr5.appendChild(td9);
+ tr5.appendChild(td10);
+ td10.appendChild(warnText);
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Atrribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Element visualNode,
+ Object data, String name, String value) {
+ return true;
+ }
+
+ /**
+ *
+ * @param td01
+ */
+ protected void addNotFacetComponent(Element td01, Node sourceNode) {
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(td01);
+ creationData.addChildrenInfo(childrenInfo);
+
+ NodeList nodeList = sourceNode.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++)
+ if (!FACET_TAG_NAME.equalsIgnoreCase(nodeList.item(i).getNodeName()
+ .trim()))
+ childrenInfo.addSourceChild(nodeList.item(i));
+
+ }
+
+ /**
+ *
+ * @param markerName
+ * Marker name
+ * @return True if marker name correct or false
+ */
+ protected boolean searchInMarker(String markerName) {
+
+ if (markerName == null)
+ return false;
+
+ for (int i = 0; i < markers.length; i++)
+ if (markers[i].equalsIgnoreCase(markerName.trim()))
+ return true;
+ return false;
+ }
+
+ /**
+ *
+ * @param td
+ * @param elemFacet
+ */
+ protected void createVisualFacet(Element td, Element elemFacet) {
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(td);
+ creationData.addChildrenInfo(childrenInfo);
+
+ NodeList nodeList = elemFacet.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); i++)
+ if (!(nodeList.item(i) instanceof Element))
+ continue;
+ else {
+ childrenInfo.addSourceChild(nodeList.item(i));
+ return;
+ }
+ }
+}
+
+// HTML code component
+// <html>
+// <body>
+//
+// <table border="1px" style="border: 2px solid black;">
+// <tr>
+// <td>
+// ssdfsd
+// <p/>
+// sdfsdf
+// </td>
+// <td>
+// <table border="1px" style="color: red; border: 2px solid blue;" >
+// <tr>
+// <td></td>
+// <td>Passed message</td>
+// </tr>
+// <tr>
+// <td><img/></td>
+// <td>Error message</td>
+// </tr>
+// <tr>
+// <td></td>
+// <td>Fatal message</td>
+// </tr>
+// <tr>
+// <td></td>
+// <td>Info message</td>
+// </tr>
+// <tr>
+// <td></td>
+// <td>Warn message</td>
+// </tr>
+// </table>
+// </td>
+// <tr>
+// </table>
+// </body>
+// </html>
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -0,0 +1,319 @@
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+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.NodeList;
+import org.w3c.dom.Text;
+
+public class RichFacesMessagesTemplate extends RichFacesMessageTemplate {
+
+ private static String LAYOUT_ATTRIBUTE_NAME = "layout";
+ private static String LAYOUT_ATTRIBUTE_VALUE_TABLE = "table";
+
+ private String layoutValue;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ passedLabelValue = ((Element) sourceNode)
+ .getAttribute(PASSED_LABEL_ATTRIBUTE_NAME);
+ labelClassValue = ((Element) sourceNode)
+ .getAttribute(LABEL_CLASS_ATTRIBUTE_NAME);
+ markerClassValue = ((Element) sourceNode)
+ .getAttribute(MARKER_CLASS_ATTRIBUTE_NAME);
+ markerStyleValue = ((Element) sourceNode)
+ .getAttribute(MARKER_STYLE_ATTRIBUTE_NAME);
+
+ errorMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_MARKER_CLASS_ATTRIBUTE_NAME);
+ errorLabelClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_LABEL_CLASS_ATTRIBUTE_NAME);
+ errorClassValue = ((Element) sourceNode)
+ .getAttribute(ERROR_CLASS_ATTRIBUTE_NAME);
+
+ fatalMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_MARKER_CLASS_ATTRIBUTE_NAME);
+ fatalLabelClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_LABEL_CLASS_ATTRIBUTE_NAME);
+ fatalClassValue = ((Element) sourceNode)
+ .getAttribute(FATAL_CLASS_ATTRIBUTE_NAME);
+
+ infoMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_MARKER_CLASS_ATTRIBUTE_NAME);
+ infoLabelClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_LABEL_CLASS_ATTRIBUTE_NAME);
+ infoClassValue = ((Element) sourceNode)
+ .getAttribute(INFO_CLASS_ATTRIBUTE_NAME);
+
+ warnMarkerClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_MARKER_CLASS_ATTRIBUTE_NAME);
+ warnLabelClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_LABEL_CLASS_ATTRIBUTE_NAME);
+ warnClassValue = ((Element) sourceNode)
+ .getAttribute(WARN_CLASS_ATTRIBUTE_NAME);
+
+ styleValue = ((Element) sourceNode)
+ .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ styleClassValue = ((Element) sourceNode)
+ .getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+
+ layoutValue = ((Element) sourceNode)
+ .getAttribute(LAYOUT_ATTRIBUTE_NAME);
+
+ if (layoutValue != null
+ && LAYOUT_ATTRIBUTE_VALUE_TABLE.equalsIgnoreCase(layoutValue
+ .trim()))
+ createTableLayout(visualDocument, sourceNode);
+ else
+ createListLayout(visualDocument, sourceNode);
+
+ return creationData;
+ }
+
+ /**
+ * Create <rich:messages> with layout="table"
+ */
+ public void createTableLayout(Document visualDocument, Node sourceNode) {
+
+ createRichMessage(visualDocument, sourceNode);
+
+ }
+
+ /**
+ * Create <rich:messages> with layout="list"
+ */
+ public void createListLayout(Document visualDocument, Node sourceNode) {
+
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ if (styleValue != null && !styleValue.trim().equals(""))
+ table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleValue);
+ if (styleClassValue != null && !styleClassValue.trim().equals(""))
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClassValue);
+
+ creationData = new VpeCreationData(table);
+
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // create first td for PASSED
+ Element td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ Element span1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set markerClass
+ if (markerClassValue != null && !markerClassValue.trim().equals(""))
+ span1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ markerClassValue);
+
+ // set markerStyle
+ if (markerStyleValue != null && !markerStyleValue.trim().equals(""))
+ span1.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ markerStyleValue);
+
+ Element span2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ if (labelClassValue != null && !labelClassValue.trim().equals(""))
+ span2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ labelClassValue);
+
+ Text passedText = visualDocument
+ .createTextNode(passedLabelValue == null ? ""
+ : passedLabelValue);
+ // -----------------------------------------------------------
+
+ // Create second td for ERROR
+ Element td2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ // set errorClass
+ if (errorClassValue != null && !errorClassValue.trim().equals(""))
+ td2
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorClassValue);
+
+ Element span3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set errorMarkerClass
+ if (errorMarkerClassValue != null
+ && !errorMarkerClassValue.trim().equals(""))
+ span3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorMarkerClassValue);
+
+ Element span4 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set errorLabelClass
+ if (errorLabelClassValue != null
+ && !errorLabelClassValue.trim().equals(""))
+ span4.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ errorLabelClassValue);
+
+ Text errorText = visualDocument.createTextNode(ERROR_MESSAGE);
+ // -------------------------------------------------------------
+
+ // Create third td for FATAL
+ Element td3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set fatalClass
+ if (fatalClassValue != null && !fatalClassValue.trim().equals(""))
+ td3
+ .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalClassValue);
+
+ Element span5 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set fatalMarkerClass
+ if (fatalMarkerClassValue != null
+ && !fatalMarkerClassValue.trim().equals(""))
+ span5.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalMarkerClassValue);
+
+ Element span6 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set fatalLabelClass
+ if (fatalLabelClassValue != null
+ && !fatalLabelClassValue.trim().equals(""))
+ span6.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ fatalLabelClassValue);
+
+ Text fatalText = visualDocument.createTextNode(FATAL_MESSAGE);
+ // ---------------------------------------------------------------------------
+
+ // Create four td for INFO
+
+ Element td4 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set infoClass
+ if (infoClassValue != null && !infoClassValue.trim().equals(""))
+ td4.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, infoClassValue);
+
+ Element span7 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set infoMarkerClass
+ if (infoMarkerClassValue != null
+ && !infoMarkerClassValue.trim().equals(""))
+ span7.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ infoMarkerClassValue);
+
+ Element span8 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set infoLabelClass
+ if (infoLabelClassValue != null
+ && !infoLabelClassValue.trim().equals(""))
+ span8.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ infoLabelClassValue);
+
+ Text infoText = visualDocument.createTextNode(INFO_MESSAGE);
+ // --------------------------------------------------------------------
+
+ // Create fifth for WARN
+
+ Element td5 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // set warnClass
+ if (warnClassValue != null && !warnClassValue.trim().equals(""))
+ td5.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, warnClassValue);
+
+ Element span9 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set warnMarkerClass
+ if (warnMarkerClassValue != null
+ && !warnMarkerClassValue.trim().equals(""))
+ span9.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ warnMarkerClassValue);
+
+ Element span10 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+
+ // set warnLabelClass
+ if (warnLabelClassValue != null
+ && !warnLabelClassValue.trim().equals(""))
+ span10.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ warnLabelClassValue);
+
+ Text warnText = visualDocument.createTextNode(WARNING_MESSAGE);
+ // ---------------------------------------------------------------------
+
+ NodeList nodeList = sourceNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+
+ if (!(nodeList.item(i) instanceof Element))
+ continue;
+
+ Element elemFacet = (Element) nodeList.item(i);
+
+ if (elemFacet.getNodeName().equalsIgnoreCase(FACET_TAG_NAME)
+ && searchInMarker(elemFacet
+ .getAttribute(NAME_ATTRIBUTE_NAME))) {
+
+ String markerName = elemFacet.getAttribute(NAME_ATTRIBUTE_NAME)
+ .trim();
+
+ if (elemFacet.getChildNodes().getLength() != 0)
+ if (markers[0].equalsIgnoreCase(markerName)) {
+ createVisualFacet(span1, elemFacet);
+ } else if (markers[1].equalsIgnoreCase(markerName)) {
+ createVisualFacet(span3, elemFacet);
+ } else if (markers[2].equalsIgnoreCase(markerName)) {
+ createVisualFacet(span5, elemFacet);
+ } else if (markers[3].equalsIgnoreCase(markerName)) {
+ createVisualFacet(span7, elemFacet);
+ } else if (markers[4].equalsIgnoreCase(markerName)) {
+ createVisualFacet(span9, elemFacet);
+ }
+ }
+ }
+
+ addNotFacetComponent(td, sourceNode);
+
+ table.appendChild(tr);
+ tr.appendChild(td);
+
+ tr.appendChild(td1);
+ td1.appendChild(span1);
+ td1.appendChild(span2);
+ span2.appendChild(passedText);
+
+ tr.appendChild(td2);
+ td2.appendChild(span3);
+ td2.appendChild(span4);
+ span4.appendChild(errorText);
+
+ tr.appendChild(td3);
+ td3.appendChild(span5);
+ td3.appendChild(span6);
+ span6.appendChild(fatalText);
+
+ tr.appendChild(td4);
+ td4.appendChild(span7);
+ td4.appendChild(span8);
+ span8.appendChild(infoText);
+
+ tr.appendChild(td5);
+ td5.appendChild(span9);
+ td5.appendChild(span10);
+ span10.appendChild(warnText);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java 2007-09-20 11:41:40 UTC (rev 3730)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+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.VpeCreationData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author ezheleznyakov(a)exadel.com
+ *
+ */
+public class RichFacesVirtualEarthTemplate extends VpeAbstractTemplate {
+
+ private static String EARTH_AERIAL = "/virtualearth/earth_aerial.png";
+ private static String EARTH_HYBRID = "/virtualearth/earth_hybrid.png";
+ private static String EARTH_ROAD = "/virtualearth/earth_road.png";
+
+ private static String MAP_STYLE_ATTRIBUTE_NAME = "mapStyle";
+
+ private static String MAP_STYLE_VALUES[] = { "road", "aerial", "hybrid" };
+
+ private static String STYLE_CLASS_ATTR_NAME = "styleClass";
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ Element img = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+
+ String mapStyleValue = ((Element) sourceNode)
+ .getAttribute(MAP_STYLE_ATTRIBUTE_NAME);
+
+ if (mapStyleValue != null && searchInMapStyleValues(mapStyleValue)) {
+ if (mapStyleValue.equalsIgnoreCase(MAP_STYLE_VALUES[0]))
+ ComponentUtil.setImg(img, EARTH_ROAD);
+ else if (mapStyleValue.equalsIgnoreCase(MAP_STYLE_VALUES[1]))
+ ComponentUtil.setImg(img, EARTH_AERIAL);
+ else if (mapStyleValue.equalsIgnoreCase(MAP_STYLE_VALUES[2]))
+ ComponentUtil.setImg(img, EARTH_HYBRID);
+ } else
+ ComponentUtil.setImg(img, EARTH_ROAD);
+
+ copyStyleAttribute(img, sourceNode);
+
+ if (((Element) sourceNode).getAttribute(STYLE_CLASS_ATTR_NAME) != null)
+ img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ ((Element) sourceNode).getAttribute(STYLE_CLASS_ATTR_NAME));
+
+ return new VpeCreationData(img);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
+ * java.lang.Object, java.lang.String, java.lang.String)
+ */
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name,
+ String value) {
+
+ Element img = (Element) visualNode;
+
+ if (name.equalsIgnoreCase(MAP_STYLE_ATTRIBUTE_NAME)) {
+ if (value.trim().equalsIgnoreCase("")
+ || !searchInMapStyleValues(value)) {
+ ComponentUtil.setImg(img, EARTH_ROAD);
+ return;
+ }
+
+ if (value.equalsIgnoreCase(MAP_STYLE_VALUES[0]))
+ ComponentUtil.setImg(img, EARTH_ROAD);
+ else if (value.equalsIgnoreCase(MAP_STYLE_VALUES[1]))
+ ComponentUtil.setImg(img, EARTH_AERIAL);
+ else if (value.equalsIgnoreCase(MAP_STYLE_VALUES[2]))
+ ComponentUtil.setImg(img, EARTH_HYBRID);
+ return;
+ }
+
+ if (STYLE_CLASS_ATTR_NAME.equals(name))
+ img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, value);
+ else
+ img.setAttribute(name, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.exadel.vpe.editor.template.VpeAbstractTemplate#removeAttribute(com.exadel.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
+ * java.lang.Object, java.lang.String)
+ */
+ public void removeAttribute(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node visualNode,
+ Object data, String name) {
+
+ Element img = (Element) visualNode;
+
+ if (name.equalsIgnoreCase(MAP_STYLE_ATTRIBUTE_NAME)) {
+ ComponentUtil.setImg(img, EARTH_ROAD);
+ return;
+ }
+
+ if (STYLE_CLASS_ATTR_NAME.equals(name))
+ img.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
+ else
+ img.removeAttribute(name);
+ }
+
+ /**
+ *
+ * @param value
+ * Value of mapStyle attribute
+ * @return True if value of mapStyle attribute correct or false
+ */
+ private boolean searchInMapStyleValues(String mapStyleValue) {
+
+ for (int i = 0; i < MAP_STYLE_VALUES.length; i++)
+ if (MAP_STYLE_VALUES[i].equalsIgnoreCase(mapStyleValue.trim()))
+ return true;
+ return false;
+ }
+
+ /**
+ *
+ * @param img
+ * @param sourceNode
+ * The current node of the source tree.
+ */
+ private void copyStyleAttribute(Element img, Node sourceNode) {
+ NamedNodeMap namedNodeMap = sourceNode.getAttributes();
+ for (int i = 0; i < namedNodeMap.getLength(); i++) {
+ Node attribute = namedNodeMap.item(i);
+ if (attribute.getNodeName().equalsIgnoreCase(
+ HtmlComponentUtil.HTML_STYLE_ATTR)) {
+ img.setAttribute(attribute.getNodeName(), attribute
+ .getNodeValue());
+ return;
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesVirtualEarthTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
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 2007-09-20 09:03:53 UTC (rev 3729)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-20 11:41:40 UTC (rev 3730)
@@ -451,4 +451,86 @@
<vpe:template children="no" modify="no">
</vpe:template>
</vpe:tag>
+
+ <vpe:tag name="rich:virtualEarth" case-sensitive="yes">
+ <vpe:template children="no" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesVirtualEarthTemplate">
+
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no"></vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:toolTip" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <span style="display:none">
+ </span>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:effect" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <span style="display:none">
+ </span>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:insert" case-sensetive="yes">
+ <vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInsertTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:message" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesMessageTemplate">
+
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:messages" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesMessagesTemplate">
+
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:changeExpandListener" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <span style="display:none">
+ </span>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:nodeSelectListener" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <span style="display:none">
+ </span>
+ </vpe:template>
+ </vpe:tag>
</vpe:templates>
\ No newline at end of file
17 years, 3 months
JBoss Tools SVN: r3728 - in trunk/seam/plugins/org.jboss.tools.seam.core: templates/ejb/ejbModule/META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-19 22:00:51 -0400 (Wed, 19 Sep 2007)
New Revision: 3728
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
Log:
testNg is removed from war and ear projects
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-20 01:29:34 UTC (rev 3727)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-20 02:00:51 UTC (rev 3728)
@@ -103,8 +103,7 @@
.include("jbpm.*\\.jar")
.include("jsf-facelets\\.jar")
.include("oscache.*\\.jar")
- .include("stringtemplate.*\\.jar")
- .include("testng-.*\\.jar");
+ .include("stringtemplate.*\\.jar");
public static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
.include("testng-.*-jdk15\\.jar")
@@ -143,8 +142,7 @@
.include("jboss-seam.jar")
.include("jbpm.*\\.jar")
.include("security\\.drl")
- .include("stringtemplate.*\\.jar")
- .include("testng-.*\\.jar");
+ .include("stringtemplate.*\\.jar");
public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
.include("META-INF/application\\.xml")
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-09-20 01:29:34 UTC (rev 3727)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-09-20 02:00:51 UTC (rev 3728)
@@ -1,4 +1,3 @@
Manifest-Version: 1.0
Class-Path: jboss-seam.jar
- testng-4.5.1-jdk15.jar
@driverJar@
\ No newline at end of file
17 years, 3 months
JBoss Tools SVN: r3727 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-19 21:29:34 -0400 (Wed, 19 Sep 2007)
New Revision: 3727
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-915 - test project is broken when projects created as war
http://jira.jboss.com/jira/browse/JBIDE-919 - Seam property page has several issues (especially when no runtimes are defined)
layout issue: Combo box field is very big in the height, but very small in the width.
Getting an "The current displayed page contains invalid values" when trying to select the page.
http://jira.jboss.com/jira/browse/JBIDE-912 - If no seam runtimes are defined pressing finish result in NPE
http://jira.jboss.com/jira/browse/JBIDE-906 - Create TestNG project for Seam
Project created in the same configuration as seam-gen does: with components.properties for Web and test projects. Web project has enbedded-ejb disabled, test vice versa.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-09-20 01:29:29 UTC (rev 3726)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-09-20 01:29:34 UTC (rev 3727)
@@ -87,10 +87,11 @@
*/
DataModelValidatorDelegate validatorDelegate;
- IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
+ final IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
.createComboWithButton(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
"Seam Runtime", getRuntimeNames(),
- SeamRuntimeManager.getInstance().getDefaultRuntime()==null?"":SeamRuntimeManager.getInstance().getDefaultRuntime().getName(),
+ SeamRuntimeManager.getInstance().getDefaultRuntime()==null?
+ "":SeamRuntimeManager.getInstance().getDefaultRuntime().getName(),
true, new NewSeamRuntimeAction(), (IValidator)null);
// IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
@@ -113,7 +114,7 @@
ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
"Connection profile:",
getProfileNameList(),
- "DefaultDS",
+ getProfileNameList().contains("DefaultDS")?"DefaultDS":"",
true, new EditConnectionProfileAction(),
new NewConnectionProfileAction(),
ValidatorFactory.NO_ERRORS_VALIDATOR);
@@ -364,10 +365,6 @@
ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, event
.getProperty().toString());
}
- if (event.getPropertyName().equals(
- ISeamFacetDataModelProperties.DB_TYPE)) {
-
- }
}
public static final String GENERIC_JDBC_PROVIDER_ID
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-09-20 01:29:29 UTC (rev 3726)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-09-20 01:29:34 UTC (rev 3727)
@@ -11,10 +11,16 @@
package org.jboss.tools.seam.ui.internal.project.facet;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -30,6 +36,7 @@
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.corext.util.Messages;
+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
@@ -140,16 +147,36 @@
"Seam Home folder doesn't exist");
return errors;
}
- if (!new File(value.toString(), "seam").isFile()) {
+ File seamJarFile = new File(value.toString(), "jboss-seam.jar");
+ if (!seamJarFile.isFile()) {
errors = createErrorMap();
errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
"Home folder points to " +
- "location that does not look like seam home folder ('seam' script is missing)");
+ "location that does not look like seam home folder ('jboss-seam.jar' is missing)");
}
return errors;
}
};
+
+ public static void main(String[] args) {
+ ZipFile seamJar;
+ try {
+ seamJar = new ZipFile(new File("C:\\jboss-eap.rc1\\seam", "jboss-seam.jar"));
+
+ ZipFileStructureProvider provider = new ZipFileStructureProvider(seamJar);
+ ZipEntry entry = seamJar.getEntry("META-INF/MANIFEST.MF");
+ InputStream str = provider.getContents(entry);
+
+ Properties manifest = new Properties();
+ manifest.load(str);
+
+ System.out.println(manifest.get("Seam-Version"));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
/**
*
*/
@@ -336,7 +363,7 @@
public Map<String, String> validate(Object value, Object context) {
if (value == null || "".equals(value.toString().trim())) {
return createErrormessage(
- ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
"Seam Runtime is not selected");
}
return NO_ERRORS;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-09-20 01:29:29 UTC (rev 3726)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-09-20 01:29:34 UTC (rev 3727)
@@ -7,21 +7,25 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.preferences;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.dialogs.PropertyPage;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
@@ -29,8 +33,13 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
+import org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
/**
* @author Viacheslav Kabanovich
@@ -40,64 +49,62 @@
IFieldEditor seamEnablement;
IFieldEditor runtime;
-
+
public SeamSettingsPreferencePage() {
}
- public void setElement(IAdaptable element) {
- super.setElement(element);
- project = (IProject)getElement().getAdapter(IProject.class);
- }
+ public void setElement(IAdaptable element) {
+ super.setElement(element);
+ project = (IProject) getElement().getAdapter(IProject.class);
+ }
@Override
protected Control createContents(Composite parent) {
- ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
+ ISeamProject seamProject = SeamCorePlugin
+ .getSeamProject(project, false);
boolean hasSeamSupport = seamProject != null;
- seamEnablement = SwtFieldEditorFactory.INSTANCE.createCheckboxEditor("Seam support", "Seam support", false);
+ seamEnablement = SwtFieldEditorFactory.INSTANCE.createCheckboxEditor(
+ "Seam support", "Seam support", false);
seamEnablement.setValue(hasSeamSupport);
-
- SeamRuntime[] rs = SeamRuntimeManager.getInstance().getRuntimes();
- List<String> values = new ArrayList<String>();
- String defaultValue = null;
- for (int i = 0; i < rs.length; i++) {
- values.add(rs[i].getName());
- if(rs[i].isDefault()) defaultValue = rs[i].getName();
- }
- runtime = SwtFieldEditorFactory.INSTANCE.createComboEditor("Runtime", "Runtime", values, defaultValue);
+ SeamRuntime rs = SeamRuntimeManager.getInstance().getDefaultRuntime();
+
+ runtime = SwtFieldEditorFactory.INSTANCE.createComboWithButton("Runtime",
+ "Runtime", SeamRuntimeManager.getInstance().getRuntimeNames(),
+ rs==null?"":rs.getName(),true,new NewSeamRuntimeAction(),(IValidator)null);
+
List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
editorOrder.add(seamEnablement);
editorOrder.add(runtime);
- if(hasSeamSupport) {
+ if (hasSeamSupport) {
SeamRuntime current = seamProject.getRuntime();
- if(current != null) runtime.setValue(current.getName());
- } else {
- if(defaultValue != null) runtime.setValue(defaultValue);
+ if (current != null)
+ runtime.setValue(current.getName());
}
seamEnablement.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Object value = evt.getNewValue();
- if(value instanceof Boolean) {
- boolean v = ((Boolean)value).booleanValue();
+ if (value instanceof Boolean) {
+ boolean v = ((Boolean) value).booleanValue();
updateRuntimeEnablement(v);
validate();
}
}
});
-
+
runtime.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
validate();
}
});
-
+
Composite composite = new Composite(parent, SWT.NONE);
int columnNumber = 1;
for (IFieldEditor fieldEditor : editorOrder) {
- if(fieldEditor.getNumberOfControls()>columnNumber)
- columnNumber=fieldEditor.getNumberOfControls();
+ if (fieldEditor.getNumberOfControls() > columnNumber)
+ columnNumber = fieldEditor.getNumberOfControls();
}
GridLayout gl = new GridLayout(columnNumber, false);
gl.verticalSpacing = 5;
@@ -110,67 +117,108 @@
}
runtime.setEditable(false);
- if(!hasSeamSupport) {
+ if (!hasSeamSupport) {
updateRuntimeEnablement(false);
}
return composite;
}
-
- public boolean performOk() {
- if(getSeamSupport()) {
- addSeamSupport();
- changeRuntime();
- } else {
- removeSeamSupport();
- }
- return true;
- }
+ public boolean performOk() {
+ if (getSeamSupport()) {
+ addSeamSupport();
+ changeRuntime();
+ } else {
+ removeSeamSupport();
+ }
+ return true;
+ }
+
private void updateRuntimeEnablement(boolean enabled) {
Object[] cs = runtime.getEditorControls();
for (int i = 0; i < cs.length; i++) {
- if(cs[i] instanceof Control) {
- ((Control)cs[i]).setEnabled(enabled);
+ if (cs[i] instanceof Control) {
+ ((Control) cs[i]).setEnabled(enabled);
}
}
}
-
+
private void removeSeamSupport() {
try {
- EclipseResourceUtil.removeNatureFromProject(project, ISeamProject.NATURE_ID);
+ EclipseResourceUtil.removeNatureFromProject(project,
+ ISeamProject.NATURE_ID);
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
}
-
+
private void addSeamSupport() {
try {
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ EclipseResourceUtil.addNatureToProject(project,
+ ISeamProject.NATURE_ID);
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
}
-
+
private void changeRuntime() {
String name = getRuntimeName();
- SeamRuntime r = SeamRuntimeManager.getInstance().findRuntimeByName(name);
- if(r == null) return;
- ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
- seamProject.setRuntime(r);
+ SeamRuntime r = SeamRuntimeManager.getInstance()
+ .findRuntimeByName(name);
+ if (r == null)
+ return;
+ ISeamProject seamProject = SeamCorePlugin
+ .getSeamProject(project, false);
+ seamProject.setRuntime(r);
}
-
+
private boolean getSeamSupport() {
Object o = seamEnablement.getValue();
- return o instanceof Boolean && ((Boolean)o).booleanValue();
+ return o instanceof Boolean && ((Boolean) o).booleanValue();
}
-
+
private String getRuntimeName() {
return runtime.getValueAsString();
}
-
+
private void validate() {
- //TODO
+ if(getSeamSupport() && (runtime.getValue()== null || "".equals(runtime.getValue()))) {
+ setValid(false);
+ setErrorMessage("Seam runtime is not selected");
+ } else {
+ setValid(true);
+ setErrorMessage(null);
+ }
}
+ public class NewSeamRuntimeAction extends
+ ButtonFieldEditor.ButtonPressedAction {
+ /**
+ * @param label
+ */
+ public NewSeamRuntimeAction() {
+ super("Add");
+ }
+
+ public void run() {
+ List<SeamRuntime> added = new ArrayList<SeamRuntime>();
+ Wizard wiz = new SeamRuntimeNewWizard(
+ (List<SeamRuntime>) new ArrayList<SeamRuntime>(Arrays
+ .asList(SeamRuntimeManager.getInstance()
+ .getRuntimes())), added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+
+ if (added.size() > 0) {
+ SeamRuntimeManager.getInstance().addRuntime(added.get(0));
+ getFieldEditor().setValue(added.get(0).getName());
+ ((ITaggedFieldEditor) ((CompositeEditor) runtime)
+ .getEditors().get(1)).setTags(SeamRuntimeManager.getInstance().getRuntimeNames()
+ .toArray(new String[0]));
+ runtime.setValue(added.get(0).getName());
+ }
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-20 01:29:29 UTC (rev 3726)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-20 01:29:34 UTC (rev 3727)
@@ -495,7 +495,6 @@
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
dialog.open();
tableView.refresh();
-// } else if(e.widget==rmBtn) {
}
}
}
17 years, 3 months
JBoss Tools SVN: r3726 - in trunk/seam/plugins/org.jboss.tools.seam.core: src/org/jboss/tools/seam/internal/core/project/facet and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-19 21:29:29 -0400 (Wed, 19 Sep 2007)
New Revision: 3726
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test/.classpath
Log:
http://jira.jboss.com/jira/browse/JBIDE-915 - test project is broken when projects created as war
http://jira.jboss.com/jira/browse/JBIDE-919 - Seam property page has several issues (especially when no runtimes are defined)
layout issue: Combo box field is very big in the height, but very small in the width.
Getting an "The current displayed page contains invalid values" when trying to select the page.
http://jira.jboss.com/jira/browse/JBIDE-912 - If no seam runtimes are defined pressing finish result in NPE
http://jira.jboss.com/jira/browse/JBIDE-906 - Create TestNG project for Seam
Project created in the same configuration as seam-gen does: with components.properties for Web and test projects. Web project has enbedded-ejb disabled, test vice versa.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java 2007-09-20 01:02:59 UTC (rev 3725)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java 2007-09-20 01:29:29 UTC (rev 3726)
@@ -166,4 +166,16 @@
public String getConfigurationVersion() {
return SeamFacetPreferenceInitializer.RUNTIME_CONFIG_FORMAT_VERSION;
}
+
+ /**
+ * @return
+ */
+ public List<String> getRuntimeNames() {
+ SeamRuntime[] rts = getRuntimes(SeamVersion.SEAM_1_2);
+ List<String> result = new ArrayList<String>();
+ for(SeamRuntime seamRuntime : rts) {
+ result.add(seamRuntime.getName());
+ }
+ return result;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-20 01:02:59 UTC (rev 3725)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-20 01:29:29 UTC (rev 3726)
@@ -11,8 +11,10 @@
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.Properties;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
@@ -22,11 +24,8 @@
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -37,16 +36,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.util.ResourcesUtils;
import org.jboss.tools.seam.core.ISeamProject;
@@ -288,6 +278,7 @@
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+ createComponentsProperties(srcFolder, project.getName(), Boolean.FALSE);
createTestProject(model,project,selectedRuntime);
// ********************************************************************************************
@@ -310,6 +301,7 @@
// Copy seam project indicator
// ********************************************************************************************
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true);
+
// WtpUtils.createSourceFolder(project, new Path("src/test"),new Path("src"));
// WtpUtils.createSourceFolder(project, new Path("src/action"),new Path("src"));
@@ -539,10 +531,16 @@
testProjectDir.mkdir();
File testLibDir = new File(testProjectDir,"lib");
File embededEjbDir = new File(testProjectDir,"embedded-ejb");
+ File testSrcDir = new File(testProjectDir,"test-src");
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", projectName);
filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject));
+
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
+ final String seamHomePath = selectedRuntime.getHomeDir();
+ final File seamGenResFolder = new File(selectedRuntime.getHomeDir());
+
AntCopyUtils.FileSet includeLibs
= new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
.dir(new File(seamRuntime.getHomeDir(),"lib"));
@@ -553,8 +551,15 @@
testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n");
}
+ StringBuffer requiredProjects = new StringBuffer();
+ requiredProjects.append(
+ "\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>");
+ if(!isWarConfiguration(model)) {
+ requiredProjects.append(
+ "\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "-ejb\"/>");
+ }
filterSet.addFilter("testLibraries",testLibraries.toString());
-
+ filterSet.addFilter("requiredProjects",requiredProjects.toString());
File testTemplateDir = null;
try {
testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test");
@@ -582,8 +587,27 @@
new File(seamRuntime.getHomeDir(),"lib"),
testLibDir,
new AntCopyUtils.FileSetFileFilter(includeLibs));
+
+ createComponentsProperties(testSrcDir, seamWebProject.getName(), Boolean.TRUE);
}
+ /**
+ * @param seamGenResFolder
+ */
+ private void createComponentsProperties(final File seamGenResFolder, String seamWebProjectName, Boolean embedded) {
+ Properties components = new Properties();
+ components.put("embeddedEjb", embedded.toString());
+ components.put("jndiPattern", seamWebProjectName+"/#{ejbName}/local");
+ File componentsProps = new File(seamGenResFolder,"components.properties");
+ try {
+ componentsProps.createNewFile();
+ components.store(new FileOutputStream(componentsProps), "");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/test/.classpath
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/test/.classpath 2007-09-20 01:02:59 UTC (rev 3725)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/test/.classpath 2007-09-20 01:29:29 UTC (rev 3726)
@@ -3,10 +3,7 @@
<classpathentry kind="src" path="test-src"/>
<classpathentry kind="src" path="embedded-ejb"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/@projectName@"/>
- <classpathentry combineaccessrules="false" kind="src" path="/@projectName@-ejb"/>
- @testLibraries@
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/@runtimeName@"/>
- <classpathentry kind="lib" path="/@projectName@/WebContent"/>
+@requiredProjects@
+@testLibraries@<classpathentry kind="lib" path="/@projectName@/WebContent"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 years, 3 months
JBoss Tools SVN: r3725 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-19 21:02:59 -0400 (Wed, 19 Sep 2007)
New Revision: 3725
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-914
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-19 20:47:06 UTC (rev 3724)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-20 01:02:59 UTC (rev 3725)
@@ -12,11 +12,17 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -45,6 +51,8 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
@@ -376,11 +384,50 @@
setPageComplete(false);
return;
}
+ String seamVersion = getSeamVersion(homeDir.getValueAsString());
+ if("".equals(seamVersion)) {
+ setErrorMessage("Cannot obtain Seam version number from jboss-seam.jar file.");
+ setPageComplete(false);
+ return;
+ } else if(!seamVersion.matches(version.getValueAsString()+".*")) {
+ setErrorMessage("Selected seam has wrong version number '" + seamVersion + "'");
+ setPageComplete(false);
+ return;
+ }
setErrorMessage(null);
setPageComplete(true);
}
+ public static String getSeamVersion(String path) {
+ File seamJarFile = new File(path, "jboss-seam.jar");
+ InputStream str=null;
+ ZipFile seamJar;
+ try {
+ seamJar = new ZipFile(seamJarFile);
+
+ ZipFileStructureProvider provider = new ZipFileStructureProvider(seamJar);
+ ZipEntry entry = seamJar.getEntry("META-INF/MANIFEST.MF");
+ str = provider.getContents(entry);
+
+ Properties manifest = new Properties();
+ manifest.load(str);
+ Object sv = manifest.get("Seam-Version");
+ return sv==null?"":sv.toString();
+
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError("Cannot read jboss-seam.jar file",e);
+ } finally {
+ if(str!=null)
+ try {
+ str.close();
+ } catch (IOException e) {
+ // nothing to do with that
+ }
+ }
+ return "";
+ }
+
/**
*
* @return
17 years, 3 months
JBoss Tools SVN: r3724 - trunk/jsf/features/org.jboss.tools.richfaces.feature.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-09-19 16:47:06 -0400 (Wed, 19 Sep 2007)
New Revision: 3724
Modified:
trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
Log:
removed vpe.ui plugin from richfaces feature
Modified: trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml
===================================================================
--- trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2007-09-19 20:24:51 UTC (rev 3723)
+++ trunk/jsf/features/org.jboss.tools.richfaces.feature/feature.xml 2007-09-19 20:47:06 UTC (rev 3724)
@@ -437,12 +437,6 @@
fragment="true"/>
<plugin
- id="org.jboss.tools.vpe.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
id="org.jboss.tools.vpe.ui.palette"
download-size="0"
install-size="0"
17 years, 3 months
JBoss Tools SVN: r3723 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-19 16:24:51 -0400 (Wed, 19 Sep 2007)
New Revision: 3723
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBIDE-920
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-19 20:18:54 UTC (rev 3722)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-19 20:24:51 UTC (rev 3723)
@@ -210,7 +210,7 @@
id="org.jboss.ide.eclipse.as.core.server.stripped.launchConfiguration"
modes="run,debug"
name="Stripped Server Launch Configuration"
- public="true"
+ public="false"
sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
sourcePathComputerId="org.jboss.ide.eclipse.as.core.serverSourcePathComputer"/>
<launchConfigurationType
@@ -224,7 +224,8 @@
delegate="org.jboss.ide.eclipse.as.core.server.internal.launch.StopLaunchConfiguration"
id="org.jboss.ide.eclipse.as.core.server.stopLaunchConfiguration"
modes="run"
- name="Stop Server">
+ name="Stop Server"
+ public="false">
</launchConfigurationType>
</extension>
17 years, 3 months
JBoss Tools SVN: r3722 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-19 16:18:54 -0400 (Wed, 19 Sep 2007)
New Revision: 3722
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
JBIDE-909 fixed
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-19 18:38:26 UTC (rev 3721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-19 20:18:54 UTC (rev 3722)
@@ -272,7 +272,7 @@
throw new CoreException(status);
}
- incrementalPublish(newTree, root, childModule, monitor);
+ incrementalPublish(newTree, moduleDeployPath, childModule, monitor);
}
}
17 years, 3 months