Author: ezheleznyakov
Date: 2007-09-14 05:30:18 -0400 (Fri, 14 Sep 2007)
New Revision: 3623
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Fix bug with selection in <rich:scrollableDataTable>.
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css 2007-09-13
23:39:43 UTC (rev 3622)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/scrollableDataTable/scrollableDataTable.css 2007-09-14
09:30:18 UTC (rev 3623)
@@ -111,7 +111,7 @@
display: block;
}
-.dr-table-scroll {
- overflow: scroll;
+.dr-table-hidden {
+ overflow: hidden;
border: solid 1px #C4C0C9;
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2007-09-13
23:39:43 UTC (rev 3622)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2007-09-14
09:30:18 UTC (rev 3623)
@@ -21,7 +21,6 @@
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -43,7 +42,10 @@
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;
/**
@@ -69,23 +71,68 @@
String height = sourceElement
.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR);
+ // -----------CommonTable
+ nsIDOMElement tableCommon = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ VpeCreationData creationData = new VpeCreationData(tableCommon);
+
+ nsIDOMElement tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ nsIDOMElement tr2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ tableCommon.appendChild(tr1);
+ tableCommon.appendChild(tr2);
+
+ // ---------tr2
+ nsIDOMElement tr2_TD = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr2.appendChild(tr2_TD);
+
+ nsIDOMElement 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------------------------
+ nsIDOMElement tr1_TD1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr1.appendChild(tr1_TD1);
+
+ nsIDOMElement tr1_TD2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr1.appendChild(tr1_TD2);
+
+ nsIDOMElement 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);
+
+ // -------------------------------------------------------
nsIDOMElement 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);
- div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-table-scroll");
+
nsIDOMElement table = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
ComponentUtil.copyAttributes(sourceNode, table);
- table.removeAttribute("height");
+ table.removeAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT);
div.appendChild(table);
- VpeCreationData creationData = new VpeCreationData(div);
-
ComponentUtil.setCSSLink(pageContext,
"scrollableDataTable/scrollableDataTable.css",
"richFacesDataTable");
@@ -126,7 +173,7 @@
headerClass, HtmlComponentUtil.HTML_TAG_TD);
}
if (!columnsHeaders.isEmpty()) {
- nsIDOMElement tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
thead.appendChild(tr);
String styleClass = encodeStyleClass(null,
"dr-table-subheader rich-table-subheader", null,
@@ -532,65 +579,118 @@
return count;
}
- @Override
- public void removeAttribute(VpePageContext pageContext,
+ /**
+ * 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, 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);
- }
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
}
- @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);
+ // @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);
+ // }
- }
-
- 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);
- }
-
-}
\ No newline at end of file
+}
+// 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/>