Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
TableHeaderCell and Alternative TableRenderer
- Loading branch information
Showing
6 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...m.ibm.xsp.extlibx.controls/src/com/ibm/xsp/extlibx/component/table/UITableHeaderCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.ibm.xsp.extlibx.component.table; | ||
|
||
import com.ibm.xsp.component.xp.XspTableCell; | ||
|
||
public class UITableHeaderCell extends XspTableCell { | ||
|
||
public static final String RENDERER_TYPE = "com.ibm.xsp.extlibx.TableHeaderCell"; | ||
|
||
public UITableHeaderCell() { | ||
super(); | ||
setRendererType(RENDERER_TYPE); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...sp.extlibx.controls/src/com/ibm/xsp/extlibx/controls/config/extlib-table-faces-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faces-config> | ||
<render-kit> | ||
|
||
<renderer> | ||
<component-family>com.ibm.xsp.Tag</component-family> | ||
<renderer-type>com.ibm.xsp.extlibx.TableHeaderCell</renderer-type> | ||
<renderer-class>com.ibm.xsp.extlibx.renderkit.table.HtmlTableHeaderCellRenderer</renderer-class> | ||
</renderer> | ||
|
||
<renderer> | ||
<component-family>com.ibm.xsp.Tag</component-family> | ||
<renderer-type>com.ibm.xsp.extlibx.Table</renderer-type> | ||
<renderer-class>com.ibm.xsp.extlibx.renderkit.table.HtmlTableRenderer</renderer-class> | ||
</renderer> | ||
|
||
</render-kit> | ||
</faces-config> |
27 changes: 27 additions & 0 deletions
27
....ibm.xsp.extlibx.controls/src/com/ibm/xsp/extlibx/controls/config/extlib-table.xsp-config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faces-config> | ||
|
||
<faces-config-extension> | ||
<namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri> | ||
<default-prefix>xe</default-prefix> | ||
</faces-config-extension> | ||
|
||
<!-- Table Header Cell --> | ||
<component> | ||
<description>A control that displays a single cell in a table row.</description> | ||
<display-name>Table Header Cell</display-name> | ||
<component-type>com.ibm.xsp.TableHeaderCell</component-type> | ||
<component-class>com.ibm.xsp.extlibx.component.table.UITableHeaderCell</component-class> | ||
<component-extension> | ||
<javadoc-description>XPages Container Controls - Table Header Cell</javadoc-description> | ||
<base-component-type>com.ibm.xsp.TableCell</base-component-type> | ||
<component-family>com.ibm.xsp.Tag</component-family> | ||
<renderer-type>com.ibm.xsp.extlibx.TableHeaderCell</renderer-type> | ||
<tag-name>th</tag-name> | ||
<designer-extension> | ||
<generate-id>false</generate-id> | ||
</designer-extension> | ||
</component-extension> | ||
</component> | ||
|
||
</faces-config> |
25 changes: 25 additions & 0 deletions
25
...extlibx.controls/src/com/ibm/xsp/extlibx/renderkit/table/HtmlTableHeaderCellRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.ibm.xsp.extlibx.renderkit.table; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
|
||
import com.ibm.xsp.renderkit.html_extended.HtmlTableCellRenderer; | ||
|
||
public class HtmlTableHeaderCellRenderer extends HtmlTableCellRenderer { | ||
|
||
public static final String TAG = "th"; | ||
public static final String[] ATTRS = { "rowspan", "colspan", "align", "valign", "title", "role" }; | ||
|
||
@Override | ||
public void encodeBegin(FacesContext context, UIComponent component) throws IOException { | ||
super.encodeBegin(context, component, TAG, ATTRS); | ||
} | ||
|
||
@Override | ||
public void encodeEnd(FacesContext context, UIComponent component) throws IOException { | ||
super.encodeEnd(context, component, TAG); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...m.ibm.xsp.extlibx.controls/src/com/ibm/xsp/extlibx/renderkit/table/HtmlTableRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.ibm.xsp.extlibx.renderkit.table; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.context.ResponseWriter; | ||
|
||
import com.ibm.xsp.util.FacesUtil; | ||
|
||
public class HtmlTableRenderer extends com.ibm.xsp.renderkit.html_extended.HtmlTableRenderer { | ||
|
||
@Override | ||
public void encodeBegin(FacesContext context, UIComponent component) throws IOException { | ||
|
||
super.encodeBegin(context, component); | ||
|
||
ResponseWriter w = context.getResponseWriter(); | ||
|
||
UIComponent thead = component.getFacet("thead"); | ||
|
||
if (thead != null) { | ||
w.startElement("thead", null); | ||
FacesUtil.renderComponent(context, thead); | ||
w.endElement("thead"); | ||
} | ||
|
||
UIComponent tfoot = component.getFacet("tfoot"); | ||
|
||
if (tfoot != null) { | ||
w.startElement("tfoot", null); | ||
FacesUtil.renderComponent(context, tfoot); | ||
w.endElement("tfoot"); | ||
} | ||
|
||
w.startElement("tbody", null); | ||
|
||
} | ||
|
||
@Override | ||
public void encodeEnd(FacesContext context, UIComponent component) throws IOException { | ||
|
||
context.getResponseWriter().endElement("tbody"); | ||
|
||
super.encodeEnd(context, component); | ||
} | ||
|
||
} |