diff options
author | itrimble | 2008-04-18 23:23:58 +0000 |
---|---|---|
committer | itrimble | 2008-04-18 23:23:58 +0000 |
commit | 7c0f5776ef6b1c40a7f10355095ecd6db6b26dcb (patch) | |
tree | 0ced7d026c61dec47a0335f6e56f58016b6e9832 | |
parent | 44f579742ce1782ab339a6ea9cad341d94ecebf4 (diff) | |
download | webtools.jsf-7c0f5776ef6b1c40a7f10355095ecd6db6b26dcb.tar.gz webtools.jsf-7c0f5776ef6b1c40a7f10355095ecd6db6b26dcb.tar.xz webtools.jsf-7c0f5776ef6b1c40a7f10355095ecd6db6b26dcb.zip |
[Bug 219160] Implement tag conversion for tr:panelLabelAndMessage, tr:panelTip.
3 files changed, 146 insertions, 0 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/metadata/trinidad_dti.xml b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/metadata/trinidad_dti.xml index 57b0b1aae..46cfc592f 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/metadata/trinidad_dti.xml +++ b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/metadata/trinidad_dti.xml @@ -729,6 +729,22 @@ </trait> </entity> + <entity id="panelLabelAndMessage" type="tag"> + <trait id="dt-info"> + <value xsi:type="dti:DTInfo"> + <tag-convert-info> + <operation id="org.eclipse.jst.jsf.apache.trinidad.tagsupport.PanelLabelAndMessageOperation"> + </operation> + </tag-convert-info> + <tag-decorate-info id="vpd-decorate-design" + multiLevel="true" + widget="true" + setNonVisualChildElements="true" + /> + </value> + </trait> + </entity> + <entity id="panelTabbed" type="tag"> <trait id="dt-info"> <value xsi:type="dti:DTInfo"> @@ -743,6 +759,45 @@ </trait> </entity> + <entity id="panelTip" type="tag"> + <trait id="dt-info"> + <value xsi:type="dti:DTInfo"> + <tag-convert-info> + <operation id="org.eclipse.jst.pagedesigner.CreateElementOperation"> + <parameter value="div"/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.CopyAttributeWithRenameOperation"> + <parameter value="styleClass"/> + <parameter value="class"/> + </operation> + <operation id="org.eclipse.jst.jsf.apache.trinidad.tagsupport.CreateStyleAttributeOperation"> + <parameter value="font-family:Arial,Helvetica,Geneva,sans-serif;font-size:10pt;font-weight:normal;color:#669966;"/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.AppendChildElementOperation"> + <parameter value="span"/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.CreateAttributeOperation"> + <parameter value="style"/> + <parameter value="font-family:Arial,Helvetica,Geneva,sans-serif;font-size:10pt;font-weight:bold;"/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.AppendChildTextOperation"> + <parameter value="TIP "/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.MakeParentElementCurrentOperation"/> + <operation id="org.eclipse.jst.pagedesigner.AppendChildElementOperation"> + <parameter value="span"/> + </operation> + <operation id="org.eclipse.jst.pagedesigner.CopyChildrenOperation"/> + <operation id="org.eclipse.jst.pagedesigner.MakeParentElementCurrentOperation"/> + </tag-convert-info> + <tag-decorate-info id="vpd-decorate-design" + multiLevel="true" + needBorderDecorator="true" + /> + </value> + </trait> + </entity> + <entity id="poll" type="tag"> <trait id="dt-info"> <value xsi:type="dti:DTInfo"> diff --git a/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/plugin.xml b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/plugin.xml index e6a07796a..90512b0da 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/plugin.xml +++ b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/plugin.xml @@ -58,6 +58,10 @@ id="PanelGroupLayoutOperation"> </tagTransformOperation> <tagTransformOperation + class="org.eclipse.jst.jsf.apache.trinidad.tagsupport.converter.operations.PanelLabelAndMessageOperation" + id="PanelLabelAndMessageOperation"> + </tagTransformOperation> + <tagTransformOperation class="org.eclipse.jst.jsf.apache.trinidad.tagsupport.converter.operations.PanelTabbedOperation" id="PanelTabbedOperation"> </tagTransformOperation> diff --git a/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/src/org/eclipse/jst/jsf/apache/trinidad/tagsupport/converter/operations/PanelLabelAndMessageOperation.java b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/src/org/eclipse/jst/jsf/apache/trinidad/tagsupport/converter/operations/PanelLabelAndMessageOperation.java new file mode 100644 index 000000000..93d9f7a9d --- /dev/null +++ b/jsf/plugins/org.eclipse.jst.jsf.apache.trinidad.tagsupport/src/org/eclipse/jst/jsf/apache/trinidad/tagsupport/converter/operations/PanelLabelAndMessageOperation.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2008 Oracle Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Oracle Corporation - initial API and implementation + */ +package org.eclipse.jst.jsf.apache.trinidad.tagsupport.converter.operations; + +import java.util.Iterator; +import java.util.List; + +import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; +import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; +import org.eclipse.jst.pagedesigner.converter.ConvertPosition; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * ITransformOperation implementation specifically for the "panelLabelAndMessage" + * JSF Element. + * + * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to + * have been called to provide a valid ITagConverterContext instance prior to + * a call to the transform(...) method. + * + * @author Ian Trimble - Oracle + */ +public class PanelLabelAndMessageOperation extends + AbstractLabelAndHelpOperation { + + /* (non-Javadoc) + * @see org.eclipse.jst.jsf.apache.trinidad.tagsupport.converter.operations.AbstractLabelAndHelpOperation#appendControl(org.w3c.dom.Element, org.w3c.dom.Element) + */ + @Override + protected void appendControl(Element srcElement, Element parentElement) { + handleLabelStyle(srcElement, parentElement); + Element tableElement = appendChildElement("table", parentElement); //$NON-NLS-1$ + appendAttribute(tableElement, "cellpadding", "0"); //$NON-NLS-1$ //$NON-NLS-2$ + appendAttribute(tableElement, "cellspacing", "0"); //$NON-NLS-1$ //$NON-NLS-2$ + appendAttribute(tableElement, "border", "0"); //$NON-NLS-1$ //$NON-NLS-2$ + Element trElement = appendChildElement("tr", tableElement); //$NON-NLS-1$ + Element tdElementLeft = appendChildElement("td", trElement); //$NON-NLS-1$ + List<Node> childNodes = getCopyChildrenNodes(srcElement); + Iterator<Node> itChildNodes = childNodes.iterator(); + int curIndex = 0; + while (itChildNodes.hasNext()) { + Node childNode = itChildNodes.next(); + if (!(childNode instanceof Element && + IJSFConstants.TAG_IDENTIFIER_FACET.isSameTagType( + TagIdentifierFactory.createDocumentTagWrapper((Element)childNode)))) { + tagConverterContext.addChild( + childNode, new ConvertPosition(tdElementLeft, curIndex++)); + } + } + Element tdElementRight = appendChildElement("td", trElement); //$NON-NLS-1$ + Element endFacetElement = getChildFacetByName(srcElement, "end"); //$NON-NLS-1$ + if (endFacetElement != null) { + tagConverterContext.addChild( + endFacetElement, new ConvertPosition(tdElementRight, 0)); + } + } + + private void handleLabelStyle(Element srcElement, Element parentElement) { + String labelStyle = srcElement.getAttribute("labelStyle"); //$NON-NLS-1$ + if (labelStyle != null && labelStyle.length() > 0) { + if (parentElement.getPreviousSibling() instanceof Element) { + Element labelTDElement = (Element)parentElement.getPreviousSibling(); + labelTDElement.removeAttribute("valign"); //$NON-NLS-1$ + String style = labelTDElement.getAttribute("style"); //$NON-NLS-1$ + if (style != null && style.length() > 0) { + if (!style.endsWith(";")) { //$NON-NLS-1$ + style += ";"; //$NON-NLS-1$ + } + style += labelStyle; + appendAttribute(labelTDElement, "style", style); //$NON-NLS-1$ + } else { + appendAttribute(labelTDElement, "style", labelStyle); //$NON-NLS-1$ + } + } + } + } + +} |