Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 188763 Details for
Bug 336813
XslFoDocumentBuilder should apply table attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to support table row and cell attributes in XslFoDocumentBuilder
Bug_336813.diff (text/plain), 7.89 KB, created by
Torkild Resheim
on 2011-02-11 06:31:54 EST
(
hide
)
Description:
Patch to support table row and cell attributes in XslFoDocumentBuilder
Filename:
MIME Type:
Creator:
Torkild Resheim
Created:
2011-02-11 06:31:54 EST
Size:
7.89 KB
patch
obsolete
>diff --git a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableCellAttributes.java b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableCellAttributes.java >index 6032ce9..5646975 100644 >--- a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableCellAttributes.java >+++ b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableCellAttributes.java >@@ -7,6 +7,7 @@ > * > * Contributors: > * David Green - initial API and implementation >+ * Torkild U. Resheim - Added border attribute, bug 336813 > *******************************************************************************/ > package org.eclipse.mylyn.wikitext.core.parser; > >@@ -17,6 +18,7 @@ import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType; > * {@link BlockType#TABLE_CELL_NORMAL}. > * > * @author David Green >+ * @author Torkild U. Resheim, MARINTEK > * @since 1.0 > */ > public class TableCellAttributes extends Attributes { >@@ -30,6 +32,8 @@ public class TableCellAttributes extends Attributes { > > private String colspan; > >+ private String border; >+ > public String getBgcolor() { > return bgcolor; > } >@@ -70,4 +74,12 @@ public class TableCellAttributes extends Attributes { > this.colspan = colspan; > } > >+ public void setBorder(String border) { >+ this.border = border; >+ } >+ >+ public String getBorder() { >+ return border; >+ } >+ > } >diff --git a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableRowAttributes.java b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableRowAttributes.java >index 6125743..87a2667 100644 >--- a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableRowAttributes.java >+++ b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/TableRowAttributes.java >@@ -7,6 +7,7 @@ > * > * Contributors: > * David Green - initial API and implementation >+ * Torkild U. Resheim - Added border attribute, bug 336813 > *******************************************************************************/ > package org.eclipse.mylyn.wikitext.core.parser; > >@@ -16,15 +17,19 @@ import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType; > * Attributes that may used when creating blocks of type {@link BlockType#TABLE_ROW}. > * > * @author David Green >+ * @author Torkild U. Resheim, MARINTEK > * @since 1.0 > */ > public class TableRowAttributes extends Attributes { >+ > private String bgcolor; > > private String align; > > private String valign; > >+ private String border; >+ > public String getBgcolor() { > return bgcolor; > } >@@ -49,4 +54,12 @@ public class TableRowAttributes extends Attributes { > this.valign = valign; > } > >+ public void setBorder(String border) { >+ this.border = border; >+ } >+ >+ public String getBorder() { >+ return border; >+ } >+ > } >diff --git a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/builder/XslfoDocumentBuilder.java b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/builder/XslfoDocumentBuilder.java >index bd5fa51..bc637f2 100644 >--- a/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/builder/XslfoDocumentBuilder.java >+++ b/org.eclipse.mylyn.wikitext.core/src/org/eclipse/mylyn/wikitext/core/parser/builder/XslfoDocumentBuilder.java >@@ -7,6 +7,7 @@ > * > * Contributors: > * David Green - initial API and implementation >+ * Torkild U. Resheim - Added table attributes, bug 336813 > *******************************************************************************/ > > package org.eclipse.mylyn.wikitext.core.parser.builder; >@@ -27,6 +28,8 @@ import org.eclipse.mylyn.wikitext.core.parser.Attributes; > import org.eclipse.mylyn.wikitext.core.parser.ImageAttributes; > import org.eclipse.mylyn.wikitext.core.parser.ListAttributes; > import org.eclipse.mylyn.wikitext.core.parser.TableAttributes; >+import org.eclipse.mylyn.wikitext.core.parser.TableCellAttributes; >+import org.eclipse.mylyn.wikitext.core.parser.TableRowAttributes; > import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter; > > /** >@@ -37,6 +40,7 @@ import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter; > * @see <a href="http://en.wikipedia.org/wiki/XSL_Formatting_Objects">XSL-FO (WikiPedia)</a> > * @see <a href="http://www.w3schools.com/xslfo/default.asp">XSL-FO Tutorial</a> > * @author David Green >+ * @author Torkild U. Resheim > * @since 1.1 > */ > public class XslfoDocumentBuilder extends AbstractXmlDocumentBuilder { >@@ -337,6 +341,7 @@ public class XslfoDocumentBuilder extends AbstractXmlDocumentBuilder { > case TABLE_CELL_HEADER: > case TABLE_CELL_NORMAL: > writer.writeStartElement(foNamespaceUri, "table-cell"); //$NON-NLS-1$ >+ applyTableCellAttributes(attributes); > writer.writeAttribute("padding-left", "2pt"); //$NON-NLS-1$ //$NON-NLS-2$ > writer.writeAttribute("padding-right", "2pt"); //$NON-NLS-1$ //$NON-NLS-2$ > writer.writeAttribute("padding-top", "2pt"); //$NON-NLS-1$ //$NON-NLS-2$ >@@ -349,6 +354,7 @@ public class XslfoDocumentBuilder extends AbstractXmlDocumentBuilder { > break; > case TABLE_ROW: > writer.writeStartElement(foNamespaceUri, "table-row"); //$NON-NLS-1$ >+ applyTableRowAttributes(attributes); > break; > default: > throw new IllegalStateException(type.name()); >@@ -402,6 +408,70 @@ public class XslfoDocumentBuilder extends AbstractXmlDocumentBuilder { > } > } > >+ private void applyTableCellAttributes(Attributes attributes) { >+ if (attributes instanceof TableCellAttributes) { >+ TableCellAttributes cellAttributes = (TableCellAttributes) attributes; >+ if (cellAttributes.getBgcolor() != null) { >+ writer.writeAttribute(CSS_RULE_BACKGROUND_COLOR, cellAttributes.getBgcolor()); >+ } >+ if (cellAttributes.getColspan() != null) { >+ writer.writeAttribute("number-columns-spanned", cellAttributes.getColspan()); //$NON-NLS-1$ >+ } >+ if (cellAttributes.getColspan() != null) { >+ writer.writeAttribute("number-rows-spanned", cellAttributes.getRowspan()); //$NON-NLS-1$ >+ } >+ if (cellAttributes.getBorder() != null) { >+ writer.writeAttribute("border", cellAttributes.getBorder()); //$NON-NLS-1$ >+ } >+ // Expecting values left, right or center >+ if (cellAttributes.getAlign() != null) { >+ writer.writeAttribute("text-align", cellAttributes.getAlign()); //$NON-NLS-1$ >+ } >+ if (cellAttributes.getValign() != null) { >+ String value = cellAttributes.getAlign(); >+ if (cellAttributes.getValign().equals("top")) { //$NON-NLS-1$ >+ value = "before"; //$NON-NLS-1$ >+ } >+ if (cellAttributes.getValign().equals("middle")) { //$NON-NLS-1$ >+ value = "center"; //$NON-NLS-1$ >+ } >+ if (cellAttributes.getValign().equals("bottom")) { //$NON-NLS-1$ >+ value = "after"; //$NON-NLS-1$ >+ } >+ if (value != null) { >+ writer.writeAttribute("display-align", value); //$NON-NLS-1$ >+ } >+ } >+ } >+ } >+ >+ private void applyTableRowAttributes(Attributes attributes) { >+ if (attributes instanceof TableRowAttributes) { >+ TableRowAttributes rowAttributes = (TableRowAttributes) attributes; >+ if (rowAttributes.getBgcolor() != null) { >+ writer.writeAttribute(CSS_RULE_BACKGROUND_COLOR, rowAttributes.getBgcolor()); >+ } >+ if (rowAttributes.getBorder() != null) { >+ writer.writeAttribute("border", rowAttributes.getBorder()); //$NON-NLS-1$ >+ } >+ if (rowAttributes.getValign() != null) { >+ String value = rowAttributes.getAlign(); >+ if (rowAttributes.getValign().equals("top")) { //$NON-NLS-1$ >+ value = "before"; //$NON-NLS-1$ >+ } >+ if (rowAttributes.getValign().equals("middle")) { //$NON-NLS-1$ >+ value = "center"; //$NON-NLS-1$ >+ } >+ if (rowAttributes.getValign().equals("bottom")) { //$NON-NLS-1$ >+ value = "after"; //$NON-NLS-1$ >+ } >+ if (value != null) { >+ writer.writeAttribute("display-align", value); //$NON-NLS-1$ >+ } >+ } >+ } >+ } >+ > private void applyTableAttributes(Attributes attributes) { > // applyAttributes(attributes); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 336813
: 188763 |
188764
|
201025