Author: dmaliarevich
Date: 2009-04-08 11:21:35 -0400 (Wed, 08 Apr 2009)
New Revision: 14608
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/Seam.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4109, style and styleClass attributes were
added.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java 2009-04-08
14:58:51 UTC (rev 14607)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java 2009-04-08
15:21:35 UTC (rev 14608)
@@ -1,20 +1,46 @@
package org.jboss.tools.jsf.vpe.seam.template;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.seam.template.util.Seam;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeDefineContainerTemplate;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class SeamDecorateTemplate extends VpeDefineContainerTemplate {
- private final String ATTR_TEMPLATE = "template"; //$NON-NLS-1$
-
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- String fileName = ((Element) sourceNode).getAttribute(ATTR_TEMPLATE);
- return createTemplate(fileName, pageContext, sourceNode, visualDocument);
+
+ Element sourceElement = (Element) sourceNode;
+
+ /*
+ * Reading attributes
+ */
+ String fileName = sourceElement.getAttribute(Seam.ATTR_TEMPLATE);
+ String styleClass = sourceElement.getAttribute(Seam.ATTR_STYLE_CLASS);
+ String style = sourceElement.getAttribute(HTML.ATTR_STYLE);
+
+ /*
+ * Creating template
+ */
+ VpeCreationData creationData = createTemplate(fileName, pageContext, sourceNode,
visualDocument);
+
+ /*
+ * Setting style and class attributes
+ */
+ if (ComponentUtil.isNotBlank(style)) {
+ ((nsIDOMElement)creationData.getNode()).setAttribute(HTML.ATTR_STYLE, style);
+ }
+ if (ComponentUtil.isNotBlank(styleClass)) {
+ ((nsIDOMElement)creationData.getNode()).setAttribute(HTML.ATTR_CLASS, styleClass);
+ }
+
+ return creationData;
}
}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/Seam.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/Seam.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/Seam.java 2009-04-08
15:21:35 UTC (rev 14608)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.seam.template.util;
+
+/**
+ * Class contains Seam tags and general attributes.
+ *
+ * @author dmaliarevich
+ *
+ */
+public class Seam {
+
+ public static final String ATTR_TEMPLATE = "template"; //$NON-NLS-1$
+ public static final String ATTR_STYLE_CLASS = "styleClass"; //$NON-NLS-1$
+
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/Seam.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native