Author: izhukov
Date: 2008-11-10 07:43:26 -0500 (Mon, 10 Nov 2008)
New Revision: 11632
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-input.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-range.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css.tmp
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-arrows.png
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-input.png
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/down.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/up.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractEditableRichFacesTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSConstants.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3093 - fixed
https://jira.jboss.org/jira/browse/JBIDE-2913 - make some style modifications
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-input.png
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-input.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-range.png
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/background-range.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css 2008-11-10
12:43:26 UTC (rev 11632)
@@ -1,62 +1,60 @@
@CHARSET "UTF-8";
+
.slider-container {
-background-color:transparent;
-position:relative;
-height : 20px;
+ background-color: transparent;
+ position: relative;
+ width: 100%;
}
+
.range {
-background-color:transparent;
-border:1px solid #C4C0B9;
-float:left;
-height:10px;
-overflow:hidden;
+ background-image: url(background-range.png);
+ background-color: transparent;
+ border: 1px solid #C4C0B9;
+ border-color: #FFFFFF;
+ float: left;
+ height: 10px;
+ overflow: hidden;
}
+
.range-decor {
-border:1px solid #FFFFFF;
-height:100%;
-width:100%;
+ border: 1px solid;
+ height: 100%;
+ width: 100%;
}
+
.trailer {
-background-color:transparent;
-background-position:right top;
-background-repeat:repeat-x;
-height:10px;
+ background-color: transparent;
+ background-position: right top;
+ background-repeat: repeat-x;
+ height: 10px;
}
+
.track {
-background-color:transparent;
-height:8px;
-overflow:hidden;
-position:absolute;
+ background-color: transparent;
+ height: 8px;
+ overflow: hidden;
+ position: absolute;
}
+
.handle {
-background-color:transparent;
-height:10px;
-position:absolute;
-width:10px;
-left : 114px;
+ background-color: transparent;
+ font-size: 1px;
+ height: 8px;
+ width: 10px;
+ position: absolute;
+ line-height: 1px;
}
-.dr-tbpnl-cntnt {
-border-style:solid;
-color:#000000;
-font-family:verdana;
-font-size:11px;
-}
+
.slider-input-field {
-background:#FFFFFF url() repeat-x scroll left top;
-border-color:#000000 rgb(176, 176, 176) rgb(176, 176, 176) rgb(0, 0, 0);
-border-style:solid;
-border-width:1px;
-color:#000000;
-float:left;
-font-family:arial,sans-serif;
-font-size:11px;
-font-size-adjust:none;
-font-stretch:normal;
-font-style:normal;
-font-variant:normal;
-font-weight:normal;
-line-height:normal;
-margin:0px 0px 0px 10px;
-padding:0px 0px 0px 3px;
-width:40px;
+ background-image: url(background-input.png);
+ background: #FFFFFF transparent none repeat-x scroll left top;
+ border: 1px solid;
+ border-color: #C4C0B9 #FFFFFF #FFFFFF #C4C0B9;
+ color: #000000;
+ float: left;
+ margin: 0 0 0 10px;
+ padding: 0 0 0 3px;
+ width: 40px;
+ font-family: Arial,Verdana,sans-serif;
+ font-size: 11px;
}
\ No newline at end of file
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css.tmp
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css.tmp
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataFilterSlider/dataFilterSlider.css.tmp 2008-11-10
12:43:26 UTC (rev 11632)
@@ -0,0 +1,62 @@
+@CHARSET "UTF-8";
+.slider-container {
+background-color:transparent;
+position:relative;
+height : 20px;
+}
+.range {
+background-color:transparent;
+border:1px solid #C4C0B9;
+float:left;
+height:10px;
+overflow:hidden;
+}
+.range-decor {
+border:1px solid #FFFFFF;
+height:100%;
+width:100%;
+}
+.trailer {
+background-color:transparent;
+background-position:right top;
+background-repeat:repeat-x;
+height:10px;
+}
+.track {
+background-color:transparent;
+height:8px;
+overflow:hidden;
+position:absolute;
+}
+.handle {
+background-color:transparent;
+height:10px;
+position:absolute;
+width:10px;
+left : 114px;
+}
+.dr-tbpnl-cntnt {
+border-style:solid;
+color:#000000;
+font-family:verdana;
+font-size:11px;
+}
+.slider-input-field {
+background:#FFFFFF url() repeat-x scroll left top;
+border-color:#000000 rgb(176, 176, 176) rgb(176, 176, 176) rgb(0, 0, 0);
+border-style:solid;
+border-width:1px;
+color:#000000;
+float:left;
+font-family:arial,sans-serif;
+font-size:11px;
+font-size-adjust:none;
+font-stretch:normal;
+font-style:normal;
+font-variant:normal;
+font-weight:normal;
+line-height:normal;
+margin:0px 0px 0px 10px;
+padding:0px 0px 0px 3px;
+width:40px;
+}
\ No newline at end of file
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-arrows.png
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-arrows.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-input.png
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/background-input.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/down.gif
===================================================================
(Binary files differ)
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css 2008-11-10
12:43:26 UTC (rev 11632)
@@ -4,10 +4,10 @@
background: transparent none repeat scroll 0 0;
margin: 0px;
font-family: Arial, Verdana, sans-serif;
- font-size: 11px;
}
.dr-spnr-e {
+ background-image: url(background-input.png);
background-color: #ffffff;
padding: 0px;
margin: 0px;
@@ -25,7 +25,7 @@
}
.dr-spnr-b {
- background-image: url(background-arrows.jpg);
+ background-image: url(background-arrows.png);
background-color: #D4CFC7;
border-color: #D4CFC7;
border-style: solid;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/up.gif
===================================================================
(Binary files differ)
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -9,7 +9,6 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.jsf.vpe.richfaces;
@@ -47,7 +46,6 @@
*/
public class ComponentUtil {
-
/** The Constant EMPTY_SELECT_ITEM_VALUE. */
private static final String EMPTY_SELECT_ITEM_VALUE =
"<f:selectItem/>"; //$NON-NLS-1$
@@ -57,9 +55,6 @@
/** The Constant SELECT_ITEMS. */
private static final String SELECT_ITEMS = "selectItems"; //$NON-NLS-1$
- /** The Constant PX_SUFFIX. */
- public static final String PX_SUFFIX = "px"; //$NON-NLS-1$
-
/** The Constant SELECT_ITEM. */
private static final String SELECT_ITEM = "selectItem"; //$NON-NLS-1$
@@ -160,8 +155,7 @@
* @return true, if is rendered
*/
public static boolean isRendered(Element sourceElement) {
- return !"false" //$NON-NLS-1$
- .equalsIgnoreCase(sourceElement.getAttribute("rendered"));
//$NON-NLS-1$
+ return
!Constants.FALSE.equalsIgnoreCase(sourceElement.getAttribute("rendered"));
//$NON-NLS-1$
}
/**
@@ -212,7 +206,7 @@
String resolvedValue = resourcePathInWorkspace
.replaceFirst(
- "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
""); //$NON-NLS-1$ //$NON-NLS-2$
+ "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
Constants.EMPTY); //$NON-NLS-1$
IFile file = pageContext.getVisualBuilder().getCurrentIncludeInfo()
.getFile();
@@ -418,7 +412,7 @@
public static String getAttribute(Element sourceElement, String attributeName) {
String attribute = sourceElement.getAttribute(attributeName);
if (attribute == null) {
- attribute = ""; //$NON-NLS-1$
+ attribute = Constants.EMPTY;
}
return attribute;
}
@@ -434,7 +428,7 @@
public static String getAttribute(nsIDOMElement sourceElement, String attributeName)
{
String attribute = sourceElement.getAttribute(attributeName);
if (attribute == null) {
- attribute = ""; //$NON-NLS-1$
+ attribute = Constants.EMPTY;
}
return attribute;
}
@@ -449,9 +443,9 @@
*/
public static boolean parameterPresent(String style, String name) {
if (style != null && style.length() > 0) {
- String[] styles = style.split(";"); //$NON-NLS-1$
+ String[] styles = style.split(Constants.SEMICOLON);
for (int i = 0; i < styles.length; i++) {
- String[] pair = styles[i].split(":"); //$NON-NLS-1$
+ String[] pair = styles[i].split(Constants.COLON);
if (pair[0].trim().equals(name)) {
return true;
}
@@ -470,9 +464,9 @@
*/
public static String getStyleParametr(String style, String name) {
if (style != null && style.length() > 0) {
- String[] styles = style.split(";"); //$NON-NLS-1$
+ String[] styles = style.split(Constants.SEMICOLON);
for (int i = 0; i < styles.length; i++) {
- String[] pair = styles[i].split(":"); //$NON-NLS-1$
+ String[] pair = styles[i].split(Constants.COLON);
if (pair[0].trim().equals(name)) {
return pair[1].trim();
}
@@ -491,7 +485,7 @@
*/
public static String addParameter(String style, String element) {
String s = style.trim();
- return style + (s.length() == 0 || s.endsWith(";") ? "" :
";") //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ return style + (s.length() == 0 || s.endsWith(Constants.SEMICOLON) ?
Constants.EMPTY : Constants.SEMICOLON)
+ element;
}
@@ -572,7 +566,7 @@
String prefValue, String defValue) {
String attrValue = ((Element) sourceNode).getAttribute(attrName);
if (prefValue != null && prefValue.trim().length() > 0 &&
attrValue != null) {
- attrValue = prefValue.trim() + " " + attrValue; //$NON-NLS-1$
+ attrValue = prefValue.trim() + Constants.WHITE_SPACE + attrValue;
}
if (attrValue != null) {
visualNode.setAttribute(htmlAttrName, attrValue);
@@ -594,10 +588,10 @@
* @return boolean value from string
*/
public static boolean string2boolean(String str) {
- if ((str == null) || ("".equals(str))) { //$NON-NLS-1$
+ if ((str == null) || (Constants.EMPTY.equals(str))) {
return true;
- } else if (("true".equalsIgnoreCase(str)) //$NON-NLS-1$
- || ("false".equalsIgnoreCase(str))) { //$NON-NLS-1$
+ } else if ((Constants.TRUE.equalsIgnoreCase(str))
+ || (Constants.FALSE.equalsIgnoreCase(str))) {
return new Boolean(str).booleanValue();
}
return true;
@@ -662,7 +656,7 @@
throw new NumberFormatException("Passed value is empty ");
//$NON-NLS-1$
}
- if (value.endsWith(PX_SUFFIX)) {
+ if (value.endsWith(Constants.PIXEL)) {
rst = Integer.parseInt(value.substring(0, value.length() - 2));
} else {
rst = Integer.parseInt(value);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractEditableRichFacesTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractEditableRichFacesTemplate.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractEditableRichFacesTemplate.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.w3c.dom.Element;
public abstract class AbstractEditableRichFacesTemplate extends
@@ -21,8 +22,6 @@
if (sourceElement.hasAttribute(attributeName))
return sourceElement.getAttribute(attributeName);
- return ""; //$NON-NLS-1$
-
+ return Constants.EMPTY;
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -215,9 +215,9 @@
SLYDER_WIDTH_DEFAULT) + ";" //$NON-NLS-1$
+ getAttribute(sourceElement, RichFaces.ATTR_STYLE));
basicTable.setAttribute(HTML.ATTR_CLASS, styleClasses.get("style"));
//$NON-NLS-1$
- basicTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- basicTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
- basicTable.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ basicTable.setAttribute(HTML.ATTR_CELLPADDING, MIN_VALUE_DEFAULT);
+ basicTable.setAttribute(HTML.ATTR_CELLSPACING, MIN_VALUE_DEFAULT);
+ basicTable.setAttribute(HTML.ATTR_BORDER, MIN_VALUE_DEFAULT);
nsIDOMElement valuesBlock = createValuesBlock(sourceElement,
visualDocument, elementData);
@@ -361,8 +361,8 @@
// create table
nsIDOMElement barTable = visualDocument.createElement(HTML.TAG_TABLE);
barTable.setAttribute(HTML.ATTR_CLASS, TRACK_DECOR_1_CLASSES);
- barTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- barTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ barTable.setAttribute(HTML.ATTR_CELLPADDING, MIN_VALUE_DEFAULT);
+ barTable.setAttribute(HTML.ATTR_CELLSPACING, MIN_VALUE_DEFAULT);
// create tr
nsIDOMElement barTr = visualDocument.createElement(HTML.TAG_TR);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -18,51 +18,79 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* Template for Rich Faces DataTableFilterSlider
- *
*/
public class RichFacesDataFilterSliderTemplate extends AbstractRichFacesTemplate {
- /** IMAGE_SPACER */
- final static String IMAGE_SPACER = "/common/spacer.gif"; //$NON-NLS-1$
-
- final static String CENTER_SLIDER = "/dataFilterSlider/pos.gif";
//$NON-NLS-1$
+ /** path to CSS file */
+ static final String STYLE_PATH = "/dataFilterSlider/dataFilterSlider.css";
//$NON-NLS-1$
- final static String STYLE_PATH = "/dataFilterSlider/dataFilterSlider.css";
//$NON-NLS-1$
+ static final String CENTER_SLIDER = "/dataFilterSlider/pos.gif";
//$NON-NLS-1$
- final static int DEFAULT_WIDTH = 260;
+ private static final int DEFAULT_WIDTH = 200;
+ private static final int ZERO = 0;
+ private static final int TRAILER_LEFT_OFFSET = -38;
- /* intdent between slider and right border */
- final static int DEFAULT_PARAGRAPH = 60;
+ private static final String DEFAULT_SLIDER_WIDTH = "7px"; //$NON-NLS-1$
+ private static final String DEFAULT_SLIDER_HEIGHT = "8px"; //$NON-NLS-1$
+ private static final String DEFAULT_SLIDER_BORDER = "0px"; //$NON-NLS-1$
- final static int DEFAULT_HEIGHT = 20;
+ /* Default and RichFaces styles */
+ /** DEFAULT_SLIDER_CONTAINER_STYLE */
+ final static private String DEFAULT_SLIDER_CONTAINER_STYLE =
"slider-container"; //$NON-NLS-1$
- final static String DEFAULT_SLIDER_POSITION = "left: -38px; width: 114px;";
//$NON-NLS-1$
+ /** DEFAULT_RANGE_STYLE */
+ final static private String DEFAULT_RANGE_STYLE = "range"; //$NON-NLS-1$
- final static String DEFAULT_SLIDER_WIDTH = "7px"; //$NON-NLS-1$
+ /** DEFAULT_RANGE_DECOR_STYLE */
+ final static private String DEFAULT_RANGE_DECOR_STYLE = "range-decor";
//$NON-NLS-1$
- final static String DEFAULT_SLIDER_HEIGHT = "8px"; //$NON-NLS-1$
+ /** DEFAULT_TRAILER_STYLE */
+ final static private String DEFAULT_TRAILER_STYLE = "trailer"; //$NON-NLS-1$
- final static String DEFAULT_SLIDER_BORDER = "0px"; //$NON-NLS-1$
+ /** DEFAULT_TRACK_STYLE */
+ final static private String DEFAULT_TRACK_STYLE = "track"; //$NON-NLS-1$
- final static String FIELD_STYLE_CLASS_ATR = "fieldStyleClass"; //$NON-NLS-1$
+ /** DEFAULT_HANDLE_STYLE */
+ final static private String DEFAULT_HANDLE_STYLE = "handle"; //$NON-NLS-1$
- final static String HANDLE_STYLE_CLASS_ATR = "handleStyleClass";
//$NON-NLS-1$
+ /** DEFAULT_HANDLE_STYLE */
+ final static private String DEFAULT_SLIDER_INPUT_FIELD_STYLE =
"slider-input-field"; //$NON-NLS-1$
- final static String RANGE_STYLE_CLASS_ATR = "rangeStyleClass"; //$NON-NLS-1$
+ /** RICH_DFS_CONTAINER_STYLE */
+ final static private String RICH_DFS_CONTAINER_STYLE =
"rich-dataFilterSlider-container"; //$NON-NLS-1$
- final static String TRACK_STYLE_CLASS_ATR = "trackStyleClass"; //$NON-NLS-1$
+ /** RICH_DFS_RANGE_STYLE */
+ final static private String RICH_DFS_RANGE_STYLE =
"rich-dataFilterSlider-range"; //$NON-NLS-1$
- final static String TRAILER_STYLE_CLASS_ATR = "trailerStyleClass";
//$NON-NLS-1$
+ /** RICH_DFS_RANGE_DECOR_STYLE */
+ final static private String RICH_DFS_RANGE_DECOR_STYLE =
"rich-dataFilterSlider-range-decor"; //$NON-NLS-1$
+ /** RICH_DFS_TRAILER_STYLE */
+ final static private String RICH_DFS_TRAILER_STYLE =
"rich-dataFilterSlider-trailer"; //$NON-NLS-1$
+
+ /** RICH_DFS_TRACK_STYLE */
+ final static private String RICH_DFS_TRACK_STYLE =
"rich-dataFilterSlider-track"; //$NON-NLS-1$
+
+ /** RICH_DFS_HANDLE_STYLE */
+ final static private String RICH_DFS_HANDLE_STYLE =
"rich-dataFilterSlider-handle"; //$NON-NLS-1$
+
+ /** RICH_DFS_INPUT_FIELD_STYLE */
+ final static private String RICH_DFS_INPUT_FIELD_STYLE =
"rich-dataFilterSlider-input-field"; //$NON-NLS-1$
+
+ /** Component style attributes */
+ final static String RANGE_STYLE_CLASS_ATTR = "rangeStyleClass"; //$NON-NLS-1$
+ final static String FIELD_STYLE_CLASS_ATTR = "fieldStyleClass"; //$NON-NLS-1$
+ final static String HANDLE_STYLE_CLASS_ATTR = "handleStyleClass";
//$NON-NLS-1$
+ final static String TRACK_STYLE_CLASS_ATTR = "trackStyleClass"; //$NON-NLS-1$
+ final static String TRAILER_STYLE_CLASS_ATTR = "trailerStyleClass";
//$NON-NLS-1$
+
/**
- * Constructor.
+ * Default constructor.
*/
public RichFacesDataFilterSliderTemplate() {
super();
@@ -72,7 +100,7 @@
* Creates a node of the visual tree on the node of the source tree. This
* visual node should not have the parent node This visual node can have
* child nodes.
- *
+ *
* @param pageContext
* Contains the information on edited page.
* @param sourceNode
@@ -82,416 +110,123 @@
* @return The information on the created node of the visual tree.
*/
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- int numWidth = 0;
+ // Set a css for this element
ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
"richFacesDataFilterSlider"); //$NON-NLS-1$
+
Element sourceElement = (Element) sourceNode;
- String style = ComponentUtil.getAttribute(sourceElement,
- RichFaces.ATTR_STYLE);
- String width = sourceElement.getAttribute(RichFaces.ATTR_WIDTH);
- if (width != null) {
- numWidth = getSize(width);
- if (numWidth < DEFAULT_WIDTH) {
- numWidth = DEFAULT_WIDTH;
- }
- } else {
- numWidth = DEFAULT_WIDTH;
- }
- String defaultStyle = style + Constants.SEMICOLON + HTML.STYLE_PARAMETER_WIDTH +
Constants.COLON + numWidth + "px ; "; //$NON-NLS-1$
- nsIDOMElement parentDiv = createDIV(visualDocument,
"slider-container", defaultStyle); //$NON-NLS-1$
- String rangeStyleClass =
ComponentUtil.getAttribute(sourceElement, RANGE_STYLE_CLASS_ATR);
- nsIDOMElement rangeDiv = createDIV(visualDocument, "range " +
rangeStyleClass, //$NON-NLS-1$
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + (numWidth - DEFAULT_PARAGRAPH) +
"px;"); //$NON-NLS-1$
- nsIDOMElement rangeDecorDiv = createDIV(visualDocument, "range-decor", null);
//$NON-NLS-1$
- String trailerStyleClass = ComponentUtil.getAttribute(sourceElement,
- TRAILER_STYLE_CLASS_ATR);
- nsIDOMElement trailerDiv = createDIV(visualDocument, "trailer "
//$NON-NLS-1$
- + trailerStyleClass, DEFAULT_SLIDER_POSITION);
- String trackStyleClass = ComponentUtil.getAttribute(sourceElement,
- TRACK_STYLE_CLASS_ATR);
- nsIDOMElement trackDiv = createDIV(visualDocument,
- "track " + trackStyleClass, HTML.STYLE_PARAMETER_WIDTH //$NON-NLS-1$
- + Constants.COLON + (numWidth - DEFAULT_PARAGRAPH) + "px;");
//$NON-NLS-1$
- String handleStyleClass =
ComponentUtil.getAttribute(sourceElement,HANDLE_STYLE_CLASS_ATR);
- nsIDOMElement handleDiv = createDIV(visualDocument, "handle " +
handleStyleClass, null); //$NON-NLS-1$
+ // create high level container DIV tag element
+ String style = ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_STYLE);
+ String styleClass = ComponentUtil.getAttribute(sourceElement,
RichFaces.ATTR_STYLE_CLASS);
+ styleClass = new
StringBuffer(DEFAULT_SLIDER_CONTAINER_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_CONTAINER_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ nsIDOMElement parentDiv = createDIV(visualDocument, styleClass, style);
+ // create RANGE container DIV tag element
+ style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
+ append(DEFAULT_WIDTH).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ styleClass = ComponentUtil.getAttribute(sourceElement, RANGE_STYLE_CLASS_ATTR);
+ styleClass = new StringBuffer(DEFAULT_RANGE_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_RANGE_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ nsIDOMElement rangeDiv = createDIV(visualDocument, styleClass, style);
+
+ // create RANGE-DECOR container DIV tag element
+ styleClass = new
StringBuffer(DEFAULT_RANGE_DECOR_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_RANGE_DECOR_STYLE).toString();
+ nsIDOMElement rangeDecorDiv = createDIV(visualDocument, styleClass, null);
+
+ // create TRAILER container DIV tag element
+ style = new StringBuffer(HTML.STYLE_PARAMETER_LEFT).append(Constants.COLON).
+ append(TRAILER_LEFT_OFFSET).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ styleClass = ComponentUtil.getAttribute(sourceElement, TRAILER_STYLE_CLASS_ATTR);
+ styleClass = new StringBuffer(DEFAULT_TRAILER_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_TRAILER_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ nsIDOMElement trailerDiv = createDIV(visualDocument, styleClass, style);
+
+ // create TRACK container DIV tag element
+ style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
+ append(DEFAULT_WIDTH).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ styleClass = ComponentUtil.getAttribute(sourceElement, TRACK_STYLE_CLASS_ATTR);
+ styleClass = new StringBuffer(DEFAULT_TRACK_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_TRACK_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ nsIDOMElement trackDiv = createDIV(visualDocument, styleClass, style);
+
+ // create HANDLE container DIV tag element
+ style = new StringBuffer(HTML.STYLE_PARAMETER_LEFT).append(Constants.COLON).
+ append(ZERO).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ styleClass = ComponentUtil.getAttribute(sourceElement, HANDLE_STYLE_CLASS_ATTR);
+ styleClass = new StringBuffer(DEFAULT_HANDLE_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_HANDLE_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ nsIDOMElement handleDiv = createDIV(visualDocument, styleClass, style);
+
+ // create element that represents trailer element
nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
ComponentUtil.setImg(img, CENTER_SLIDER);
- img.setAttribute(HTML.ATTR_WIDTH, DEFAULT_SLIDER_WIDTH);
- img.setAttribute(HTML.ATTR_BORDER,DEFAULT_SLIDER_BORDER);
- img.setAttribute(HTML.ATTR_HEIGHT, DEFAULT_SLIDER_HEIGHT);
+ img.setAttribute(HTML.ATTR_WIDTH, DEFAULT_SLIDER_WIDTH);
+ img.setAttribute(HTML.ATTR_BORDER, DEFAULT_SLIDER_BORDER);
+ img.setAttribute(HTML.ATTR_HEIGHT, DEFAULT_SLIDER_HEIGHT);
- /* Set input component */
+ // create INPUT tag element
nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
-
setAttributesToInputElement(input, sourceElement);
-
+ // create DOM tree in correspondence order
parentDiv.appendChild(rangeDiv);
rangeDiv.appendChild(rangeDecorDiv);
rangeDecorDiv.appendChild(trailerDiv);
trailerDiv.appendChild(trackDiv);
trackDiv.appendChild(handleDiv);
handleDiv.appendChild(img);
-
- nsIDOMElement tableSpacer2 = visualDocument.createElement(HTML.TAG_TABLE);
- tableSpacer2.setAttribute(HTML.ATTR_CELLSPACING, "0px"); //$NON-NLS-1$
- tableSpacer2.setAttribute(HTML.ATTR_CELLPADDING, "0px"); //$NON-NLS-1$
- tableSpacer2.setAttribute(HTML.ATTR_BORDER, "0px"); //$NON-NLS-1$
- tableSpacer2.setAttribute(HTML.ATTR_WIDTH, "100%" ); //$NON-NLS-1$
- tableSpacer2.setAttribute(HTML.ATTR_HEIGHT, "100%" ); //$NON-NLS-1$
-
- nsIDOMElement trSpacer2 = visualDocument.createElement(HTML.TAG_TR);
-
- nsIDOMElement tdSpacer2 = visualDocument.createElement(HTML.TAG_TD);
- tdSpacer2.setAttribute(HTML.ATTR_ALIGN, HTML.VALUE_ALIGN_RIGHT);
- tdSpacer2.setAttribute(HTML.ATTR_STYLE,"font-family: Arial, Verdana, sans-serif;
font-size: 5px; color: white;"); //$NON-NLS-1$
- trSpacer2.appendChild(tdSpacer2);
- nsIDOMElement imageSpacer2 = visualDocument.createElement(HTML.TAG_IMG);
- ComponentUtil.setImg(imageSpacer2, IMAGE_SPACER);
- imageSpacer2.setAttribute(HTML.ATTR_WIDTH, "100%"); //$NON-NLS-1$
- imageSpacer2.setAttribute(HTML.ATTR_HEIGHT, "100%"); //$NON-NLS-1$
- tdSpacer2.appendChild(imageSpacer2);
-
- tableSpacer2.appendChild(trSpacer2);
- trackDiv.appendChild(tableSpacer2);
-
parentDiv.appendChild(input);
+ // Create return variable contains template
VpeCreationData creationData = new VpeCreationData(parentDiv);
return creationData;
}
- /*
- * (non-Javadoc)
- *
- * @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#removeAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String)
- */
- @Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode,
- Object data, String name) {
- int numWidth = 0;
- super.removeAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
-
- nsIDOMElement element = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- nsIDOMElement input = getInputElement(element);
- setAttributesToInputElement(input, sourceElement);
-
- if (name.equalsIgnoreCase(RANGE_STYLE_CLASS_ATR)) {
- nsIDOMElement range = getRangeElement(element);
- range.removeAttribute(HTML.ATTR_CLASS);
- range.setAttribute(HTML.ATTR_CLASS, "range"); //$NON-NLS-1$
- } else if (name.equalsIgnoreCase(TRAILER_STYLE_CLASS_ATR)) {
- nsIDOMElement trailer = getTrailerElement(element);
- trailer.removeAttribute(HTML.ATTR_CLASS);
- trailer.setAttribute(HTML.ATTR_CLASS, "trailer"); //$NON-NLS-1$
- } else if (name.equalsIgnoreCase(TRACK_STYLE_CLASS_ATR)) {
- nsIDOMElement track = getTrackElement(element);
- track.removeAttribute(HTML.ATTR_CLASS);
- track.setAttribute(HTML.ATTR_CLASS, "track"); //$NON-NLS-1$
- } else if (name.equalsIgnoreCase(HANDLE_STYLE_CLASS_ATR)) {
- nsIDOMElement handle = getHandleElement(element);
- handle.removeAttribute(HTML.ATTR_CLASS);
- handle.setAttribute(HTML.ATTR_CLASS, "handle"); //$NON-NLS-1$
- } else if (name.equalsIgnoreCase(FIELD_STYLE_CLASS_ATR)) {
- nsIDOMElement field = getInputElement(element);
- setAttributesToInputElement( field, sourceElement );
- } else if (name.equalsIgnoreCase(RichFaces.ATTR_WIDTH)) {
- nsIDOMElement range = getRangeElement(element);
- String style = ComponentUtil.getAttribute(sourceElement,
- RichFaces.ATTR_STYLE);
- element.setAttribute(HTML.ATTR_STYLE, style + Constants.SEMICOLON
- + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + DEFAULT_WIDTH
- + "px ; "); //$NON-NLS-1$
- String rangeStyle = ComponentUtil.getAttribute(range,
- HTML.ATTR_STYLE);
- range.setAttribute(HTML.ATTR_STYLE, rangeStyle
- + Constants.SEMICOLON + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + (DEFAULT_WIDTH - DEFAULT_PARAGRAPH) + "px;"); //$NON-NLS-1$
- } else if (name.equalsIgnoreCase(RichFaces.ATTR_STYLE)) {
- String width = sourceElement
- .getAttribute(RichFaces.ATTR_WIDTH);
- if (width != null) {
- numWidth = getSize(width);
- if (numWidth < DEFAULT_WIDTH) {
- numWidth = DEFAULT_WIDTH;
- }
- } else {
- numWidth = DEFAULT_WIDTH;
- }
- String style = HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + numWidth
- + "px ; "; //$NON-NLS-1$
- element.setAttribute(HTML.ATTR_STYLE, style);
- } else {
- element.removeAttribute(name);
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String, java.lang.String)
- */
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name,
- String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
-
- nsIDOMElement parentDiv = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- nsIDOMElement input = getInputElement(parentDiv);
- setAttributesToInputElement(input, sourceElement);
-
-
- int numWidth = 0;
- if (name.equalsIgnoreCase(RichFaces.ATTR_WIDTH)) {
- int size = getSize(value);
- if (size < DEFAULT_WIDTH) {
- size = DEFAULT_WIDTH;
- }
- nsIDOMElement rangeDiv = getRangeElement(parentDiv);
- nsIDOMElement trackDiv = getTrackElement(parentDiv);
-
- String style = ComponentUtil.getAttribute(parentDiv,
- HTML.ATTR_STYLE);
- style = style + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + size
- + Constants.PIXEL + Constants.SEMICOLON;
- parentDiv.setAttribute(HTML.ATTR_STYLE, style);
- String rangeStyle = ComponentUtil.getAttribute(rangeDiv,
- HTML.ATTR_STYLE);
- rangeDiv.setAttribute(HTML.ATTR_STYLE, rangeStyle
- + Constants.SEMICOLON + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + (size - DEFAULT_PARAGRAPH) + "px;"); //$NON-NLS-1$
- String trackStyle = ComponentUtil.getAttribute(trackDiv,
- HTML.ATTR_STYLE);
- trackDiv.setAttribute(HTML.ATTR_STYLE, trackStyle
- + Constants.SEMICOLON + HTML.STYLE_PARAMETER_WIDTH+ Constants.COLON
- + +(size - DEFAULT_PARAGRAPH) + "px;"); //$NON-NLS-1$
-
- } else if (name.equalsIgnoreCase(RANGE_STYLE_CLASS_ATR)) {
- nsIDOMElement range = getRangeElement(parentDiv);
- range.setAttribute(HTML.ATTR_CLASS, "range " //$NON-NLS-1$
- + value);
- } else if (name.equalsIgnoreCase(TRACK_STYLE_CLASS_ATR)) {
- nsIDOMElement track = getTrackElement(parentDiv);
- track.setAttribute(HTML.ATTR_CLASS, "track " //$NON-NLS-1$
- + value);
- } else if (name.equalsIgnoreCase(TRAILER_STYLE_CLASS_ATR)) {
- nsIDOMElement trailer = getTrailerElement(parentDiv);
- trailer.setAttribute(HTML.ATTR_CLASS, "trailer " //$NON-NLS-1$
- + value);
- } else if (name.equalsIgnoreCase(HANDLE_STYLE_CLASS_ATR)) {
- nsIDOMElement handle = getHandleElement(parentDiv);
- handle.setAttribute(HTML.ATTR_CLASS, "handle " //$NON-NLS-1$
- + value);
- } else if (name.equalsIgnoreCase(FIELD_STYLE_CLASS_ATR)) {
- } else if (name.equalsIgnoreCase(RichFaces.ATTR_STYLE)) {
- String width = sourceElement
- .getAttribute(RichFaces.ATTR_WIDTH);
- if (width != null) {
- numWidth = getSize(width);
- if (numWidth < DEFAULT_WIDTH) {
- numWidth = DEFAULT_WIDTH;
- }
- } else {
- numWidth = DEFAULT_WIDTH;
- }
- String style = HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + numWidth
- + "px ; " + value; //$NON-NLS-1$
- parentDiv.setAttribute(HTML.ATTR_STYLE, style);
- } else {
- parentDiv.setAttribute(name, value);
- }
- }
-
/**
* Method for create DIV tag and set attributes
- *
- * @param visualDocument
- * @param styleClass
- * @param style
+ *
+ * @param visualDocument nsIDOMDocument value
+ * @param styleClass String value
+ * @param style String value
*/
private nsIDOMElement createDIV(nsIDOMDocument visualDocument, String styleClass, String
style) {
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
- if (styleClass != null) {
+ if (styleClass != null && !styleClass.equals(Constants.EMPTY)) {
div.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- if (style != null) {
+ if (style != null && !style.equals(Constants.EMPTY)) {
div.setAttribute(HTML.ATTR_STYLE, style);
}
return div;
}
/**
- * Method for convert String to number
- *
- * @param size
- * @return number
+ * Set attributes for INPUT element
+ *
+ * @param inputElement nsIDOMElement object
+ * @param sourceElement Element object
*/
- private int getSize(String size) {
- String num = size;
- int pos = num.indexOf(Constants.PIXEL);
- if (pos != -1) {
- num = num.substring(0, pos);
- }
- pos = num.indexOf(Constants.PERCENT);
- if (pos != -1) {
- num = num.substring(0, pos);
- }
- try {
- num = num.trim();
- Integer i = Integer.valueOf(num);
- return i.intValue();
- } catch (NumberFormatException e) {
- return 0;
- }
+ private void setAttributesToInputElement(nsIDOMElement inputElement, Element
sourceElement) {
+ String styleClass = ComponentUtil.getAttribute(sourceElement, FIELD_STYLE_CLASS_ATTR);
+ styleClass = new
StringBuffer(DEFAULT_SLIDER_INPUT_FIELD_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_DFS_INPUT_FIELD_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ String value = getAttribute("handleValue", sourceElement); //$NON-NLS-1$
+ inputElement.setAttribute(HTML.ATTR_CLASS, styleClass);
+ inputElement.setAttribute(HTML.ATTR_VALUE, value);
}
/**
- *
- * Get Range element from parent element.
- *
- * @param parent
- * element
- * @return range element
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(VpePageContext,
Element,
+ * nsIDOMDocument, nsIDOMElement, Object, String, String)
*/
- private nsIDOMElement getRangeElement(nsIDOMElement parent) {
- nsIDOMNodeList list = parent.getChildNodes();
- nsIDOMNode tempNode = list.item(0);
- nsIDOMElement returnElement =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return returnElement;
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
}
-
- /**
- * Get Trailer element from parent element.
- *
- * @param parent element
- * @return trailer element
- */
- private nsIDOMElement getTrailerElement(nsIDOMElement parent) {
- // get a slider element
- nsIDOMNodeList list = parent.getChildNodes();
- nsIDOMNode tempNode = list.item(0);
- nsIDOMElement slider =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a trailer element
- nsIDOMNodeList sliderList = slider.getChildNodes();
- nsIDOMNode tempTrailerNode = sliderList.item(0);
- nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a element
- nsIDOMNodeList trailerList = trailer.getChildNodes();
- nsIDOMNode temp2 = trailerList.item(0);
- nsIDOMElement returnElement =
(nsIDOMElement)temp2.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return returnElement;
- }
-
- /**
- * Get Track element from parent element.
- *
- * @param parent
- * element
- * @return track element
- */
- private nsIDOMElement getTrackElement(nsIDOMElement parent) {
-
- // get a range element
- nsIDOMNodeList list = parent.getChildNodes();
- nsIDOMNode tempRangeNode = list.item(0);
- nsIDOMElement range =
(nsIDOMElement)tempRangeNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a range decoder element
- nsIDOMNodeList rangeList = range.getChildNodes();
- nsIDOMNode tempRangeDecorNode = rangeList.item(0);
- nsIDOMElement rangeDecor =
(nsIDOMElement)tempRangeDecorNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a trailer
- nsIDOMNodeList rangeDecorList = rangeDecor.getChildNodes();
- nsIDOMNode tempTrailerNode = rangeDecorList.item(0);
- nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a element
- nsIDOMNodeList trailerList = trailer.getChildNodes();
- nsIDOMNode temp = trailerList.item(0);
- nsIDOMElement returnElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return returnElement;
- }
-
- /**
- * Get Handle element from parent element.
- *
- * @param parent
- * element
- * @return handle element
- */
- private nsIDOMElement getHandleElement(nsIDOMElement parent) {
- // get a range element
- nsIDOMNodeList list = parent.getChildNodes();
- nsIDOMNode tempRangeNode = list.item(0);
- nsIDOMElement range =
(nsIDOMElement)tempRangeNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a range decoder element
- nsIDOMNodeList rangeList = range.getChildNodes();
- nsIDOMNode tempRangeDecorNode = rangeList.item(0);
- nsIDOMElement rangeDecor =
(nsIDOMElement)tempRangeDecorNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a trailer
- nsIDOMNodeList rangeDecorList = rangeDecor.getChildNodes();
- nsIDOMNode tempTrailerNode = rangeDecorList.item(0);
- nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a track
- nsIDOMNodeList trailerList = trailer.getChildNodes();
- nsIDOMNode tempTrackNode = trailerList.item(0);
- nsIDOMElement track =
(nsIDOMElement)tempTrackNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- // get a element
- nsIDOMNodeList trackList = track.getChildNodes();
- nsIDOMNode temp = trackList.item(0);
- nsIDOMElement returnElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return returnElement;
- }
-
- /**
- * Get Input element from parent element.
- *
- * @param parent
- * element
- * @return input element
- */
- private nsIDOMElement getInputElement(nsIDOMElement parent) {
- nsIDOMNodeList list = parent.getChildNodes();
- nsIDOMNode tempNode = list.item(1);
- nsIDOMElement returnElement =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return returnElement;
- }
-
-
- private void setAttributesToInputElement( nsIDOMElement inputElement, Element
sourceElement) {
- String styleClass = getAttribute(FIELD_STYLE_CLASS_ATR, sourceElement);
- String value = getAttribute("handleValue", sourceElement); //$NON-NLS-1$
-
- if ( value.length() == 0 ) {
- value = "N/A"; //$NON-NLS-1$
- }
-
- inputElement.setAttribute(
- HTML.ATTR_CLASS,
- new
StringBuffer().append("slider-input-field").append(Constants.WHITE_SPACE).append(styleClass).toString()
//$NON-NLS-1$
- );
-
- inputElement.setAttribute(
- HTML.ATTR_VALUE,
- value
- );
- }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -17,11 +17,10 @@
import org.jboss.tools.vpe.editor.mapping.NodeData;
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -41,8 +40,11 @@
final static private String IMAGE_NAME_DOWN = "/inputNumberSpinner/down.gif";
//$NON-NLS-1$
/** DEFAULT_INPUT_SIZE */
- final static private String DEFAULT_INPUT_SIZE = "10"; //$NON-NLS-1$
+ final static private String DEFAULT_INPUT_SIZE = "10px"; //$NON-NLS-1$
+ final static private String DEFAULT_ZERO_SIZE = "0px"; //$NON-NLS-1$
+ final static private String DEFAULT_WIDTH = "1%"; //$NON-NLS-1$
+ /* Default and RichFaces styles */
/** DEFAULT_INPUT_STYLE */
final static private String DEFAULT_INPUT_STYLE = "dr-spnr-i"; //$NON-NLS-1$
@@ -55,10 +57,8 @@
/** DEFAULT_BUTTON_STYLE */
final static private String DEFAULT_BUTTON_STYLE = "dr-spnr-bn";
//$NON-NLS-1$
- final static private String ZERO_STRING = "0"; //$NON-NLS-1$
-
/** DISABLED_INPUT_STYLE applied for INPUT tag element in case of DISABLING */
- final static private String DISABLED_INPUT_STYLE = "color:gray";
//$NON-NLS-1$
+ final static private String DISABLED_INPUT_STYLE = "color:grey";
//$NON-NLS-1$
/* RichFaces styles for component elements */
/** RICH_SPINNER_C_STYLE */
@@ -77,6 +77,13 @@
final static private String RICH_SPINNER_BUTTONS_STYLE =
"rich-spinner-buttons"; //$NON-NLS-1$
/**
+ * Default constructor.
+ */
+ public RichFacesInputNumberSpinnerTemplate() {
+ super();
+ }
+
+ /**
* Creates a node of the visual tree on the node of the source tree. This
* visual node should not have the parent node This visual node can have
* child nodes.
@@ -98,9 +105,9 @@
Element sourceElement = (Element) sourceNode;
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLPADDING, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLSPACING, ZERO_STRING);
+ table.setAttribute(HTML.ATTR_BORDER, DEFAULT_ZERO_SIZE);
+ table.setAttribute(HTML.ATTR_CELLPADDING, DEFAULT_ZERO_SIZE);
+ table.setAttribute(HTML.ATTR_CELLSPACING, DEFAULT_ZERO_SIZE);
VpeElementData elementData = new VpeElementData();
@@ -108,15 +115,17 @@
// create input element
nsIDOMElement cellInput = visualDocument.createElement(HTML.TAG_TD);
- cellInput.setAttribute(HTML.ATTR_CLASS, DEFAULT_INPUT_CONTAINER_STYLE + " "
//$NON-NLS-1$
+ cellInput.setAttribute(HTML.ATTR_CLASS, DEFAULT_INPUT_CONTAINER_STYLE +
Constants.WHITE_SPACE
+ RICH_SPINNER_INPUT_CONTAINER_STYLE);
+ cellInput.setAttribute(HTML.ATTR_WIDTH, DEFAULT_WIDTH);
cellInput.appendChild(createInputElement(visualDocument, sourceElement, elementData));
row.appendChild(cellInput);
// create arrows cell
nsIDOMElement cellArrows = visualDocument.createElement(HTML.TAG_TD);
- cellArrows.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTONS_STYLE + " "
//$NON-NLS-1$
+ cellArrows.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTONS_STYLE + Constants.WHITE_SPACE
+ RICH_SPINNER_BUTTONS_STYLE);
+ cellArrows.setAttribute(HTML.ATTR_WIDTH, DEFAULT_WIDTH);
cellArrows.appendChild(createArrowsElement(visualDocument, sourceNode));
row.appendChild(cellArrows);
@@ -125,33 +134,32 @@
String tmp = getAttribute(sourceElement, RichFaces.ATTR_STYLE);
table.setAttribute(HTML.ATTR_STYLE, tmp);
tmp = getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS);
- tmp = new StringBuffer().append(RICH_SPINNER_C_STYLE).append("
").append(tmp).toString(); //$NON-NLS-1$
+ tmp = new
StringBuffer().append(RICH_SPINNER_C_STYLE).append(Constants.WHITE_SPACE).append(tmp).toString();
table.setAttribute(HTML.ATTR_CLASS, tmp);
- // Create return variable contain template
+ // Create return variable contains template
VpeCreationData creationData = new VpeCreationData(table);
-
creationData.setElementData(elementData);
return creationData;
}
/**
- * Create a HTML-part containg arrows elements
+ * Create a HTML-part containing arrows elements
*
* @param visualDocument
* The current node of the source tree.
* @param sourceNode
* The document of the visual tree.
- * @return a HTML-part containg arrows elements
+ * @return a HTML-part containing arrows elements
*/
private nsIDOMElement createArrowsElement(nsIDOMDocument visualDocument,
Node sourceNode) {
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLPADDING, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLSPACING, ZERO_STRING);
+ table.setAttribute(HTML.ATTR_BORDER, DEFAULT_ZERO_SIZE);
+ table.setAttribute(HTML.ATTR_CELLPADDING, DEFAULT_ZERO_SIZE);
+ table.setAttribute(HTML.ATTR_CELLSPACING, DEFAULT_ZERO_SIZE);
nsIDOMElement rowUp = visualDocument.createElement(HTML.TAG_TR);
nsIDOMElement cellUp = visualDocument.createElement(HTML.TAG_TD);
@@ -160,9 +168,9 @@
ComponentUtil.setImg(imageUpElement, IMAGE_NAME_UP);
- imageUpElement.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
+ imageUpElement.setAttribute(HTML.ATTR_BORDER, DEFAULT_ZERO_SIZE);
imageUpElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_IMAGE);
- imageUpElement.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTON_STYLE + " "
//$NON-NLS-1$
+ imageUpElement.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTON_STYLE +
Constants.WHITE_SPACE
+ RICH_SPINNER_BUTTON_STYLE);
cellUp.appendChild(imageUpElement);
@@ -176,9 +184,9 @@
ComponentUtil.setImg(imageDownElement, IMAGE_NAME_DOWN);
- imageDownElement.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
+ imageDownElement.setAttribute(HTML.ATTR_BORDER, DEFAULT_ZERO_SIZE);
imageDownElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_IMAGE);
- imageDownElement.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTON_STYLE + " "
//$NON-NLS-1$
+ imageDownElement.setAttribute(HTML.ATTR_CLASS, DEFAULT_BUTTON_STYLE +
Constants.WHITE_SPACE
+ RICH_SPINNER_BUTTON_STYLE);
cellDown.appendChild(imageDownElement);
rowDown.appendChild(cellDown);
@@ -206,6 +214,7 @@
inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
+ inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
if ((sourceElement).hasAttribute(RichFaces.ATTR_VALUE)) {
elementData.addNodeData(new NodeData(sourceElement
@@ -240,8 +249,8 @@
String returnValue = getAttribute(sourceElement, RichFaces.ATTR_INPUT_STYLE);
if ((sourceElement).hasAttribute(RichFaces.ATTR_DISABLED)) {
String disabled = getAttribute(sourceElement, RichFaces.ATTR_DISABLED);
- if (disabled != null && disabled.equals("true")) { //$NON-NLS-1$
- returnValue = new StringBuffer().append(returnValue).append(" ; ")
//$NON-NLS-1$
+ if (disabled != null && disabled.equals(Constants.TRUE)) {
+ returnValue = new StringBuffer().append(returnValue).append(Constants.SEMICOLON)
.append(DISABLED_INPUT_STYLE).toString();
}
}
@@ -257,7 +266,7 @@
* @return a input size
*/
protected String getInputSize(Element sourceElement) {
- String returnValue = getDefaultInputSize();
+ String returnValue = DEFAULT_INPUT_SIZE;
String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_SIZE);
if (tmp.length() != 0) {
returnValue = tmp;
@@ -273,57 +282,25 @@
* @return a input class
*/
public String getInputClass(Element sourceElement) {
- String returnValue = getDefaultInputClass();
+ String returnValue = DEFAULT_INPUT_STYLE;
// append default richfaces component style class
- returnValue += " " + RICH_SPINNER_INPUT_STYLE; //$NON-NLS-1$
+ returnValue += Constants.WHITE_SPACE + RICH_SPINNER_INPUT_STYLE;
// append custom input style class
String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_CLASS);
if (tmp.length() != 0) {
- returnValue = new StringBuffer().append(returnValue).append(" ")
//$NON-NLS-1$
- .append(tmp).toString();
+ returnValue = new
StringBuffer().append(returnValue).append(Constants.WHITE_SPACE).append(tmp).toString();
}
return returnValue;
}
/**
- *
- * @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String, java.lang.String)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(VpePageContext,
Element,
+ * nsIDOMDocument, nsIDOMElement, Object, String, String)
*/
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data,
- String name, String value) {
- // 1. Call super method
- super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
-
- nsIDOMElement table = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- nsIDOMNodeList listTable = table.getChildNodes();
- nsIDOMNode nodeTr = listTable.item(0);
- nsIDOMNodeList listTr = nodeTr.getChildNodes();
- nsIDOMNode nodeTd = listTr.item(0);
-
- nsIDOMNodeList listTd = nodeTd.getChildNodes();
- nsIDOMNode entry0 = listTd.item(0);
-
- nsIDOMElement inputElement = (nsIDOMElement)
entry0.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(sourceElement));
- inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(sourceElement));
- inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
- inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
-
- // 3. Set a style for main container
- String strStyle = getAttribute(sourceElement, RichFaces.ATTR_STYLE);
- table.setAttribute(HTML.ATTR_STYLE, strStyle);
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
}
-
- public String getDefaultInputSize() {
- return DEFAULT_INPUT_SIZE;
- }
-
- public String getDefaultInputClass() {
- return DEFAULT_INPUT_STYLE;
- }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -10,10 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.util.HashMap;
-import java.util.List;
-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;
@@ -22,104 +18,100 @@
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
+import org.jboss.tools.vpe.editor.util.Constants;
+
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class RichFacesPanelBarTemplate extends VpeAbstractTemplate implements
- VpeToggableTemplate, VpeTemplate {
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
- private static final String SEMI_COLON = ";"; //$NON-NLS-1$
+
+public class RichFacesPanelBarTemplate extends VpeAbstractTemplate implements
VpeToggableTemplate,
+ VpeTemplate {
private static final String PERCENT_100 = "100%"; //$NON-NLS-1$
private static final String PANEL_BAR_ITEM = ":panelBarItem";
//$NON-NLS-1$
- private static final String SPACE = " "; //$NON-NLS-1$
- private static final String EMPTY = ""; //$NON-NLS-1$
private static final String DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B = "dr-pnlbar
rich-panelbar dr-pnlbar-b "; //$NON-NLS-1$
private static final String PANEL_BAR_PANEL_BAR_CSS =
"panelBar/panelBar.css"; //$NON-NLS-1$
-
private static Map<Node, String> toggleMap = new HashMap<Node,
String>();
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+ nsIDOMElement table =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- Element sourceElement = (Element) sourceNode;
- nsIDOMElement table = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ VpeCreationData creationData = new VpeCreationData(table);
- VpeCreationData creationData = new VpeCreationData(table);
+ ComponentUtil.setCSSLink(pageContext, PANEL_BAR_PANEL_BAR_CSS,
"richFacesPanelBar"); //$NON-NLS-1$
- ComponentUtil.setCSSLink(pageContext, PANEL_BAR_PANEL_BAR_CSS,
- "richFacesPanelBar"); //$NON-NLS-1$
- String styleClass = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B
- + (styleClass == null ? EMPTY : styleClass));
+ String styleClass =
sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B + ((styleClass == null) ? Constants.EMPTY
: styleClass));
- // Set style attribute
- StringBuffer styleValue = new StringBuffer("padding: 0px; "); //$NON-NLS-1$
- styleValue.append(height(sourceElement)).append(SPACE).append(
- width(sourceElement)).append(SPACE).append(
- ComponentUtil.getAttribute(sourceElement,
- HtmlComponentUtil.HTML_STYLE_ATTR));
+ // Set style attribute
+ StringBuffer styleValue = new StringBuffer("padding: 0px; ");
//$NON-NLS-1$
+ styleValue.append(height(sourceElement)).append(Constants.WHITE_SPACE)
+ .append(width(sourceElement)).append(Constants.WHITE_SPACE)
+ .append(ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR));
- // Encode Body
- List<Node> children = ComponentUtil.getChildren(sourceElement);
- int activeId = getActiveId(sourceElement, children);
- int i = 0;
+ // Encode Body
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ int activeId = getActiveId(sourceElement, children);
+ int i = 0;
- String style = ComponentUtil.getAttribute(sourceElement,
- HtmlComponentUtil.HTML_STYLE_ATTR);
+ String style = ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR);
- String contentClass = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.CONTENT_CLASS);
- String contentStyle = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.CONTENT_STYLE);
- String headerClass = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.HEADER_CLASS);
- String headerStyle = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.HEADER_STYLE);
- String headerActiveStyle = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.HEADER_ACTIVE_STYLE);
- String headerActiveClass = ComponentUtil.getAttribute(sourceElement,
- RichFacesPanelItemTemplate.HEADER_ACTIVE_CLASS);
+ String contentClass = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.CONTENT_CLASS);
+ String contentStyle = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.CONTENT_STYLE);
+ String headerClass = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.HEADER_CLASS);
+ String headerStyle = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.HEADER_STYLE);
+ String headerActiveStyle = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.HEADER_ACTIVE_STYLE);
+ String headerActiveClass = ComponentUtil.getAttribute(sourceElement,
+ RichFacesPanelItemTemplate.HEADER_ACTIVE_CLASS);
- for (Node child : children) {
- boolean active = (i == activeId);
+ for (Node child : children) {
+ boolean active = (i == activeId);
- if (child.getNodeName().endsWith(PANEL_BAR_ITEM)) {
+ if (child.getNodeName().endsWith(PANEL_BAR_ITEM)) {
+ RichFacesPanelItemTemplate.encode(creationData, pageContext, (Element)
child,
+ visualDocument, table, active,
+ ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLECLASS_ATTR),
+ style, headerClass, headerStyle, headerActiveClass,
headerActiveStyle, contentClass,
+ contentStyle, String.valueOf(i));
- RichFacesPanelItemTemplate.encode(creationData, pageContext,
- (Element) child, visualDocument, table, active,
- ComponentUtil.getAttribute(sourceElement,
- HtmlComponentUtil.HTML_STYLECLASS_ATTR), style,
- headerClass, headerStyle, headerActiveClass,
- headerActiveStyle, contentClass, contentStyle, String
- .valueOf(i));
+ i++;
+ }
+ }
- i++;
- }
- }
+ table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleValue.toString());
- table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleValue
- .toString());
- return creationData;
+ return creationData;
}
/**
- *
+ *
* @param sourceElement
* @return
*/
private String height(Element sourceElement) {
String height = sourceElement.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR);
- if (height == null || height.length() == 0) {
+ if ((height == null) || (height.length() == 0)) {
height = PERCENT_100;
}
+
// added by estherbin fix not worked junit JBIDE1713Test
- Integer iHeight = null;
+ Integer iHeight = null;
+
//Added by estherbin
//fix
http://jira.jboss.com/jira/browse/JBIDE-2366
try {
@@ -127,23 +119,25 @@
} catch (NumberFormatException e) {
height = PERCENT_100;
}
-
+
return "height: " + getValue(height, iHeight); //$NON-NLS-1$
}
/**
- *
+ *
* @param sourceElement
* @return
*/
public String width(Element sourceElement) {
String width = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
- if (width == null || width.length() == 0) {
+
+ if ((width == null) || (width.length() == 0)) {
width = PERCENT_100;
}
+
// added by estherbin fix not worked junit JBIDE1713Test
Integer iWidth = null;
-
+
//Added by estherbin
//http://jira.jboss.com/jira/browse/JBIDE-2366
try {
@@ -151,85 +145,89 @@
} catch (NumberFormatException e) {
width = PERCENT_100;
}
-
- return "width: " + getValue(width,iWidth); //$NON-NLS-1$
+
+ return "width: " + getValue(width, iWidth); //$NON-NLS-1$
}
private String getValue(String width, Integer iWidth) {
- String rst = "";
-
+ String rst = Constants.EMPTY;
if (width.equals(PERCENT_100)) {
- rst = width + SEMI_COLON;
+ rst = width + Constants.SEMICOLON;
} else {
- rst = String.valueOf(iWidth) + ComponentUtil.PX_SUFFIX + SEMI_COLON;
+ rst = String.valueOf(iWidth) + Constants.PIXEL + Constants.SEMICOLON;
}
+
return rst;
}
/**
- *
+ *
*/
- public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
- String toggleId) {
- toggleMap.put(sourceNode, toggleId);
+ public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
+ toggleMap.put(sourceNode, toggleId);
}
/**
- *
+ *
*/
public void stopToggling(Node sourceNode) {
- toggleMap.remove(sourceNode);
+ toggleMap.remove(sourceNode);
}
/**
- *
+ *
* @param sourceElement
* @param children
* @return
*/
private int getActiveId(Element sourceElement, List<Node> children) {
- int activeId = -1;
- try {
- activeId = Integer.valueOf((String) toggleMap.get(sourceElement));
- } catch (NumberFormatException nfe) {
- activeId = -1;
- }
+ int activeId = -1;
- if (activeId == -1)
- activeId = 0;
+ try {
+ activeId = Integer.valueOf((String) toggleMap.get(sourceElement));
+ } catch (NumberFormatException nfe) {
+ activeId = -1;
+ }
- int count = getChildrenCount(children);
- if (count - 1 < activeId) {
- activeId = count - 1;
- }
+ if (activeId == -1) {
+ activeId = 0;
+ }
- return activeId;
+ int count = getChildrenCount(children);
+
+ if ((count - 1) < activeId) {
+ activeId = count - 1;
+ }
+
+ return activeId;
}
/**
- *
+ *
* @param children
* @return
*/
private int getChildrenCount(List<Node> children) {
- int count = 0;
- for (Node child : children) {
- if (child.getNodeName().endsWith(PANEL_BAR_ITEM)) {
- count++;
- }
- }
- return count;
+ int count = 0;
+
+ for (Node child : children) {
+ if (child.getNodeName().endsWith(PANEL_BAR_ITEM)) {
+ count++;
+ }
+ }
+
+ return count;
}
@Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR)
- || name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR)
- || name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR))
- return true;
- return false;
- }
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element
sourceElement,
+ nsIDOMDocument visualDocument, nsIDOMElement visualNode, Object data, String
name, String value) {
+ if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR) ||
+ name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR) ||
+ name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR)) {
+ return true;
+ }
-}
\ No newline at end of file
+ return false;
+ }
+}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml 2008-11-10
12:43:26 UTC (rev 11632)
@@ -1,15 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:rich="http://richfaces.org/rich">
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
<head>
</head>
<body>
- <!-- Data Filter Slider -->
- <rich:dataFilterSlider startRange="1" endRange="1000"
increment="100" trailer="false" id="dataFilterSlider"/>
+ <rich:dataFilterSlider id="dataFilterSlider"
+ startRange="1" endRange="1000" increment="100"
handleValue="1"
+ trailer="false"/>
+ <rich:dataFilterSlider id="dataFilterSliderCustomCSS"
+ startRange="1" endRange="1000" increment="100"
handleValue="1"
+ trailer="false"
+ styleClass="commonStyle"
+ fieldStyleClass="fieldStyle"
+ handleStyleClass="handleStyle"
+ rangeStyleClass="rangeStyle"
+ trackStyleClass="trackStyle"
+ trailerStyleClass="trailerStyle"
+ style="color:yellow"/>
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml 2008-11-10
12:43:26 UTC (rev 11632)
@@ -1,27 +1,38 @@
<tests>
<test id="dataFilterSlider">
- <DIV CLASS="slider-container" STYLE="width: 260px;">
- <DIV CLASS="range" STYLE="width: 200px;">
- <DIV CLASS="range-decor">
- <DIV CLASS="trailer" STYLE="left: -38px; width: 114px;">
- <DIV CLASS="track" STYLE="width: 200px;">
- <DIV CLASS="handle">
- <IMG WIDTH="7" HEIGHT="8" BORDER="0" />
+ <DIV CLASS="slider-container rich-dataFilterSlider-container">
+ <DIV CLASS="range rich-dataFilterSlider-range" STYLE="width:
200px;">
+ <DIV CLASS="range-decor rich-dataFilterSlider-range-decor">
+ <DIV CLASS="trailer rich-dataFilterSlider-trailer" STYLE="left:
-38px;">
+ <DIV CLASS="track rich-dataFilterSlider-track" STYLE="width:
200px;">
+ <DIV CLASS="handle rich-dataFilterSlider-handle" STYLE="left:
0px;">
+ <IMG WIDTH="7" HEIGHT="8" BORDER="0"
+ SRC="/.*resources/dataFilterSlider/pos.gif/" />
</DIV>
- <TABLE WIDTH="100%" HEIGHT="100%"
CELLSPACING="0"
- CELLPADDING="0" BORDER="0">
- <TR>
- <TD ALIGN="right"
- STYLE="font-family: Arial,Verdana,sans-serif; font-size: 5px; color:
white;">
- <IMG WIDTH="100%" HEIGHT="100%" />
- </TD>
- </TR>
- </TABLE>
</DIV>
</DIV>
</DIV>
</DIV>
- <INPUT TYPE="text" CLASS="slider-input-field"
VALUE="N/A" />
+ <INPUT TYPE="text"
+ CLASS="slider-input-field rich-dataFilterSlider-input-field"
VALUE="1" />
</DIV>
</test>
+ <test id="dataFilterSliderCustomCSS">
+ <DIV CLASS="slider-container rich-dataFilterSlider-container commonStyle"
STYLE="color: yellow;">
+ <DIV CLASS="range rich-dataFilterSlider-range rangeStyle"
STYLE="width: 200px;">
+ <DIV CLASS="range-decor rich-dataFilterSlider-range-decor">
+ <DIV CLASS="trailer rich-dataFilterSlider-trailer trailerStyle"
STYLE="left: -38px;">
+ <DIV CLASS="track rich-dataFilterSlider-track trackStyle"
STYLE="width: 200px;">
+ <DIV CLASS="handle rich-dataFilterSlider-handle handleStyle"
+ STYLE="left: 0px;">
+ <IMG WIDTH="7" HEIGHT="8" BORDER="0"
+ SRC="/.*resources/dataFilterSlider/pos.gif/"/>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ <INPUT TYPE="text" CLASS="slider-input-field
rich-dataFilterSlider-input-field fieldStyle" VALUE="1"/>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSConstants.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSConstants.java 2008-11-10
11:09:06 UTC (rev 11631)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSConstants.java 2008-11-10
12:43:26 UTC (rev 11632)
@@ -1,39 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
-
-/**
- * This class contains CSS constants
- *
- * @author dsakovich(a)exadel.com
- *
- */
-public class CSSConstants {
-
- public static final String BACKGROUND_REPEAT = "background-repeat";
- public static final String BACKGROUND_COLOR = "background-color";
- public static final String BACKGROUND_IMAGE = "background-image";
- public static final String BORDER_STYLE = "border-style";
- public static final String BORDER_WIDTH = "border-width";
- public static final String WIDTH = "width";
- public static final String HEIGHT = "height";
- public static final String BORDER_COLOR = "border-color";
- public static final String MARGIN = "margin";
- public static final String PADDING = "padding";
- public static final String FONT_SIZE = "font-size";
- public static final String FONT_STYLE = "font-style";
- public static final String FONT_WEIGHT = "font-weight";
- public static final String TEXT_DECORATION = "text-decoration";
- public static final String TEXT_ALIGN = "text-align";
- public static final String FONT_FAMILY = "font-family";
- public static final String COLOR = "color";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+
+
+/**
+ * This class contains CSS constants
+ *
+ * @author dsakovich(a)exadel.com
+ */
+public class CSSConstants {
+ public static final String BACKGROUND_REPEAT = "background-repeat";
//$NON-NLS-1$
+ public static final String BACKGROUND_COLOR = "background-color";
//$NON-NLS-1$
+ public static final String BACKGROUND_IMAGE = "background-image";
//$NON-NLS-1$
+ public static final String BORDER_STYLE = "border-style"; //$NON-NLS-1$
+ public static final String BORDER_WIDTH = "border-width"; //$NON-NLS-1$
+ public static final String WIDTH = "width"; //$NON-NLS-1$
+ public static final String HEIGHT = "height"; //$NON-NLS-1$
+ public static final String BORDER_COLOR = "border-color"; //$NON-NLS-1$
+ public static final String MARGIN = "margin"; //$NON-NLS-1$
+ public static final String PADDING = "padding"; //$NON-NLS-1$
+ public static final String FONT_SIZE = "font-size"; //$NON-NLS-1$
+ public static final String FONT_STYLE = "font-style"; //$NON-NLS-1$
+ public static final String FONT_WEIGHT = "font-weight"; //$NON-NLS-1$
+ public static final String TEXT_DECORATION = "text-decoration";
//$NON-NLS-1$
+ public static final String TEXT_ALIGN = "text-align"; //$NON-NLS-1$
+ public static final String FONT_FAMILY = "font-family"; //$NON-NLS-1$
+ public static final String COLOR = "color"; //$NON-NLS-1$
+}