Author: sdzmitrovich
Date: 2008-04-25 10:29:35 -0400 (Fri, 25 Apr 2008)
New Revision: 7811
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2092
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -31,7 +31,6 @@
*/
public class JsfForm extends VpeAbstractTemplate {
- private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;"; //$NON-NLS-1$
private static String TABLE_WIDTH_STYLE = "width: 100%;"; //$NON-NLS-1$
private static final String DIR_VALUE_RTL = "RTL"; //$NON-NLS-1$
@@ -63,7 +62,7 @@
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
- nsIDOMElement dotted_border_div = visualDocument.createElement(HTML.TAG_DIV);
+
nsIDOMElement content_div = visualDocument.createElement(HTML.TAG_DIV);
if (attrPresents(style)) {
@@ -79,9 +78,8 @@
}
table.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, TABLE_WIDTH_STYLE);
- dotted_border_div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
- dotted_border_div.appendChild(content_div);
- td.appendChild(dotted_border_div);
+
+ td.appendChild(content_div);
tr.appendChild(td);
table.appendChild(tr);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -31,7 +31,6 @@
*/
public class JsfSubView extends VpeAbstractTemplate {
- private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;"; //$NON-NLS-1$
private static String TABLE_WIDTH_STYLE = "width: 100%;"; //$NON-NLS-1$
/**
@@ -52,7 +51,6 @@
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
table.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, TABLE_WIDTH_STYLE);
- div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
td.appendChild(div);
tr.appendChild(td);
table.appendChild(tr);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -31,7 +31,6 @@
*/
public class JsfView extends VpeAbstractTemplate {
- private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;"; //$NON-NLS-1$
private static String TABLE_WIDTH_STYLE = "width: 100%;"; //$NON-NLS-1$
/**
@@ -53,7 +52,6 @@
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
table.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, TABLE_WIDTH_STYLE);
- div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
td.appendChild(div);
tr.appendChild(td);
table.appendChild(tr);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-25
14:29:35 UTC (rev 7811)
@@ -616,7 +616,7 @@
</vpe:tag>
<vpe:tag name="f:view" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ <vpe:template children="yes" modify="yes"
hasImaginaryBorder="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfView">
<vpe:dnd>
<vpe:drag start-enable="yes" />
@@ -641,7 +641,7 @@
</vpe:tag>
<vpe:tag name="f:subview" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ <vpe:template children="yes" modify="yes"
hasImaginaryBorder="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfSubView">
<vpe:dnd>
<vpe:drag start-enable="yes" />
@@ -666,7 +666,7 @@
</vpe:tag>
<vpe:tag name="h:form" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ <vpe:template children="yes" modify="yes"
hasImaginaryBorder="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfForm">
<vpe:dnd>
<vpe:drag start-enable="yes" />
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -79,12 +79,7 @@
//FIX FOR JBIDE-1568, added by Max Areshkau
try {
- if ( template.isHaveVisualPreview() ) {
creationData = template.create(getPageContext(), sourceNode, getVisualDocument());
- } else {
- nsIDOMElement tempHTMLElement = getVisualDocument().createElement(HTML.TAG_DIV);
- creationData = new VpeCreationData(tempHTMLElement);
- }
}catch (XPCOMException ex) {
VpePlugin.getPluginLog().logError(ex);
VpeTemplate defTemplate = templateManager.getDefTemplate();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -110,6 +110,7 @@
private static final int DRAG_AREA_WIDTH = 10;
private static final int DRAG_AREA_HEIGHT = 10;
private static final String ATTR_DRAG_AVAILABLE_CLASS =
"__drag__available_style"; //$NON-NLS-1$
+ private static String DOTTED_BORDER = "border: 1px dotted #FF6600; padding:
5px;"; //$NON-NLS-1$
private MozillaEditor visualEditor;
private XulRunnerEditor xulRunnerEditor;
@@ -478,10 +479,20 @@
visualNewElement = (nsIDOMElement) creationData
.getNode().queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
}
+
+ if ((visualNewElement != null) && template.hasImaginaryBorder()) {
+
+ visualNewElement.setAttribute(HTML.ATTR_STYLE, visualNewElement
+ .getAttribute(HTML.ATTR_STYLE)
+ + VpeStyleUtil.SEMICOLON_STRING + DOTTED_BORDER);
+
+ }
if (visualNewElement != null)
correctVisualAttribute(visualNewElement);
+
+
nsIDOMElement border = null;
setTooltip((Element) sourceNode, visualNewElement);
if (YES_STRING.equals(VpePreference.SHOW_BORDER_FOR_ALL_TAGS
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -48,7 +48,7 @@
protected boolean children;
protected boolean modify;
- protected boolean haveVisualPreview;
+ protected boolean hasImaginaryBorder;
/** a resizer instance */
private VpeResizer resizer;
@@ -160,16 +160,17 @@
this.caseSensitive = caseSensitive;
children =
"yes".equals(templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_CHILDREN));
//$NON-NLS-1$
modify =
"yes".equals(templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_MODIFY));
//$NON-NLS-1$
-
- String strHaveVisualPreview =
templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW);
-
- if (strHaveVisualPreview != null && strHaveVisualPreview.length() != 0 ) {
- haveVisualPreview = "yes".equals(strHaveVisualPreview); //$NON-NLS-1$
+
+ String strHasImaginaryBorder = templateElement
+ .getAttribute(VpeTemplateManager.ATTR_TEMPLATE_HAS_IMAGINARY_BORDER);
+
+ if (strHasImaginaryBorder != null
+ && strHasImaginaryBorder.length() != 0) {
+ hasImaginaryBorder = "yes".equalsIgnoreCase(strHasImaginaryBorder);
//$NON-NLS-1$
} else {
- haveVisualPreview = true;
+ hasImaginaryBorder = false;
}
-
-
+
init(templateElement);
}
@@ -928,8 +929,8 @@
return true;
}
- public boolean isHaveVisualPreview() {
- return haveVisualPreview;
+ public boolean hasImaginaryBorder() {
+ return hasImaginaryBorder;
}
/**
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -307,32 +307,10 @@
boolean isCaseSensitive();
/**
- * Return <code>true</code> if the element has visual representation on tab
- * 'Preview', otherwise <code>false</code>.<br/>
- * This value is initialized by attribute <b>haveVisualPreview</b> of tag
- * <b><vpe:template></b>. If the attribute is not presented
default
- * value is <code>true</code>.<br/>
- * <br/>
- * Example:<br/>
- * JSF tag <code><h:form></code>:<br/>
- * <code>
- * <vpe:tag name="h:form"
case-sensitive="yes"><br/>
- * <vpe:template children="yes"
modify="yes" haveVisualPreview="no"><br/>
- *
<div
style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/><br/>
- *
<vpe:dnd><br/>
- *
<vpe:drag
start-enable="yes"/><br/>
- *
<vpe:drop
container="yes"/><br/>
- *
</vpe:dnd><br/>
- * </vpe:template><br/>
- * </vpe:tag><br/>
- * </code><br/>
- * In visual editor part (see tab 'Visual') the tag have a red border for
- * visualization reason, but it is not visual element and it shouldn't have
- * visual representation on tab 'Preview'.<br/>
- * <br/>
- * @return <code>true</code> if the element is have visual preview
+ *
+ * @return
*/
- boolean isHaveVisualPreview();
+ boolean hasImaginaryBorder();
/**
* Returns the data for formatting an element of source tree
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-04-25
14:25:13 UTC (rev 7810)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-04-25
14:29:35 UTC (rev 7811)
@@ -133,8 +133,7 @@
static final String ATTR_TEMPLATE_CHILDREN = "children"; //$NON-NLS-1$
static final String ATTR_TEMPLATE_MODIFY = "modify"; //$NON-NLS-1$
- /** ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW */
- static final String ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW = "haveVisualPreview";
//$NON-NLS-1$
+ static final String ATTR_TEMPLATE_HAS_IMAGINARY_BORDER = "hasImaginaryBorder";
//$NON-NLS-1$
static final String ATTR_COPY_ATTRS = "attrs"; //$NON-NLS-1$