Author: ezheleznyakov
Date: 2007-10-17 10:59:59 -0400 (Wed, 17 Oct 2007)
New Revision: 4297
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/simpleTogglePanel/simpleTogglePanel.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSimpleTogglePanelTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-791
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/simpleTogglePanel/simpleTogglePanel.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/simpleTogglePanel/simpleTogglePanel.css 2007-10-17
14:51:02 UTC (rev 4296)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/simpleTogglePanel/simpleTogglePanel.css 2007-10-17
14:59:59 UTC (rev 4297)
@@ -27,6 +27,7 @@
color: #000000;
font-weight: bold;
font-family: Arial, Verdana, sans-serif;
+ height: 14px;
}
.dr-stglpnl-b{
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSimpleTogglePanelTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSimpleTogglePanelTemplate.java 2007-10-17
14:51:02 UTC (rev 4296)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSimpleTogglePanelTemplate.java 2007-10-17
14:59:59 UTC (rev 4297)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
@@ -32,6 +33,9 @@
private static Map toggleMap = new HashMap();
private nsIDOMElement storedSwitchDiv = null;
+ private static final String COLLAPSED_STYLE ="; display: none;";
+ private static final String HEADER_NAME_FACET = "header";
+
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
@@ -51,8 +55,17 @@
headerDiv.setAttribute("class", "dr-stglpnl-h rich-stglpanel-header
" + ComponentUtil.getAttribute(sourceElement, "headerClass"));
headerDiv.setAttribute("style", "position : relative; " +
ComponentUtil.getHeaderBackgoundImgStyle());
- String label = ComponentUtil.getAttribute(sourceElement, "label");
- headerDiv.appendChild(visualDocument.createTextNode(label));
+ //http://jira.jboss.com/jira/browse/JBIDE-791
+ Element firstElementOfHeaderFacet = ComponentUtil.getFacet(sourceElement,
HEADER_NAME_FACET);
+ if(firstElementOfHeaderFacet != null) {
+ VpeChildrenInfo headerInfo = new VpeChildrenInfo(headerDiv);
+ headerInfo.addSourceChild(firstElementOfHeaderFacet);
+ creationData.addChildrenInfo(headerInfo);
+ } else {
+ String label = ComponentUtil.getAttribute(sourceElement, "label");
+ headerDiv.appendChild(visualDocument.createTextNode(label));
+ }
+ /////
nsIDOMElement switchDiv = visualDocument.createElement("div");
headerDiv.appendChild(switchDiv);
@@ -62,6 +75,8 @@
char defaultMarkerCode = 187;
boolean opened = getActiveState(sourceElement);
switchDiv.setAttribute("vpe-user-toggle-id", (opened ? "false" :
"true"));
+
+ headerDiv.setAttribute("vpe-user-toggle-id", (opened ? "false" :
"true"));
storedSwitchDiv = switchDiv;
if(opened) {
@@ -78,7 +93,7 @@
}
// Encode Body
- if(opened) {
+ //if(opened) {
nsIDOMElement bodyDiv = visualDocument.createElement("div");
div.appendChild(bodyDiv);
bodyDiv.setAttribute("style", "overflow: auto; height: " +
ComponentUtil.getAttribute(sourceElement, "height") + "; width:
100%;");
@@ -99,7 +114,15 @@
bodyInfo.addSourceChild(child);
}
creationData.addChildrenInfo(bodyInfo);
- }
+
+ //http://jira.jboss.com/jira/browse/JBIDE-791
+ if(!opened) {
+ String newStyle = bodyDiv.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ newStyle += COLLAPSED_STYLE;
+ bodyDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, newStyle);
+ }
+ //-------------------------
+ //}
return creationData;
}
@@ -141,7 +164,7 @@
opennedStr = ComponentUtil.getAttribute(sourceElement, "opened");
}
- if (opennedStr == null) {
+ if (opennedStr == null || "".equals(opennedStr)) {
opennedStr = "true";
}
@@ -155,4 +178,11 @@
public void stopToggling(Node sourceNode) {
toggleMap.remove(sourceNode);
}
+
+
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
}
\ No newline at end of file