JBoss Tools SVN: r11638 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-10 10:38:24 -0500 (Mon, 10 Nov 2008)
New Revision: 11638
Added:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/EncodedProperties.java
Removed:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/Properties_.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/PropertiesLoader.java
Log:
JBIDE-2601 Properties_.java renamed to EncodedProperties
Copied: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/EncodedProperties.java (from rev 11610, trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/Properties_.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/EncodedProperties.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/EncodedProperties.java 2008-11-10 15:38:24 UTC (rev 11638)
@@ -0,0 +1,406 @@
+package org.jboss.tools.common.model.loaders.impl;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.jboss.tools.common.CommonPlugin;
+
+public class EncodedProperties extends Properties {
+ private static final long serialVersionUID = 4112578634029123456L;
+
+ /**
+ * V.K.
+ */
+ private String encoding = "8859_1";
+
+ /**
+ * Creates an empty property list with no default values.
+ */
+ public EncodedProperties() {
+ this(null);
+ }
+
+ /**
+ * Creates an empty property list with the specified defaults.
+ *
+ * @param defaults the defaults.
+ */
+ public EncodedProperties(EncodedProperties defaults) {
+ super(defaults);
+ }
+
+ /**
+ * V.K
+ * @param encoding
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ /**
+ *
+ * @param inStream the input stream.
+ * @exception IOException if an error occurred when reading from the
+ * input stream.
+ * @throws IllegalArgumentException if the input stream contains a
+ * malformed Unicode escape sequence.
+ */
+ public synchronized void load(InputStream inStream) throws IOException {
+ char[] convtBuf = new char[1024];
+ LineReader lr = new LineReader(inStream);
+
+ int limit;
+ int keyLen;
+ int valueStart;
+ char c;
+ boolean hasSep;
+ boolean precedingBackslash;
+
+ while ((limit = lr.readLine()) >= 0) {
+ c = 0;
+ keyLen = 0;
+ valueStart = limit;
+ hasSep = false;
+
+ //System.out.println("line=<" + new String(lineBuf, 0, limit) + ">");
+ precedingBackslash = false;
+ while (keyLen < limit) {
+ c = lr.lineBuf[keyLen];
+ //need check if escaped.
+ if ((c == '=' || c == ':') && !precedingBackslash) {
+ valueStart = keyLen + 1;
+ hasSep = true;
+ break;
+ } else if ((c == ' ' || c == '\t' || c == '\f') && !precedingBackslash) {
+ valueStart = keyLen + 1;
+ break;
+ }
+ if (c == '\\') {
+ precedingBackslash = !precedingBackslash;
+ } else {
+ precedingBackslash = false;
+ }
+ keyLen++;
+ }
+ while (valueStart < limit) {
+ c = lr.lineBuf[valueStart];
+ if (c != ' ' && c != '\t' && c != '\f') {
+ if (!hasSep && (c == '=' || c == ':')) {
+ hasSep = true;
+ } else {
+ break;
+ }
+ }
+ valueStart++;
+ }
+ String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
+ String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
+ put(key, value);
+ }
+ }
+
+ private String readStream(InputStream is) {
+ StringBuffer sb = new StringBuffer("");
+ try {
+ byte[] b = new byte[4096];
+ while(true) {
+ int l = is.read(b, 0, b.length);
+ if(l < 0) break;
+ sb.append(new String(b, 0, l, encoding));
+ }
+ is.close();
+ } catch (IOException e) {
+ CommonPlugin.getPluginLog().logError(e);
+ }
+ return sb.toString();
+ }
+
+
+ /* read in a "logical line" from input stream, skip all comment and
+ * blank lines and filter out those leading whitespace characters
+ * (\u0020, \u0009 and \u000c) from the beginning of a "natural line".
+ * Method returns the char length of the "logical line" and stores
+ * the line in "lineBuf".
+ */
+ class LineReader {
+ char[] lineBuf = new char[1024];
+ int inOff = 0;
+ int inLimit = 0;
+ String source = null;
+
+ public LineReader(InputStream inStream) {
+ source = readStream(inStream);
+ inLimit = source.length();
+ }
+
+ int readLine() throws IOException {
+ int len = 0;
+ char c = 0;
+
+ boolean skipWhiteSpace = true;
+ boolean isCommentLine = false;
+ boolean isNewLine = true;
+ boolean appendedLineBegin = false;
+ boolean precedingBackslash = false;
+ boolean skipLF = false;
+
+ while (true) {
+ if (inOff >= inLimit) {
+ if (len == 0 || isCommentLine) {
+ return -1;
+ }
+ return len;
+ }
+
+ //V.K.
+ c = source.charAt(inOff++);
+
+ if (skipLF) {
+ skipLF = false;
+ if (c == '\n') {
+ continue;
+ }
+ }
+ if (skipWhiteSpace) {
+ if (c == ' ' || c == '\t' || c == '\f') {
+ continue;
+ }
+ if (!appendedLineBegin && (c == '\r' || c == '\n')) {
+ continue;
+ }
+ skipWhiteSpace = false;
+ appendedLineBegin = false;
+ }
+ if (isNewLine) {
+ isNewLine = false;
+ if (c == '#' || c == '!') {
+ isCommentLine = true;
+ continue;
+ }
+ }
+
+ if (c != '\n' && c != '\r') {
+ lineBuf[len++] = c;
+ if (len == lineBuf.length) {
+ int newLength = lineBuf.length * 2;
+ if (newLength < 0) {
+ newLength = Integer.MAX_VALUE;
+ }
+ char[] buf = new char[newLength];
+ System.arraycopy(lineBuf, 0, buf, 0, lineBuf.length);
+ lineBuf = buf;
+ }
+ //flip the preceding backslash flag
+ if (c == '\\') {
+ precedingBackslash = !precedingBackslash;
+ } else {
+ precedingBackslash = false;
+ }
+ } else {
+ // reached EOL
+ if (isCommentLine || len == 0) {
+ isCommentLine = false;
+ isNewLine = true;
+ skipWhiteSpace = true;
+ len = 0;
+ continue;
+ }
+ if (inOff >= inLimit) {
+ return len;
+ }
+ if (precedingBackslash) {
+ len -= 1;
+ //skip the leading whitespace characters in following line
+ skipWhiteSpace = true;
+ appendedLineBegin = true;
+ precedingBackslash = false;
+ if (c == '\r') {
+ skipLF = true;
+ }
+ } else {
+ return len;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Converts encoded \uxxxx to unicode chars
+ * and changes special saved chars to their original forms
+ */
+ private String loadConvert (char[] in, int off, int len, char[] convtBuf) {
+ if (convtBuf.length < len) {
+ int newLen = len * 2;
+ if (newLen < 0) {
+ newLen = Integer.MAX_VALUE;
+ }
+ convtBuf = new char[newLen];
+ }
+ char aChar;
+ char[] out = convtBuf;
+ int outLen = 0;
+ int end = off + len;
+
+ while (off < end) {
+ aChar = in[off++];
+ if (aChar == '\\') {
+ aChar = in[off++];
+ if(aChar == 'u') {
+ // Read the xxxx
+ int value=0;
+ for (int i=0; i<4; i++) {
+ aChar = in[off++];
+ switch (aChar) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ value = (value << 4) + aChar - '0';
+ break;
+ case 'a': case 'b': case 'c':
+ case 'd': case 'e': case 'f':
+ value = (value << 4) + 10 + aChar - 'a';
+ break;
+ case 'A': case 'B': case 'C':
+ case 'D': case 'E': case 'F':
+ value = (value << 4) + 10 + aChar - 'A';
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "Malformed \\uxxxx encoding.");
+ }
+ }
+ out[outLen++] = (char)value;
+ } else {
+ if (aChar == 't') aChar = '\t';
+ else if (aChar == 'r') aChar = '\r';
+ else if (aChar == 'n') aChar = '\n';
+ else if (aChar == 'f') aChar = '\f';
+ out[outLen++] = aChar;
+ }
+ } else {
+ out[outLen++] = (char)aChar;
+ }
+ }
+ return new String (out, 0, outLen);
+ }
+
+ /*
+ * Converts unicodes to encoded \uxxxx and escapes
+ * special characters with a preceding slash
+ */
+ public static String saveConvert(String theString, boolean escapeSpace) {
+ int len = theString.length();
+ int bufLen = len * 2;
+ if (bufLen < 0) {
+ bufLen = Integer.MAX_VALUE;
+ }
+ StringBuffer outBuffer = new StringBuffer(bufLen);
+
+ for(int x=0; x<len; x++) {
+ char aChar = theString.charAt(x);
+ // Handle common case first, selecting largest block that
+ // avoids the specials below
+ if ((aChar > 61) && (aChar < 127)) {
+ if (aChar == '\\') {
+ outBuffer.append('\\'); outBuffer.append('\\');
+ continue;
+ }
+ outBuffer.append(aChar);
+ continue;
+ }
+ switch(aChar) {
+ case ' ':
+ if (x == 0 || escapeSpace)
+ outBuffer.append('\\');
+ outBuffer.append(' ');
+ break;
+ case '\t':outBuffer.append('\\'); outBuffer.append('t');
+ break;
+ case '\n':outBuffer.append('\\'); outBuffer.append('n');
+ break;
+ case '\r':outBuffer.append('\\'); outBuffer.append('r');
+ break;
+ case '\f':outBuffer.append('\\'); outBuffer.append('f');
+ break;
+ case '=': // Fall through
+ case ':': // Fall through
+ case '#': // Fall through
+ case '!':
+ outBuffer.append('\\'); outBuffer.append(aChar);
+ break;
+ default:
+ if ((aChar < 0x0020) || (aChar > 0x007e)) {
+ outBuffer.append('\\');
+ outBuffer.append('u');
+ outBuffer.append(toHex((aChar >> 12) & 0xF));
+ outBuffer.append(toHex((aChar >> 8) & 0xF));
+ outBuffer.append(toHex((aChar >> 4) & 0xF));
+ outBuffer.append(toHex( aChar & 0xF));
+ } else {
+ outBuffer.append(aChar);
+ }
+ }
+ }
+ return outBuffer.toString();
+ }
+
+ public synchronized void store(OutputStream out, String comments)
+ throws IOException
+ {
+ BufferedWriter awriter;
+ awriter = new BufferedWriter(new OutputStreamWriter(out, encoding));
+ if (comments != null)
+ writeln(awriter, "#" + comments);
+ writeln(awriter, "#" + new Date().toString());
+ for (Enumeration e = keys(); e.hasMoreElements();) {
+ String key = (String)e.nextElement();
+ String val = (String)get(key);
+ key = saveConvert(key, true);
+
+ /* No need to escape embedded and trailing spaces for value, hence
+ * pass false to flag.
+ */
+ val = saveConvert(val, false);
+ writeln(awriter, key + "=" + val);
+ }
+ awriter.flush();
+ }
+
+ private static void writeln(BufferedWriter bw, String s) throws IOException {
+ bw.write(s);
+ bw.newLine();
+ }
+
+ /**
+ * Convert a nibble to a hex character
+ * @param nibble the nibble to convert.
+ */
+ private static char toHex(int nibble) {
+ return hexDigit[(nibble & 0xF)];
+ }
+
+ /** A table of hex digits */
+ private static final char[] hexDigit = {
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+ };
+
+ public static void main(String[] args) {
+ String ps = "p1:v1 \\\n hh \\\n gg\n\np2=v2\\u0034\\u0055";
+ EncodedProperties p = new EncodedProperties();
+ ByteArrayInputStream s = new ByteArrayInputStream(ps.getBytes());
+ try {
+ p.load(s);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ p.list(System.out);
+ }
+
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/PropertiesLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/PropertiesLoader.java 2008-11-10 15:37:05 UTC (rev 11637)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/PropertiesLoader.java 2008-11-10 15:38:24 UTC (rev 11638)
@@ -49,7 +49,7 @@
object.setAttributeValue("encoding", encoding);
String body = XModelObjectLoaderUtil.getTempBody(object);
- Properties_ properties = new Properties_();
+ EncodedProperties properties = new EncodedProperties();
properties.setEncoding(encoding);
Properties mapping = new Properties();
try {
@@ -58,7 +58,7 @@
Iterator it = properties.keySet().iterator();
while(it.hasNext()) {
String nm = it.next().toString();
- String sn = Properties_.saveConvert(nm, true); // convertName(nm);
+ String sn = EncodedProperties.saveConvert(nm, true); // convertName(nm);
mapping.put(sn, nm);
}
} catch (IOException e) {
@@ -182,11 +182,11 @@
appendComments(sb, cs[i].get("COMMENTS"), cs[i].get("SEPARATOR"), lineSeparator);
if("no".equals(cs[i].get("ENABLED"))) sb.append('#');
String dirtyname = cs[i].getAttributeValue("dirtyname");
- String name = Properties_.saveConvert(cs[i].get("NAME"), true); // convertName(cs[i].get("NAME"));
+ String name = EncodedProperties.saveConvert(cs[i].get("NAME"), true); // convertName(cs[i].get("NAME"));
String value = cs[i].get("VALUE");
String dirtyvalue = cs[i].getAttributeValue("dirtyvalue");
if(value == null || dirtyvalue == null || !value.equals(dirtyvalue.trim())) {
- value = Properties_.saveConvert(value, false); // convertValue(value);
+ value = EncodedProperties.saveConvert(value, false); // convertValue(value);
}
String resolved = resolveValue(value, dirtyvalue);
//preserve one white space after separator
Deleted: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/Properties_.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/Properties_.java 2008-11-10 15:37:05 UTC (rev 11637)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/Properties_.java 2008-11-10 15:38:24 UTC (rev 11638)
@@ -1,406 +0,0 @@
-package org.jboss.tools.common.model.loaders.impl;
-
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.jboss.tools.common.CommonPlugin;
-
-public class Properties_ extends Properties {
- private static final long serialVersionUID = 4112578634029123456L;
-
- /**
- * V.K.
- */
- private String encoding = "8859_1";
-
- /**
- * Creates an empty property list with no default values.
- */
- public Properties_() {
- this(null);
- }
-
- /**
- * Creates an empty property list with the specified defaults.
- *
- * @param defaults the defaults.
- */
- public Properties_(Properties_ defaults) {
- super(defaults);
- }
-
- /**
- * V.K
- * @param encoding
- */
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- /**
- *
- * @param inStream the input stream.
- * @exception IOException if an error occurred when reading from the
- * input stream.
- * @throws IllegalArgumentException if the input stream contains a
- * malformed Unicode escape sequence.
- */
- public synchronized void load(InputStream inStream) throws IOException {
- char[] convtBuf = new char[1024];
- LineReader lr = new LineReader(inStream);
-
- int limit;
- int keyLen;
- int valueStart;
- char c;
- boolean hasSep;
- boolean precedingBackslash;
-
- while ((limit = lr.readLine()) >= 0) {
- c = 0;
- keyLen = 0;
- valueStart = limit;
- hasSep = false;
-
- //System.out.println("line=<" + new String(lineBuf, 0, limit) + ">");
- precedingBackslash = false;
- while (keyLen < limit) {
- c = lr.lineBuf[keyLen];
- //need check if escaped.
- if ((c == '=' || c == ':') && !precedingBackslash) {
- valueStart = keyLen + 1;
- hasSep = true;
- break;
- } else if ((c == ' ' || c == '\t' || c == '\f') && !precedingBackslash) {
- valueStart = keyLen + 1;
- break;
- }
- if (c == '\\') {
- precedingBackslash = !precedingBackslash;
- } else {
- precedingBackslash = false;
- }
- keyLen++;
- }
- while (valueStart < limit) {
- c = lr.lineBuf[valueStart];
- if (c != ' ' && c != '\t' && c != '\f') {
- if (!hasSep && (c == '=' || c == ':')) {
- hasSep = true;
- } else {
- break;
- }
- }
- valueStart++;
- }
- String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
- String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
- put(key, value);
- }
- }
-
- private String readStream(InputStream is) {
- StringBuffer sb = new StringBuffer("");
- try {
- byte[] b = new byte[4096];
- while(true) {
- int l = is.read(b, 0, b.length);
- if(l < 0) break;
- sb.append(new String(b, 0, l, encoding));
- }
- is.close();
- } catch (IOException e) {
- CommonPlugin.getPluginLog().logError(e);
- }
- return sb.toString();
- }
-
-
- /* read in a "logical line" from input stream, skip all comment and
- * blank lines and filter out those leading whitespace characters
- * (\u0020, \u0009 and \u000c) from the beginning of a "natural line".
- * Method returns the char length of the "logical line" and stores
- * the line in "lineBuf".
- */
- class LineReader {
- char[] lineBuf = new char[1024];
- int inOff = 0;
- int inLimit = 0;
- String source = null;
-
- public LineReader(InputStream inStream) {
- source = readStream(inStream);
- inLimit = source.length();
- }
-
- int readLine() throws IOException {
- int len = 0;
- char c = 0;
-
- boolean skipWhiteSpace = true;
- boolean isCommentLine = false;
- boolean isNewLine = true;
- boolean appendedLineBegin = false;
- boolean precedingBackslash = false;
- boolean skipLF = false;
-
- while (true) {
- if (inOff >= inLimit) {
- if (len == 0 || isCommentLine) {
- return -1;
- }
- return len;
- }
-
- //V.K.
- c = source.charAt(inOff++);
-
- if (skipLF) {
- skipLF = false;
- if (c == '\n') {
- continue;
- }
- }
- if (skipWhiteSpace) {
- if (c == ' ' || c == '\t' || c == '\f') {
- continue;
- }
- if (!appendedLineBegin && (c == '\r' || c == '\n')) {
- continue;
- }
- skipWhiteSpace = false;
- appendedLineBegin = false;
- }
- if (isNewLine) {
- isNewLine = false;
- if (c == '#' || c == '!') {
- isCommentLine = true;
- continue;
- }
- }
-
- if (c != '\n' && c != '\r') {
- lineBuf[len++] = c;
- if (len == lineBuf.length) {
- int newLength = lineBuf.length * 2;
- if (newLength < 0) {
- newLength = Integer.MAX_VALUE;
- }
- char[] buf = new char[newLength];
- System.arraycopy(lineBuf, 0, buf, 0, lineBuf.length);
- lineBuf = buf;
- }
- //flip the preceding backslash flag
- if (c == '\\') {
- precedingBackslash = !precedingBackslash;
- } else {
- precedingBackslash = false;
- }
- } else {
- // reached EOL
- if (isCommentLine || len == 0) {
- isCommentLine = false;
- isNewLine = true;
- skipWhiteSpace = true;
- len = 0;
- continue;
- }
- if (inOff >= inLimit) {
- return len;
- }
- if (precedingBackslash) {
- len -= 1;
- //skip the leading whitespace characters in following line
- skipWhiteSpace = true;
- appendedLineBegin = true;
- precedingBackslash = false;
- if (c == '\r') {
- skipLF = true;
- }
- } else {
- return len;
- }
- }
- }
- }
- }
-
- /*
- * Converts encoded \uxxxx to unicode chars
- * and changes special saved chars to their original forms
- */
- private String loadConvert (char[] in, int off, int len, char[] convtBuf) {
- if (convtBuf.length < len) {
- int newLen = len * 2;
- if (newLen < 0) {
- newLen = Integer.MAX_VALUE;
- }
- convtBuf = new char[newLen];
- }
- char aChar;
- char[] out = convtBuf;
- int outLen = 0;
- int end = off + len;
-
- while (off < end) {
- aChar = in[off++];
- if (aChar == '\\') {
- aChar = in[off++];
- if(aChar == 'u') {
- // Read the xxxx
- int value=0;
- for (int i=0; i<4; i++) {
- aChar = in[off++];
- switch (aChar) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- value = (value << 4) + aChar - '0';
- break;
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- value = (value << 4) + 10 + aChar - 'a';
- break;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- value = (value << 4) + 10 + aChar - 'A';
- break;
- default:
- throw new IllegalArgumentException(
- "Malformed \\uxxxx encoding.");
- }
- }
- out[outLen++] = (char)value;
- } else {
- if (aChar == 't') aChar = '\t';
- else if (aChar == 'r') aChar = '\r';
- else if (aChar == 'n') aChar = '\n';
- else if (aChar == 'f') aChar = '\f';
- out[outLen++] = aChar;
- }
- } else {
- out[outLen++] = (char)aChar;
- }
- }
- return new String (out, 0, outLen);
- }
-
- /*
- * Converts unicodes to encoded \uxxxx and escapes
- * special characters with a preceding slash
- */
- public static String saveConvert(String theString, boolean escapeSpace) {
- int len = theString.length();
- int bufLen = len * 2;
- if (bufLen < 0) {
- bufLen = Integer.MAX_VALUE;
- }
- StringBuffer outBuffer = new StringBuffer(bufLen);
-
- for(int x=0; x<len; x++) {
- char aChar = theString.charAt(x);
- // Handle common case first, selecting largest block that
- // avoids the specials below
- if ((aChar > 61) && (aChar < 127)) {
- if (aChar == '\\') {
- outBuffer.append('\\'); outBuffer.append('\\');
- continue;
- }
- outBuffer.append(aChar);
- continue;
- }
- switch(aChar) {
- case ' ':
- if (x == 0 || escapeSpace)
- outBuffer.append('\\');
- outBuffer.append(' ');
- break;
- case '\t':outBuffer.append('\\'); outBuffer.append('t');
- break;
- case '\n':outBuffer.append('\\'); outBuffer.append('n');
- break;
- case '\r':outBuffer.append('\\'); outBuffer.append('r');
- break;
- case '\f':outBuffer.append('\\'); outBuffer.append('f');
- break;
- case '=': // Fall through
- case ':': // Fall through
- case '#': // Fall through
- case '!':
- outBuffer.append('\\'); outBuffer.append(aChar);
- break;
- default:
- if ((aChar < 0x0020) || (aChar > 0x007e)) {
- outBuffer.append('\\');
- outBuffer.append('u');
- outBuffer.append(toHex((aChar >> 12) & 0xF));
- outBuffer.append(toHex((aChar >> 8) & 0xF));
- outBuffer.append(toHex((aChar >> 4) & 0xF));
- outBuffer.append(toHex( aChar & 0xF));
- } else {
- outBuffer.append(aChar);
- }
- }
- }
- return outBuffer.toString();
- }
-
- public synchronized void store(OutputStream out, String comments)
- throws IOException
- {
- BufferedWriter awriter;
- awriter = new BufferedWriter(new OutputStreamWriter(out, encoding));
- if (comments != null)
- writeln(awriter, "#" + comments);
- writeln(awriter, "#" + new Date().toString());
- for (Enumeration e = keys(); e.hasMoreElements();) {
- String key = (String)e.nextElement();
- String val = (String)get(key);
- key = saveConvert(key, true);
-
- /* No need to escape embedded and trailing spaces for value, hence
- * pass false to flag.
- */
- val = saveConvert(val, false);
- writeln(awriter, key + "=" + val);
- }
- awriter.flush();
- }
-
- private static void writeln(BufferedWriter bw, String s) throws IOException {
- bw.write(s);
- bw.newLine();
- }
-
- /**
- * Convert a nibble to a hex character
- * @param nibble the nibble to convert.
- */
- private static char toHex(int nibble) {
- return hexDigit[(nibble & 0xF)];
- }
-
- /** A table of hex digits */
- private static final char[] hexDigit = {
- '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
- };
-
- public static void main(String[] args) {
- String ps = "p1:v1 \\\n hh \\\n gg\n\np2=v2\\u0034\\u0055";
- Properties_ p = new Properties_();
- ByteArrayInputStream s = new ByteArrayInputStream(ps.getBytes());
- try {
- p.load(s);
- } catch (IOException e) {
- e.printStackTrace();
- }
- p.list(System.out);
- }
-
-}
17 years, 5 months
JBoss Tools SVN: r11637 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-11-10 10:37:05 -0500 (Mon, 10 Nov 2008)
New Revision: 11637
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3127Test.java
Log:
junit for JBIDE-3127
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3127Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3127Test.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3127Test.java 2008-11-10 15:37:05 UTC (rev 11637)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ * Test case for JBIDE-3127
+ *
+ * @author mareshkau
+ *
+ */
+public class JBIDE3127Test extends VpeTest{
+
+ public JBIDE3127Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE3127() throws Exception {
+ setException(null);
+ IFile file = (IFile) TestUtil.getComponentPath("JBIDE/3127/jbide3127.xhtml", //$NON-NLS-1$
+ JsfAllTests.IMPORT_PROJECT_NAME);
+ IEditorInput input = new FileEditorInput(file);
+ JSPMultiPageEditor editor = openEditor(input);
+ int offcet = TestUtil.getLinePositionOffcet(editor.getSourceEditor().getTextViewer(), 13, 78);
+ editor.getSourceEditor().getTextViewer().setSelectedRange(offcet, 1);
+ VpeController vpeController = (VpeController)editor.getVisualEditor().getController();
+ assertTrue("VE sould be visible", vpeController.isVisualEditorVisible()); //$NON-NLS-1$
+ assertTrue("It's should be a div","DIV".equalsIgnoreCase(vpeController.getXulRunnerEditor().getLastSelectedNode().getNodeName())); //$NON-NLS-1$//$NON-NLS-2$
+ VpeEditorPart editorPart = ((VpeEditorPart)editor.getVisualEditor());
+ editorPart.maximizeSource();
+ assertFalse("Visual part shouldn't be visible",vpeController.isVisualEditorVisible()); //$NON-NLS-1$
+ //change source code
+ editor.getSourceEditor().getTextViewer().getTextWidget().replaceTextRange(offcet-10, "replaced text".length(), "replaced text"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("Synced should be false",vpeController.isSynced()); //$NON-NLS-1$
+ editorPart.maximizeVisual();
+ vpeController.visualRefresh();
+ if(getException()!=null) {
+ throw new Exception(getException());
+ }
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r11636 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127 and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-11-10 10:36:26 -0500 (Mon, 10 Nov 2008)
New Revision: 11636
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127/jbide3127.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
junit for JBIDE-3127
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127/jbide3127.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127/jbide3127.xhtml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3127/jbide3127.xhtml 2008-11-10 15:36:26 UTC (rev 11636)
@@ -0,0 +1,17 @@
+<!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:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <head>
+ <title>JBIDE 3127 Test</title>
+ </head>
+ <body>
+ <f:view>
+ <h1>JBIDE-3127 Junit Test</h1>
+ <h:form>
+ <div style="width: 100px; height: 100px;background-color: red;"></div>
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-11-10 14:19:29 UTC (rev 11635)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-11-10 15:36:26 UTC (rev 11636)
@@ -41,6 +41,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2828Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2979Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3030Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3127Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -107,6 +108,7 @@
suite.addTestSuite(JBIDE2828Test.class);
suite.addTestSuite(JBIDE3030Test.class);
suite.addTestSuite(JBIDE2979Test.class);
+ suite.addTestSuite(JBIDE3127Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-11-10 14:19:29 UTC (rev 11635)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-11-10 15:36:26 UTC (rev 11636)
@@ -481,7 +481,7 @@
public void notifyChanged(final INodeNotifier notifier,
final int eventType, final Object feature, final Object oldValue,
final Object newValue, final int pos) {
- if (!visualEditorVisible) {
+ if (!isVisualEditorVisible()) {
setSynced(false);
return;
}
@@ -1675,7 +1675,7 @@
public void visualRefresh() {
- if (!visualEditorVisible) {
+ if (!isVisualEditorVisible()) {
setSynced(false);
return;
}
17 years, 5 months
JBoss Tools SVN: r11635 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-10 09:19:29 -0500 (Mon, 10 Nov 2008)
New Revision: 11635
Added:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/ViewIdsTree.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages-wizards.meta
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
Log:
JBIDE-2286
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-11-10 13:13:25 UTC (rev 11634)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/plugin.xml 2008-11-10 14:19:29 UTC (rev 11635)
@@ -94,6 +94,8 @@
<xclass id="org.jboss.tools.seam.pages.xml.model.helpers.autolayout.SeamPagesItems"
class="org.jboss.tools.seam.pages.xml.model.helpers.autolayout.SeamPagesItems"/>
+ <xclass id="org.jboss.tools.seam.pages.xml.model.ViewIdsTree"
+ class="org.jboss.tools.seam.pages.xml.model.ViewIdsTree"/>
</extension>
<extension point="org.eclipse.wst.xml.core.catalogContributions">
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages-wizards.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages-wizards.meta 2008-11-10 13:13:25 UTC (rev 11634)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages-wizards.meta 2008-11-10 14:19:29 UTC (rev 11635)
@@ -80,8 +80,9 @@
</XModelAttribute>
<XModelAttribute PROPERTIES="category=general" name="view id" xmlname="view-id">
<Constraint loader="Tree">
- <value name="JSFPageTree"/>
+ <value name="SeamViewIdTree"/>
<value name="extensions=jsp,html,htm,xhtml,xml"/>
+ <value name="hideRoot=true"/>
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-11-10 13:13:25 UTC (rev 11634)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/resources/meta/seam-pages.meta 2008-11-10 14:19:29 UTC (rev 11635)
@@ -15,7 +15,9 @@
<MAPPING name="FilteredTreeConstraints">
<PAIR name="FileSystems$144" value="org.jboss.tools.seam.pages.xml.model.impl.SeamPagesFilteredTreeConstraint"/>
</MAPPING>
- <MAPPING name="FilteredTrees"/>
+ <MAPPING name="FilteredTrees">
+ <PAIR name="SeamViewIdTree" value="org.jboss.tools.seam.pages.xml.model.ViewIdsTree"/>
+ </MAPPING>
<MAPPING name="Handlers"/>
<MAPPING name="Implementations">
<PAIR name="SeamPageTask" value="org.jboss.tools.seam.pages.xml.model.impl.SeamPageTaskImpl"/>
@@ -3170,9 +3172,10 @@
<XModelAttribute PROPERTIES="id=true" default="target" name="name" visibility="false"/>
<XModelAttribute PROPERTIES="category=general" name="view id" xmlname="view-id">
<Constraint loader="Tree">
- <value name="JSFPageTree"/>
+ <value name="SeamViewIdTree"/>
<value name="extensions=jsp,html,htm,xhtml,xml"/>
<value name="linkAction=OpenPage"/>
+ <value name="hideRoot=true"/>
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
@@ -3253,9 +3256,10 @@
<XModelAttribute PROPERTIES="id=true" default="target" name="name" visibility="false"/>
<XModelAttribute PROPERTIES="category=general" name="view id" xmlname="view-id">
<Constraint loader="Tree">
- <value name="JSFPageTree"/>
+ <value name="SeamViewIdTree"/>
<value name="extensions=jsp,html,htm,xhtml,xml"/>
<value name="linkAction=OpenPage"/>
+ <value name="hideRoot=true"/>
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
@@ -3336,9 +3340,10 @@
<XModelAttribute PROPERTIES="id=true" default="target" name="name" visibility="false"/>
<XModelAttribute PROPERTIES="category=general" name="view id" xmlname="view-id">
<Constraint loader="Tree">
- <value name="JSFPageTree"/>
+ <value name="SeamViewIdTree"/>
<value name="extensions=jsp,html,htm,xhtml,xml"/>
<value name="linkAction=OpenPage"/>
+ <value name="hideRoot=true"/>
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
@@ -3409,9 +3414,10 @@
<XModelAttribute PROPERTIES="id=true" default="target" name="name" visibility="false"/>
<XModelAttribute PROPERTIES="category=general" name="view id" xmlname="view-id">
<Constraint loader="Tree">
- <value name="JSFPageTree"/>
+ <value name="SeamViewIdTree"/>
<value name="extensions=jsp,html,htm,xhtml,xml"/>
<value name="linkAction=OpenPage"/>
+ <value name="hideRoot=true"/>
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
Added: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/ViewIdsTree.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/ViewIdsTree.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/ViewIdsTree.java 2008-11-10 14:19:29 UTC (rev 11635)
@@ -0,0 +1,81 @@
+package org.jboss.tools.seam.pages.xml.model;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
+import org.jboss.tools.jst.web.model.tree.WebPagesTree;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
+
+public class ViewIdsTree extends WebPagesTree {
+ Map<String, XModelObject> pageMap;
+ XModelObject root;
+ XModelObject webRoot;
+ XModelObject pages;
+
+ public void setConstraint(Object object) {
+ super.setConstraint(object);
+
+ Object[] os = (Object[])object;
+ XModelObject c = (XModelObject)os[1];
+
+ root = FileSystemsHelper.getFileSystems(c.getModel());
+ webRoot = FileSystemsHelper.getWebRoot(c.getModel());
+
+ XModelObject f = SeamPagesDiagramStructureHelper.getInstance().getParentFile(c);
+ pages = f.getChildByPath("Pages");
+ XModelObject[] ps = pages.getChildren();
+
+ pageMap = new TreeMap<String, XModelObject>();
+
+ for (int i = 0; i < ps.length; i++) {
+ String viewId = ps[i].getAttributeValue(SeamPagesConstants.ATTR_VIEW_ID);
+ if(viewId == null || viewId.length() == 0 || viewId.indexOf('*') >= 0) continue;
+ pageMap.put(viewId, ps[i]);
+ }
+ }
+
+ public XModelObject getRoot() {
+ return root;
+ }
+
+ public XModelObject[] getChildren(XModelObject object) {
+ if(object == root) return new XModelObject[]{webRoot, pages};
+ if(object == pages) return pageMap.values().toArray(new XModelObject[0]);
+ return super.getChildren(object);
+ }
+
+ public String getValue(XModelObject object) {
+ if(isLocalPage(object)) {
+ return object.getAttributeValue(SeamPagesConstants.ATTR_VIEW_ID);
+ }
+ return super.getValue(object);
+ }
+
+ public XModelObject find(String value) {
+ if(value != null && pageMap.containsKey(value)) {
+ return pageMap.get(value);
+ }
+ return super.find(value);
+ }
+
+ public boolean isSelectable(XModelObject object) {
+ if(isLocalPage(object)) {
+ return true;
+ }
+ return super.isSelectable(object);
+ }
+
+ public boolean hasChildren(XModelObject object) {
+ if(isLocalPage(object)) {
+ return false;
+ }
+ return super.hasChildren(object);
+ }
+
+ private boolean isLocalPage(XModelObject object) {
+ return (object != null && object.getParent() == pages);
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r11634 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-11-10 08:13:25 -0500 (Mon, 10 Nov 2008)
New Revision: 11634
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
Log:
JBIDE-2337 adjustment, JBIDE-3127
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-11-10 12:46:00 UTC (rev 11633)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-11-10 13:13:25 UTC (rev 11634)
@@ -481,12 +481,10 @@
public void notifyChanged(final INodeNotifier notifier,
final int eventType, final Object feature, final Object oldValue,
final Object newValue, final int pos) {
-
if (!visualEditorVisible) {
- synced = false;
+ setSynced(false);
return;
}
-
// start job when we modify file in ui thread, without this code
// changes will be applied with 1 second delay
Display display = null;
@@ -1676,8 +1674,9 @@
}
public void visualRefresh() {
+
if (!visualEditorVisible) {
- synced = false;
+ setSynced(false);
return;
}
if (uiJob != null && uiJob.getState() != Job.NONE) {
@@ -1703,7 +1702,7 @@
IProgressMonitor.UNKNOWN);
visualRefreshImpl();
monitor.done();
- synced=true;
+ setSynced(true);
} catch (VpeDisposeException exc) {
// just ignore this exception
} catch (NullPointerException ex) {
@@ -3239,19 +3238,6 @@
this.synced = synced;
}
- public void rebuildDom() {
- if (visualBuilder == null)
- return;
- IDOMModel sourceModel = (IDOMModel) getModel();
- if (sourceModel != null) {
- IDOMDocument sourceDocument = sourceModel.getDocument();
- visualBuilder.rebuildDom(sourceDocument);
- } else {
- visualBuilder.rebuildDom(null);
- }
- synced = true;
- }
-
/**
* @return the progressMonitor
*/
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-11-10 12:46:00 UTC (rev 11633)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-11-10 13:13:25 UTC (rev 11634)
@@ -548,7 +548,7 @@
&& !controller.isVisualEditorVisible()) {
controller.setVisualEditorVisible(true);
if (!controller.isSynced())
- controller.rebuildDom();
+ controller.visualRefresh();
}
}
}
@@ -772,12 +772,14 @@
}
}
+ @Override
public void setFocus() {
if (activeEditor != null) {
activeEditor.setFocus();
}
}
+ @Override
public void dispose() {
if (optionsObject != null) {
optionsObject.getModel().removeModelTreeListener(listener);
@@ -881,6 +883,7 @@
public void partOpened(IWorkbenchPart part) {
}
+ @Override
public void shellActivated(ShellEvent e) {
e.widget.getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -898,9 +901,8 @@
try {
if (sourceEditor != null) {
if (visualEditor != null)
- //added by estherbin
//fix http://jira.jboss.com/jira/browse/JBIDE-2337
- if ((visualEditor.getController() != null) && !container.isHidden()) {
+ if ((visualEditor.getController() != null) && (visualEditor.getController().isVisualEditorVisible())) {
visualEditor.getController().refreshTemplates();
}
sourceEditor.safelySanityCheckState(getEditorInput());
@@ -916,7 +918,7 @@
IContextService contextService = (IContextService) workbench
.getAdapter(IContextService.class);
fContextActivation = contextService
- .activateContext(VPE_EDITOR_CONTEXT); //$NON-NLS-1$
+ .activateContext(VPE_EDITOR_CONTEXT);
IHandlerService handlerService = (IHandlerService) workbench
.getService(IHandlerService.class);
if (handlerService != null) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-11-10 12:46:00 UTC (rev 11633)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-11-10 13:13:25 UTC (rev 11634)
@@ -45,13 +45,7 @@
public static final String copyright = "(c) Copyright IBM Corporation 2002."; //$NON-NLS-1$
- //added by estherbin
- //fix http://jira.jboss.com/jira/browse/JBIDE-2337
/**
- * Determine is hidden or not.
- */
- private boolean isHidden = false;
- /**
* Custom style bits. They set whether max to one side of the other
* is not permitted. For example, if NO_MAX_UP, then there will be only
* one arrow. When not maxed, it will point down (and will do a max down),
@@ -229,6 +223,7 @@
/**
* @see org.eclipse.swt.widgets.Composite#layout(boolean)
*/
+ @Override
public void layout(boolean changed) {
super.layout(changed);
@@ -375,6 +370,7 @@
/**
* @see org.eclipse.swt.events.MouseTrackAdapter#mouseExit(MouseEvent)
*/
+ @Override
public void mouseExit(MouseEvent e) {
if (currentSashInfo.cursorOver != NO_ARROW) {
// Undo the cursor.
@@ -391,6 +387,7 @@
/**
* @see org.eclipse.swt.events.MouseAdapter#mouseDown(MouseEvent)
*/
+ @Override
public void mouseDown(MouseEvent e) {
inMouseClick = true;
// If we're within a button, then redraw to wipe out stipple and get button push effect.
@@ -412,6 +409,7 @@
/**
* @see org.eclipse.swt.events.MouseListener#mouseDown(MouseEvent)
*/
+ @Override
public void mouseUp(MouseEvent e) {
// See if within one of the arrows.
inMouseClick = false; // No longer in down click
@@ -511,9 +509,7 @@
drawArrows[1] = DOWN_ARROW;
currentSashInfo.sashBorderLeft = false;
currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- //added by estherbin
- //fix http://jira.jboss.com/jira/browse/JBIDE-2337
- this.isHidden = true;
+
} else if (weights[1] == 0 || (currentSashInfo.weight != NO_WEIGHT && sashBounds.y+sashBounds.height >= clientArea.height-DRAG_MINIMUM)) {
// Slammed to the bottom
addArrows[0] = UP_ARROW;
@@ -522,9 +518,6 @@
drawArrows[1] = UP_MAX_ARROW;
currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
currentSashInfo.sashBorderRight = false;
- //added by estherbin
- //fix http://jira.jboss.com/jira/browse/JBIDE-2337
- this.isHidden = true;
} else {
// Not slammed
addArrows[0] = UP_MAX_ARROW;
@@ -534,9 +527,6 @@
currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
- //added by estherbin
- //fix http://jira.jboss.com/jira/browse/JBIDE-2337
- this.isHidden=false;
}
}
getNewSashArray(currentSashInfo, addArrows, drawArrows);
@@ -666,17 +656,6 @@
y+=tSize;
}
}
- //added by estherbin
- //fix http://jira.jboss.com/jira/browse/JBIDE-2337
- /**
- * Determine is hidden or not.
- * @return <code>true</code> if hidden otherwise <code>false</code>
- */
-
- public boolean isHidden(){
- return this.isHidden;
- }
-
protected void drawSashBorder(GC gc, Sash sash, boolean leftBorder) {
gc.setForeground(borderColor);
if (getOrientation() == SWT.VERTICAL) {
17 years, 5 months
JBoss Tools SVN: r11633 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-11-10 07:46:00 -0500 (Mon, 10 Nov 2008)
New Revision: 11633
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3052
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2008-11-10 12:43:26 UTC (rev 11632)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2008-11-10 12:46:00 UTC (rev 11633)
@@ -87,6 +87,7 @@
protected void dialogChanged() {
setErrorMessage(null);
+ setMessage(null);
String msg = PathHelper.checkDirectory(getOutputDir(), HibernateConsoleMessages.CodeGenerationSettingsTab_output_directory, false);
if (msg!=null) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2008-11-10 12:43:26 UTC (rev 11632)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2008-11-10 12:46:00 UTC (rev 11633)
@@ -93,6 +93,7 @@
protected void dialogChanged() {
setErrorMessage(null);
+ setMessage(null);
/*validate package name*/
String packName= getPackageName();
if (packName.length() > 0) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-11-10 12:43:26 UTC (rev 11632)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-11-10 12:46:00 UTC (rev 11633)
@@ -63,7 +63,7 @@
*/
public abstract class GenerateInitWizardPage extends WizardPage {
- private static final String AUTODETECT = "[Autodetect]";
+ private static final String AUTODETECT = "[Autodetect]"; //$NON-NLS-1$
private DriverClassHelpers helper = new DriverClassHelpers();
@@ -107,12 +107,6 @@
createChildControls(container);
- dialectName = new ComboDialogField(SWT.NONE);
- dialectName.setLabelText(HibernateConsoleMessages.NewConfigurationWizardPage_database_dialect);
- dialectName.setItems(getDialectNames());
- dialectName.selectItem(0);
- dialectName.doFillIntoGrid(container, numColumns);
-
selectMethod = new Button(container, SWT.CHECK);
selectMethod.setText("Use Console Configuration");
selectMethod.setSelection(true);
@@ -127,6 +121,7 @@
consoleConfigurationName.setEnabled(selectMethod.getSelection());
connectionProfileName.setEnabled(!selectMethod.getSelection());
schemaName.setEnabled(!selectMethod.getSelection());
+ dialectName.setEnabled(!selectMethod.getSelection());
dialogChanged();
}});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -185,7 +180,15 @@
}
connectionProfileName.doFillIntoGrid(dbGroup, numColumns);
connectionProfileName.setDialogFieldListener(fieldlistener);
- connectionProfileName.setEnabled(!selectMethod.getSelection());
+ connectionProfileName.setEnabled(!selectMethod.getSelection());
+ //****************************dialect*****************
+ dialectName = new ComboDialogField(SWT.NONE);
+ dialectName.setLabelText(HibernateConsoleMessages.NewConfigurationWizardPage_database_dialect);
+ dialectName.setItems(getDialectNames());
+ dialectName.selectItem(0);
+ dialectName.doFillIntoGrid(dbGroup, numColumns);
+ dialectName.setEnabled(false);
+ dialectName.setDialogFieldListener(fieldlistener);
//****************************schema*****************
schemaName = new StringButtonDialogField(new IStringButtonAdapter(){
public void changeControlPressed(DialogField field) {
@@ -214,6 +217,10 @@
return;
}
+ if (selectMethod.getSelection()){ // TODO: can't check that dialect set
+ setWarningMessage("Impossible to check that hibernate dialect is set.");
+ }
+
setPageComplete(true);
}
@@ -323,8 +330,10 @@
}
private String determineDialect() {
- if (!AUTODETECT.equals(dialectName.getText()))
- return helper.getDialectClass(dialectName.getText());
+ if (!AUTODETECT.equals(dialectName.getText())){
+ String dialect = helper.getDialectClass(dialectName.getText());
+ return dialect != null ? dialect : dialectName.getText();
+ }
if (!selectMethod.getSelection()){
IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(getConnectionProfileName());
String driver = profile.getProperties(profile.getProviderId()).getProperty("org.eclipse.datatools.connectivity.db.driverClass");
17 years, 5 months
JBoss Tools SVN: r11632 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner and 4 other directories.
by jbosstools-commits@lists.jboss.org
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$
+}
17 years, 5 months
JBoss Tools SVN: r11631 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-11-10 06:09:06 -0500 (Mon, 10 Nov 2008)
New Revision: 11631
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableChildrenEncoder.java
Log:
CODING IN PROGRESS - issue JBIDE-2984: Wrap <rich:*Table> in <tbody>
https://jira.jboss.org/jira/browse/JBIDE-2984
The class RichFacesDataTableChildrenEncoder has been documented.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableChildrenEncoder.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableChildrenEncoder.java 2008-11-10 10:42:07 UTC (rev 11630)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableChildrenEncoder.java 2008-11-10 11:09:06 UTC (rev 11631)
@@ -18,6 +18,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -26,61 +27,109 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-/**@author yradtsevich */
+/**
+ * The class {@code RichFacesDataTableChildrenEncoder} encodes children of a {@code rich:*Table}.
+ *
+ * <BR/>Use this class as follows:
+ * <blockquote><pre>
+ * RichFacesDataTableChildrenEncoder encoder
+ * = new RichFacesDataTableChildrenEncoder(
+ * creationData, visualDocument, sourceElement, table);
+ * encoder.encodeChildren();</pre></blockquote>
+ *
+ * Method {@link #validateChildren(VpePageContext, Node, nsIDOMDocument, VpeCreationData) validateChildren}
+ * MUST be invoked from {@link VpeTemplate#validate(VpePageContext, Node, nsIDOMDocument, VpeCreationData) validate}
+ * method of the caller of this class:
+ * <blockquote><pre>
+ * public void validate(VpePageContext pageContext, Node sourceNode,
+ * nsIDOMDocument visualDocument, VpeCreationData data) {
+ * RichFacesDataTableChildrenEncoder.validateChildren(
+ * pageContext, sourceNode, visualDocument, data);
+ * ...
+ * }</pre></blockquote>
+ *
+ * @author yradtsevich
+ * */
class RichFacesDataTableChildrenEncoder {
+ /**Non-HTML tag that is used to create temporary containers for {@code rich:subTable} and {@code rich:columnGroup}.*/
private static final String TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER = "subTableOrColumnGroup-container"; //$NON-NLS-1$
- private VpeCreationData creationData;
- private nsIDOMDocument visualDocument;
- private Element sourceElement;
- private nsIDOMElement table;
+ private final VpeCreationData creationData;
+ private final nsIDOMDocument visualDocument;
+ private final Element sourceElement;
+ private final nsIDOMElement table;
- public RichFacesDataTableChildrenEncoder(VpeCreationData creationData,
- nsIDOMDocument visualDocument, Element sourceElement,
- nsIDOMElement table) {
+ public RichFacesDataTableChildrenEncoder(final VpeCreationData creationData,
+ final nsIDOMDocument visualDocument, final Element sourceElement,
+ final nsIDOMElement table) {
this.creationData = creationData;
this.visualDocument = visualDocument;
this.sourceElement = sourceElement;
this.table = table;
}
+ /**
+ * Creates containers in {@code table} for {@code sourceElement}'s children
+ * and adds appropriate objects of {@link VpeChildrenInfo} to {@code creationData}.
+ *
+ * <BR/>It knows about following tags:
+ * {@code rich:column, rich:columns, rich:subTable} and {@code rich:columnGroup}.
+ * <BR/>For any another tag it uses {@link #addElementToTable(Node)} method.
+ * */
public void encodeChildren() {
- // Create mapping to Encode body
- List<Node> children = ComponentUtil.getChildren(sourceElement);
+ final List<Node> children = ComponentUtil.getChildren(sourceElement);
boolean createNewRow = true;
- for (Node child : children) {
- String nodeName = child.getNodeName();
- if (nodeName.endsWith(RichFaces.TAG_COLUMN) ||
+ for (final Node child : children) {
+ final String nodeName = child.getNodeName();
+ if (nodeName.endsWith(RichFaces.TAG_COLUMN) ||
nodeName.endsWith(RichFaces.TAG_COLUMNS)) {
- createNewRow |= RichFacesColumnTemplate.isBreakBefore(child);
+ createNewRow |= RichFacesColumnTemplate.isBreakBefore(child);
addColumnToRow(child, createNewRow);
createNewRow = false;
- } else if(nodeName.endsWith(RichFaces.TAG_SUB_TABLE)
+ } else if(nodeName.endsWith(RichFaces.TAG_SUB_TABLE)
|| nodeName.endsWith(RichFaces.TAG_COLUMN_GROUP)) {
addSubTableOrColumnGroupToTable(child);
createNewRow = true;
} else {
- VpeChildrenInfo childInfo = new VpeChildrenInfo(table);
- childInfo.addSourceChild(child);
- creationData.addChildrenInfo(childInfo);
+ addElementToTable(child);
createNewRow = true;
}
}
}
- private nsIDOMElement addSubTableOrColumnGroupToTable(Node subTableOrColumnGroupNode) {
- nsIDOMElement subTableOrColumnGroupContainer = visualDocument.createElement(TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER);
+ /**
+ * Makes necessary changes in the table's body after all children of the table have been encoded.
+ * */
+ public static void validateChildren(final VpePageContext pageContext, final Node sourceNode,
+ final nsIDOMDocument visualDocument, final VpeCreationData creationData) {
+ final nsIDOMNode visualNode = creationData.getNode();
+ fixSubTables(visualNode);
+ }
+
+ /**
+ * Creates a container for {@code subTableOrColumnGroupNode} in {@code table}
+ * and adds an appropriate object of {@link VpeChildrenInfo} to {@code creationData}.
+ * <BR/>The container is the tag {@link #TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER}.
+ * */
+ private nsIDOMElement addSubTableOrColumnGroupToTable(final Node subTableOrColumnGroupNode) {
+ final nsIDOMElement subTableOrColumnGroupContainer = visualDocument.createElement(TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER);
table.appendChild(subTableOrColumnGroupContainer);
- VpeChildrenInfo childInfo = new VpeChildrenInfo(subTableOrColumnGroupContainer);
+ final VpeChildrenInfo childInfo = new VpeChildrenInfo(subTableOrColumnGroupContainer);
childInfo.addSourceChild(subTableOrColumnGroupNode);
creationData.addChildrenInfo(childInfo);
-
+
return subTableOrColumnGroupContainer;
}
private nsIDOMElement currentRow = null;
private VpeChildrenInfo currentRowChildrenInfo = null;
private int rowNumber = 0;
- private nsIDOMElement addColumnToRow(Node columnNode, boolean createNewRow) {
+ /**
+ * Creates a container for {@code columnNode} in {@code table}
+ * and adds an appropriate object of {@link VpeChildrenInfo} to {@code creationData}.
+ * <BR/>If the parameter {@code createNewRow} is {@code true} then it creates the
+ * container in a new row.
+ * */
+ private nsIDOMElement addColumnToRow(final Node columnNode, final boolean createNewRow) {
if ( createNewRow || (currentRow == null) ) {
currentRow = visualDocument.createElement(HTML.TAG_TR);
table.appendChild(currentRow);
@@ -98,30 +147,46 @@
return currentRow;
}
- public static void validateChildren(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, VpeCreationData creationData) {
- nsIDOMNode visualNode = creationData.getNode();
- fixSubTables(visualNode);
+ /**
+ * Creates a row container for {@code node} in {@code table}
+ * and adds an appropriate object of {@link VpeChildrenInfo} to {@code creationData}.
+ * <BR/>The container spans the entire row.
+ * */
+ private void addElementToTable(final Node node) {
+ final nsIDOMElement tr = this.visualDocument.createElement(HTML.TAG_TR);
+ table.appendChild(tr);
+ final nsIDOMElement td = this.visualDocument.createElement(HTML.TAG_TD);
+ // COLSPAN="0" means the cell spans the entire row
+ td.setAttribute(HTML.ATTR_COLSPAN, "0"); //NON-NLS$1
+ tr.appendChild(td);
+ final VpeChildrenInfo childInfo = new VpeChildrenInfo(td);
+ childInfo.addSourceChild(node);
+ creationData.addChildrenInfo(childInfo);
}
- private static void fixSubTables(nsIDOMNode node) {
- nsIDOMElement element = (nsIDOMElement) node;
- nsIDOMNodeList subTableContainers = element.getElementsByTagName(TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER);
- long length = subTableContainers.getLength();
+ /**
+ * Replaces all occurencies of {@link #TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER} tag in
+ * the {@code visualNode} by the tag's child.
+ * @see #addSubTableOrColumnGroupToTable(Node)
+ * */
+ private static void fixSubTables(final nsIDOMNode visualNode) {
+ final nsIDOMElement element = (nsIDOMElement) visualNode;
+ final nsIDOMNodeList subTableContainers = element.getElementsByTagName(TAG_SUB_TABLE_OR_COLUMN_GROUP_CONTAINER);
+ final long length = subTableContainers.getLength();
for (int i = 0; i < length; i++) {
- nsIDOMNode subTableContainer = subTableContainers.item(0);
- nsIDOMNodeList subTableContainerChildren = subTableContainer.getChildNodes();
- nsIDOMNode containerParent = subTableContainer.getParentNode();
- if (subTableContainerChildren != null
+ final nsIDOMNode subTableContainer = subTableContainers.item(0);
+ final nsIDOMNodeList subTableContainerChildren = subTableContainer.getChildNodes();
+ final nsIDOMNode containerParent = subTableContainer.getParentNode();
+ if (subTableContainerChildren != null
&& subTableContainerChildren.getLength() == 1) {
- nsIDOMNode subTableMainTag = subTableContainerChildren.item(0);
+ final nsIDOMNode subTableMainTag = subTableContainerChildren.item(0);
subTableContainer.removeChild(subTableMainTag);
containerParent.insertBefore(subTableMainTag, subTableContainer);
} else {
- RuntimeException e = new RuntimeException("This is probably a bug. subTable-container should have one inner tag.");//$NON-NLS-1$
+ final RuntimeException e = new RuntimeException("This is probably a bug. subTable-container should have one inner tag.");//$NON-NLS-1$
RichFacesTemplatesActivator.getPluginLog().logError(e);
}
containerParent.removeChild(subTableContainer);
- }
+ }
}
}
17 years, 5 months
JBoss Tools SVN: r11630 - trunk/ws/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-11-10 05:42:07 -0500 (Mon, 10 Nov 2008)
New Revision: 11630
Modified:
trunk/ws/docs/reference/en/modules/preference.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-447 - adding the concluding part;
Modified: trunk/ws/docs/reference/en/modules/preference.xml
===================================================================
--- trunk/ws/docs/reference/en/modules/preference.xml 2008-11-10 09:31:13 UTC (rev 11629)
+++ trunk/ws/docs/reference/en/modules/preference.xml 2008-11-10 10:42:07 UTC (rev 11630)
@@ -1,49 +1,71 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<chapter id="preference" revisionflag="added">
-<title>JBoss WS and development environment</title>
- <section id="jbosswspreference">
- <title>JBossWS Preferences</title>
+ <title>JBoss WS and development environment</title>
+ <section id="jbosswspreference">
+ <title>JBossWS Preferences</title>
-<para>In this section you will know how JBossWS preferences can be modified during the development process.</para>
+ <para>In this section you will know how JBossWS preferences can be modified during the
+ development process.</para>
- <para>JBossWS preferences can be set on the JBossWS preference page. Click on <emphasis><property>Window > Preferences > JBoss Tools > Web > JBossWS Preferences</property>.</emphasis></para>
-
- <para>On this page you can manage the JBossWS Runtime. Use the appropriate buttons to <property>Add</property> more runtimes or to <property>Remove</property> those that are not needed.</para>
-
- <figure>
- <title>JBossWS Preferences Page</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/Jbossws_preference.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Clicking on <emphasis><property>Add</property></emphasis> or <emphasis><property>Edit</property></emphasis> button will open the form where you can configure a new JbossWS runtime and change the path to JBossWS runtime home folder,
- modify the name and version of the existing JBossWS runtime settings. Press <property>Finish</property> to apply the changes.</para>
-
- <figure>
- <title>Edit JBossWS Runtime</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/Jbossws_preference_new.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="serverruntime">
- <title>Default Server and Runtime</title>
- <para>Open
- <emphasis><property>Window > Preferences > Web Services > Server and Runtime</property></emphasis>. On this page, you can specify a default server and runtime.</para>
- <para>For ease of use, the better way is to set runtime to JBoss WS.</para>
- <para>After server and runtime are specified, click on the <property>Aply</property> button to save the values.</para>
- <figure>
- <title></title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/jbossws_server_runtime.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
+ <para>JBossWS preferences can be set on the JBossWS preference page. Click on
+ <emphasis><property>Window > Preferences > JBoss Tools > Web > JBossWS
+ Preferences</property>.</emphasis></para>
+
+ <para>On this page you can manage the JBossWS Runtime. Use the appropriate buttons to
+ <property>Add</property> more runtimes or to <property>Remove</property> those that
+ are not needed.</para>
+
+ <figure>
+ <title>JBossWS Preferences Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/Jbossws_preference.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Clicking on <emphasis>
+ <property>Add</property>
+ </emphasis> or <emphasis>
+ <property>Edit</property>
+ </emphasis> button will open the form where you can configure a new JbossWS runtime and
+ change the path to JBossWS runtime home folder, modify the name and version of the
+ existing JBossWS runtime settings. Press <property>Finish</property> to apply the
+ changes.</para>
+
+ <figure>
+ <title>Edit JBossWS Runtime</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/Jbossws_preference_new.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="serverruntime">
+ <title>Default Server and Runtime</title>
+ <para>Open <emphasis>
+ <property>Window > Preferences > Web Services > Server and Runtime</property>
+ </emphasis>. On this page, you can specify a default server and runtime.</para>
+ <para>For ease of use, the better way is to set runtime to JBoss WS.</para>
+ <para>After server and runtime are specified, click on the <property>Aply</property> button
+ to save the values.</para>
+ <figure>
+ <title/>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/jbossws_server_runtime.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>On the whole, this guide covers the fundamental concepts of work with tooling for
+ <property>JBossWS</property>. It describes how to easily create a Web Service and a Web Service Client using
+ JBossWS Runtime and adjust JBossWS and development environment as well.</para>
+
+ <para>If the information on JBossWS tools in this guide isn't enough for you, ask
+ questions on our <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=201"
+ >forum</ulink>. Your comments and suggestions are also welcome.</para>
+ </section>
</chapter>
17 years, 5 months