You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2010/01/05 12:50:30 UTC
svn commit: r896009 [6/30] - in /myfaces/trinidad/branches/2.0.1-branch: ./
src/site/xdoc/devguide/ trinidad-api/
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ t...
Modified: myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java?rev=896009&r1=896008&r2=896009&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java (original)
+++ myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java Tue Jan 5 11:48:54 2010
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,6 +19,7 @@
package org.apache.myfaces.trinidadinternal.renderkit.core.desktop;
import java.io.IOException;
+
import java.util.List;
import javax.faces.component.UIComponent;
@@ -33,9 +34,10 @@
import org.apache.myfaces.trinidad.component.UIXTable;
import org.apache.myfaces.trinidad.component.core.data.CoreColumn;
import org.apache.myfaces.trinidad.component.core.data.CoreTable;
-import org.apache.myfaces.trinidadinternal.io.RepeatIdResponseWriter;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.render.CoreRenderer;
+import org.apache.myfaces.trinidad.util.IntegerUtils;
+import org.apache.myfaces.trinidadinternal.io.RepeatIdResponseWriter;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ShowDetailRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
@@ -50,7 +52,6 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableSelectManyRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TreeUtils;
-import org.apache.myfaces.trinidad.util.IntegerUtils;
public class DesktopTableRenderer extends TableRenderer
@@ -61,13 +62,15 @@
* =-= awijeyek =-= height is used for server-side scrollable tables for ECM,
* but we don't support it beyond what is needed by ECM.
*/
- protected DesktopTableRenderer(FacesBean.Type type)
+ protected DesktopTableRenderer(
+ FacesBean.Type type)
{
super(type);
}
-
+
@Override
- protected void findTypeConstants(FacesBean.Type type)
+ protected void findTypeConstants(
+ FacesBean.Type type)
{
super.findTypeConstants(type);
_summaryKey = type.findKey("summary");
@@ -89,10 +92,11 @@
@Override
protected final void renderSingleRow(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
// This renders a whole bunch of <TH>..</TH> elements or <TD>..</TD>
// elements depending on the RenderStage
@@ -100,12 +104,12 @@
int stage = renderStage.getStage();
if (stage == RenderStage.COLUMN_HEADER_STAGE)
{
- renderColumnHeader(context, arc, tContext, component);
+ renderColumnHeader(context, rc, tContext, component);
return;
}
// render the special columns, such as selection and details:
- int physicalColumn = renderSpecialColumns(context, arc,
+ int physicalColumn = renderSpecialColumns(context, rc,
tContext, component, 0);
_renderRegularColumns(context, tContext, component, physicalColumn);
@@ -115,10 +119,11 @@
* @todo Support autoSubmit!
*/
protected void renderSelectionLinks(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
// Never render for empty tables
if (tContext.getRowData().isEmptyTable())
@@ -126,20 +131,20 @@
// =-=AEW For some odd reason, we want all the above rendering even if we don't
// have select all or detail disclosure, just not this cell.
- if (hasControlBarLinks(context, arc, tContext, component))
+ if (hasControlBarLinks(context, rc, tContext, component))
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", "100%");
- renderStyleClass(context, arc, SkinSelectors.AF_TABLE_SUB_CONTROL_BAR_STYLE);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", "100%");
+ renderStyleClass(context, rc, SkinSelectors.AF_TABLE_SUB_CONTROL_BAR_STYLE);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute("nowrap", Boolean.TRUE, null);
writer.writeAttribute("valign", XhtmlConstants.MIDDLE_ATTRIBUTE_VALUE, null);
- renderControlBarLinks(context, arc, tContext, component, false);
+ renderControlBarLinks(context, rc, tContext, component, false);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
@@ -153,14 +158,15 @@
* Should we render the select-all/none links?
*/
protected boolean hasControlBarLinks(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
return tContext.hasSelectAll() ||
((tContext.getDetail() != null) &&
- getAllDetailsEnabled(getFacesBean(component)));
+ getAllDetailsEnabled(component, getFacesBean(component)));
}
/**
@@ -176,11 +182,12 @@
RenderingContext arc,
TableRenderingContext trc,
UIComponent component,
- boolean useDivider) throws IOException
+ boolean useDivider
+ ) throws IOException
{
FacesBean bean = getFacesBean(component);
boolean hasAllDetails = ((trc.getDetail() != null) &&
- getAllDetailsEnabled(bean));
+ getAllDetailsEnabled(component, bean));
boolean needsDivider = false;
if (trc.hasSelectAll())
@@ -194,7 +201,7 @@
_SELECT_NONE_TEXT_KEY, null, hasAllDetails);
needsDivider = true;
- TableSelectManyRenderer.renderScripts(context, arc, trc, isAutoSubmit(bean));
+ TableSelectManyRenderer.renderScripts(context, arc, trc, isAutoSubmit(component, bean));
}
ResponseWriter writer = context.getResponseWriter();
@@ -213,20 +220,21 @@
}
protected final void renderControlBarLink(
- FacesContext context,
- RenderingContext arc,
- String onclick,
- String translationKey,
- String id,
- boolean hasDivider) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String onclick,
+ String translationKey,
+ String id,
+ boolean hasDivider
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement("a", null);
writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, id, null);
- renderStyleClass(context, arc, SkinSelectors.NAV_BAR_ALINK_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.NAV_BAR_ALINK_STYLE_CLASS);
writer.writeAttribute("onclick", onclick, null);
writer.writeURIAttribute("href", "#", null);
- writer.writeText(arc.getTranslatedString(translationKey), null);
+ writer.writeText(rc.getTranslatedString(translationKey), null);
writer.endElement("a");
if (hasDivider)
@@ -235,26 +243,28 @@
@Override
protected void renderSubControlBar(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component,
- boolean isUpper) throws IOException
+ UIComponent component,
+ boolean isUpper
+ ) throws IOException
{
if (!isUpper)
return;
RenderStage rs = tContext.getRenderStage();
rs.setStage(RenderStage.SUB_CONTROL_BAR_STAGE);
- renderSelectionLinks(context, arc, tContext, component);
+ renderSelectionLinks(context, rc, tContext, component);
}
@Override
protected void renderTableContent(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
if (getFacet(component, CoreTable.FOOTER_FACET) != null)
tContext.setExplicitHeaderIDMode(true);
@@ -284,19 +294,19 @@
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
}
- String height = getHeight(getFacesBean(component));
+ String height = getHeight(component, getFacesBean(component));
final boolean useScrollIE;
final String scrollID;
- if ((height != null) && isIE(arc))
+ if ((height != null) && isIE(rc))
{
useScrollIE = true;
String tableId = tContext.getTableId();
scrollID = tableId+"_scroll";
writer.startElement("script", null);
- renderScriptDeferAttribute(context, arc);
- renderScriptTypeAttribute(context, arc);
- _writeIEscrollScript(context, arc, tableId, scrollID);
+ renderScriptDeferAttribute(context, rc);
+ renderScriptTypeAttribute(context, rc);
+ _writeIEscrollScript(context, rc, tableId, scrollID);
writer.endElement("script");
writer.startElement("div", null);
@@ -316,25 +326,25 @@
}
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- renderStyleClass(context, arc, SkinSelectors.AF_TABLE_CONTENT_STYLE);
+ renderStyleClass(context, rc, SkinSelectors.AF_TABLE_CONTENT_STYLE);
- if ((height != null)&& isGecko(arc))
+ if ((height != null)&& isGecko(rc))
{
writer.writeAttribute("style", "border-width:0px", null);
}
FacesBean bean = getFacesBean(table);
- String summary = getSummary(bean);
+ String summary = getSummary(component, bean);
Object cellPadding = getTablePadding(table);
OutputUtils.renderDataTableAttributes(
- context, arc, cellPadding,
+ context, rc, cellPadding,
"0", // cell spacing
"0", //border
"100%", //table width
summary);
- _renderTableHeader(context, arc, tContext, table);
+ _renderTableHeader(context, rc, tContext, table);
// render the column header
if (tContext.hasColumnHeaders())
@@ -353,7 +363,7 @@
//bug4364828, bug 4585888
writer.writeAttribute("id", scrollID, null);
}
- renderColumnHeader(context, arc, tContext, component);
+ renderColumnHeader(context, rc, tContext, component);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
assert _assertCurrencyKeyPreserved(assertKey, table);
@@ -361,7 +371,7 @@
// 3. Render all the rows
//
renderStage.setStage(RenderStage.DATA_STAGE);
- renderTableRows(context, arc, tContext, component, bean);
+ renderTableRows(context, rc, tContext, component, bean);
assert _assertCurrencyKeyPreserved(assertKey, table);
// the content table is a row in the overall table
@@ -381,7 +391,7 @@
// ideally, the attributes on this table should be the same as on the
// root table, rendered by super.renderAttributes(..). However, that
// method writes out an ID_ATTR, which we do not want to do here:
- OutputUtils.renderLayoutTableAttributes(context, arc,
+ OutputUtils.renderLayoutTableAttributes(context, rc,
"0", // cell spacing
"0", // border
"100%"); // table width
@@ -397,14 +407,15 @@
}
private void _writeIEscrollScript(
- FacesContext context,
- RenderingContext arc,
- String tableId,
- String scrollID) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String tableId,
+ String scrollID
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
boolean previouslyNotRendered =
- (arc.getProperties().put(_IE_SCROLL_KEY, Boolean.TRUE) == null);
+ (rc.getProperties().put(_IE_SCROLL_KEY, Boolean.TRUE) == null);
if (previouslyNotRendered)
{
writer.write(
@@ -516,10 +527,10 @@
@Override
protected final void renderControlBar(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component)
- throws IOException
+ UIComponent component
+ ) throws IOException
{
UIComponent action = getFacet(component, CoreTable.ACTIONS_FACET);
boolean tableNotEmpty = !tContext.getRowData().isEmptyTable();
@@ -549,8 +560,8 @@
style = SkinSelectors.AF_TABLE_CONTROL_BAR_BOTTOM_STYLE;
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", "0", "0", "100%");
- renderStyleClass(context, arc, style);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", "0", "0", "100%");
+ renderStyleClass(context, rc, style);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
if (action != null)
@@ -566,7 +577,7 @@
if (hasNav)
{
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- if (arc.isRightToLeft())
+ if (rc.isRightToLeft())
writer.writeAttribute(XhtmlConstants.ALIGN_ATTRIBUTE,
XhtmlConstants.LEFT_ATTRIBUTE_VALUE, null);
else
@@ -574,7 +585,7 @@
XhtmlConstants.RIGHT_ATTRIBUTE_VALUE, null);
writer.writeAttribute(XhtmlConstants.VALIGN_ATTRIBUTE,
XhtmlConstants.MIDDLE_ATTRIBUTE_VALUE, null);
- renderRangePagingControl(context, arc, tContext, component);
+ renderRangePagingControl(context, rc, tContext, component);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
@@ -602,17 +613,18 @@
*/
protected void renderRangePagingControl(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component)
- throws IOException
+ UIComponent component
+ ) throws IOException
{
- delegateRenderer(context, arc, component,
+ delegateRenderer(context, rc, component,
getFacesBean(component), getSharedNavBarRenderer());
}
-
- private boolean _assertCurrencyKeyPreserved(Object oldKey, UIComponent table)
+ private boolean _assertCurrencyKeyPreserved(
+ Object oldKey,
+ UIComponent table)
{
UIXCollection base = (UIXCollection) table;
Object newKey = base.getRowKey();
@@ -620,24 +632,26 @@
}
// needed for BIBeans. Contact: Max Starets
- protected Object getTablePadding(UIComponent component)
+ protected Object getTablePadding(
+ UIComponent component)
{
return "1";
}
protected void renderTableRows(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext trc,
UIComponent component,
- FacesBean bean) throws IOException
+ FacesBean bean
+ ) throws IOException
{
if (trc.getRowData().isEmptyTable())
- _renderEmptyTable(context, arc, trc);
+ _renderEmptyTable(context, rc, trc);
else
- _renderTableRows(context, arc, trc, component);
+ _renderTableRows(context, rc, trc, component);
// render the footer
- renderFooter(context, arc, trc, component);
+ renderFooter(context, rc, trc, component);
}
/**
@@ -646,15 +660,15 @@
*/
@Override
protected void renderTableAttributes(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- Object cellPadding,
- Object border)
- throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean,
+ Object cellPadding,
+ Object border
+ ) throws IOException
{
- super.renderTableAttributes(context, arc, component, bean,
+ super.renderTableAttributes(context, rc, component, bean,
cellPadding, border);
}
@@ -663,9 +677,10 @@
* @todo Implement "headers" attribute correctly!
*/
protected void renderCellFormatAttributes(
- FacesContext context,
- RenderingContext arc,
- TableRenderingContext tContext) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ TableRenderingContext tContext
+ ) throws IOException
{
// renders "style", "class", "nowrap", "headers".
// renders "width" when there are no column headers.
@@ -673,9 +688,9 @@
//TODO: must get individual column's style:
String cellClass = SkinSelectors.AF_COLUMN_CELL_TEXT_STYLE;/*ColumnRenderer.getDataStyleClass(...)*/
- String borderStyleClass = CellUtils.getDataBorderStyle(arc, tContext);
+ String borderStyleClass = CellUtils.getDataBorderStyle(rc, tContext);
- renderStyleClasses(context, arc, new String[]{cellClass, borderStyleClass});
+ renderStyleClasses(context, rc, new String[]{cellClass, borderStyleClass});
final ResponseWriter writer = context.getResponseWriter();
int row = tContext.getRowData().getRangeIndex();
@@ -700,16 +715,15 @@
writer.writeAttribute(XhtmlConstants.NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
}
-
/**
* @todo Reconsider our choice of style for this element!
*/
private void _renderTableHeader(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component)
- throws IOException
+ UIComponent component
+ ) throws IOException
{
// implement header facet on table: see bug 3788610
ResponseWriter writer = context.getResponseWriter();
@@ -721,7 +735,7 @@
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE,
tContext.getActualColumnCount(), null);
- renderStyleClass(context, arc, SkinSelectors.AF_COLUMN_SORTABLE_HEADER_ICON_STYLE_CLASS);
+ renderStyleClass(context, rc, SkinSelectors.AF_COLUMN_SORTABLE_HEADER_ICON_STYLE_CLASS);
encodeChild(context, header);
@@ -733,14 +747,14 @@
private void _renderEmptyTable(
FacesContext context,
- RenderingContext arc,
- TableRenderingContext tContext)
- throws IOException
+ RenderingContext rc,
+ TableRenderingContext tContext
+ ) throws IOException
{
int specialCols = tContext.hasSelection() ? 1 : 0;
if (tContext.getDetail() != null)
specialCols++;
- renderEmptyTableRow(context, arc, tContext, specialCols);
+ renderEmptyTableRow(context, rc, tContext, specialCols);
}
/**
@@ -751,19 +765,21 @@
*/
protected final void renderEmptyTableRow(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- int specialColumnCount) throws IOException
+ int specialColumnCount
+ ) throws IOException
{
- renderEmptyTableRow(context, arc, tContext, specialColumnCount, null);
+ renderEmptyTableRow(context, rc, tContext, specialColumnCount, null);
}
protected final void renderEmptyTableRow(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
int specialColumnCount,
- CoreRenderer emptyTextRenderer) throws IOException
+ CoreRenderer emptyTextRenderer
+ ) throws IOException
{
// renders <TR> followed by a whole bunch of <TD>..</TD>, followed by
// </TR>
@@ -775,7 +791,7 @@
int objectNameColumnIndex = colData.getObjectNameColumnIndex();
for (int i = 0, sz = Math.max(specialColumnCount, objectNameColumnIndex); i < sz; i++)
{
- _renderEmptyCell(context, arc, tContext, physicalColumn++, null, 1);
+ _renderEmptyCell(context, rc, tContext, physicalColumn++, null, 1);
}
int totalCols = tContext.getActualColumnCount();
@@ -784,16 +800,16 @@
if (emptyTextRenderer == null)
{
- _renderEmptyCell(context, arc, tContext, physicalColumn,
- getEmptyText(bean), totalCols - physicalColumn);
+ _renderEmptyCell(context, rc, tContext, physicalColumn,
+ getEmptyText(table, bean), totalCols - physicalColumn);
physicalColumn++;
}
else
{
- delegateRenderer(context, arc, table, bean, emptyTextRenderer);
+ delegateRenderer(context, rc, table, bean, emptyTextRenderer);
while (physicalColumn < totalCols)
{
- _renderEmptyCell(context, arc, tContext, physicalColumn++, null, 1);
+ _renderEmptyCell(context, rc, tContext, physicalColumn++, null, 1);
}
}
// clear the current header id
@@ -802,12 +818,13 @@
}
private void _renderEmptyCell(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
TableRenderingContext tContext,
- int physicalColumn,
- String text,
- int colspan) throws IOException
+ int physicalColumn,
+ String text,
+ int colspan
+ ) throws IOException
{
ColumnData colData = tContext.getColumnData();
ResponseWriter writer = context.getResponseWriter();
@@ -817,7 +834,7 @@
colData.setCurrentHeaderID(colID);
colData.setColumnIndex(physicalColumn, ColumnData.SPECIAL_COLUMN_INDEX);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderCellFormatAttributes(context, arc, tContext);
+ renderCellFormatAttributes(context, rc, tContext);
if (colspan > 1)
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, colspan, null);
if (text != null)
@@ -826,12 +843,11 @@
}
private void _renderTableRows(
- FacesContext context,
- final RenderingContext arc,
+ FacesContext context,
+ final RenderingContext rc,
final TableRenderingContext tContext,
- UIComponent component
- )
- throws IOException
+ UIComponent component
+ ) throws IOException
{
// renders a whole bunch of <TR>...</TR> elements, one for each row in the
// table, and additional ones for any disclosed-details rows
@@ -851,14 +867,14 @@
rowData.setCurrentRowSpan(-1);
//reset
renderStage.setStage(RenderStage.START_ROW_STAGE);
- renderSingleRow(fc, arc, tContext, (UIComponent) tableBase);
+ renderSingleRow(fc, rc, tContext, (UIComponent) tableBase);
renderStage.setStage(RenderStage.DATA_STAGE);
// render each of the individual rows in the rowSpan:
for (int i = 0, sz = rowData.getCurrentRowSpan(); i < sz; i++)
{
// start the row
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
- renderSingleRow(fc, arc, tContext, (UIComponent) tableBase);
+ renderSingleRow(fc, rc, tContext, (UIComponent) tableBase);
rowData.incCurrentSubRow();
// end the row
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
@@ -884,7 +900,7 @@
String styleClass = SkinSelectors.AF_TABLE_DETAIL_STYLE;
String borderStyleClass = CellUtils.getBorderClass(
true, true, true, true);
- renderStyleClasses(fc, arc,
+ renderStyleClasses(fc, rc,
new String[]{styleClass, borderStyleClass});
encodeChild(fc, detail);
@@ -898,10 +914,10 @@
};
ResponseWriter writer = context.getResponseWriter();
- String height = getHeight(getFacesBean(component));
+ String height = getHeight(component, getFacesBean(component));
boolean useScroll;
- if ((height != null) && isGecko(arc))
+ if ((height != null) && isGecko(rc))
{
useScroll = true;
writer.startElement("tbody", null);
@@ -922,17 +938,18 @@
*/
protected final void renderColumnHeader(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
+ UIComponent component
+ ) throws IOException
{
// This renders a whole bunch of <TH>...</TH> elements
final ColumnData colData = tContext.getColumnData();
// we need to keep track of which row we are on; this makes it easier
// to do rowSpanning in columnGroups:
colData.setRowIndex(0);
- int physicalCol = renderSpecialColumns(context, arc, tContext, component, 0);
- renderRegularHeaders(context, arc, tContext, component, physicalCol);
+ int physicalCol = renderSpecialColumns(context, rc, tContext, component, 0);
+ renderRegularHeaders(context, rc, tContext, component, physicalCol);
// we are done, so reset the current row:
colData.setRowIndex(-1);
}
@@ -943,10 +960,11 @@
*/
protected final void renderRegularHeaders(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
UIComponent component,
- int physicalCol) throws IOException
+ int physicalCol
+ ) throws IOException
{
// this renders a whole bunch of <TH>...</TH> elements.
// if there are columnGroups present, it will render some
@@ -972,7 +990,8 @@
FacesContext context,
TableRenderingContext tContext,
UIComponent component,
- int physicalCol) throws IOException
+ int physicalCol
+ ) throws IOException
{
// this renders a whole bunch of <TH>...</TH> elements.
// part of #1313720, base column header count on
@@ -1011,10 +1030,10 @@
@SuppressWarnings("unchecked")
protected final void renderFooter(
FacesContext context,
- RenderingContext arc,
+ RenderingContext rc,
TableRenderingContext tContext,
- UIComponent component) throws IOException
-
+ UIComponent component
+ ) throws IOException
{
tContext.getRenderStage().setStage(RenderStage.COLUMN_FOOTER_STAGE);
final ColumnData colData = tContext.getColumnData();
@@ -1026,7 +1045,7 @@
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
- boolean useScroll = (getHeight(getFacesBean(component)) != null) && isIE(arc);
+ boolean useScroll = (getHeight(component, getFacesBean(component)) != null) && isIE(rc);
if (useScroll)
{
writer.writeAttribute("style", "position:relative;"+
@@ -1061,7 +1080,7 @@
writer.startElement(XhtmlConstants.TABLE_HEADER_ELEMENT, null);
final int colSpan = (firstFooterPhysicalIndex > 0)? firstFooterPhysicalIndex: tContext.getActualColumnCount();
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, IntegerUtils.getString(colSpan), null);
- renderStyleClass(context, arc, SkinSelectors.AF_TABLE_COLUMN_FOOTER_STYLE);
+ renderStyleClass(context, rc, SkinSelectors.AF_TABLE_COLUMN_FOOTER_STYLE);
if (footer != null)
encodeChild(context, footer);
writer.endElement(XhtmlConstants.TABLE_HEADER_ELEMENT);
@@ -1083,16 +1102,16 @@
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
// OK, we need to put the table footer at the end in its own row,
- // because the first column is already taken
+ // because the first column is already taken
if ((firstFooterPhysicalIndex == 0) && (footer != null))
{
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
-
+
writer.startElement(XhtmlConstants.TABLE_HEADER_ELEMENT, null);
// Make it span the whole table
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, tContext.getActualColumnCount(), null);
- renderStyleClass(context, arc, SkinSelectors.AF_TABLE_COLUMN_FOOTER_STYLE);
+ renderStyleClass(context, rc, SkinSelectors.AF_TABLE_COLUMN_FOOTER_STYLE);
encodeChild(context, footer);
writer.endElement(XhtmlConstants.TABLE_HEADER_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
@@ -1100,12 +1119,16 @@
}
}
- protected String getSummary(FacesBean bean)
+ protected String getSummary(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_summaryKey));
}
- protected String getHeight(FacesBean bean)
+ protected String getHeight(
+ UIComponent component,
+ FacesBean bean)
{
return toString(bean.getProperty(_heightKey));
}
@@ -1115,7 +1138,9 @@
*
* @param bean the bean
*/
- protected boolean isAutoSubmit(FacesBean bean)
+ protected boolean isAutoSubmit(
+ UIComponent component,
+ FacesBean bean)
{
if (_autoSubmitKey == null)
return false;
@@ -1123,7 +1148,9 @@
return Boolean.TRUE.equals(bean.getProperty(_autoSubmitKey));
}
- protected boolean getAllDetailsEnabled(FacesBean bean)
+ protected boolean getAllDetailsEnabled(
+ UIComponent component,
+ FacesBean bean)
{
Object o = bean.getProperty(_allDetailsEnabledKey);
if (o == null)
@@ -1134,7 +1161,9 @@
static private class AllDetail extends ShowDetailRenderer
{
- public AllDetail(FacesBean.Type type, boolean disclosed)
+ public AllDetail(
+ FacesBean.Type type,
+ boolean disclosed)
{
super(type);
_disclosed = disclosed;
@@ -1142,9 +1171,10 @@
@Override
protected void renderAllAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean)
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean)
{
}
@@ -1161,41 +1191,51 @@
}
@Override
- protected String getValueParameter(UIComponent component)
+ protected String getValueParameter(
+ UIComponent component)
{
return "all";
}
-
@Override
- protected boolean getDisclosed(FacesBean bean)
+ protected boolean getDisclosed(
+ UIComponent component,
+ FacesBean bean)
{
return _disclosed;
}
@Override
- protected String getDisclosedText(FacesBean bean)
+ protected String getDisclosedText(
+ UIComponent component,
+ FacesBean bean)
{
RenderingContext arc = RenderingContext.getCurrentInstance();
return arc.getTranslatedString(_HIDE_ALL_DETAILS_TEXT_KEY);
}
@Override
- protected String getUndisclosedText(FacesBean bean)
+ protected String getUndisclosedText(
+ UIComponent component,
+ FacesBean bean)
{
RenderingContext arc = RenderingContext.getCurrentInstance();
return arc.getTranslatedString(_SHOW_ALL_DETAILS_TEXT_KEY);
}
@Override
- protected String getLinkId(String rootId, boolean disclosed)
+ protected String getLinkId(
+ String rootId,
+ boolean disclosed)
{
String suffix = (disclosed ? "ha" : "sa");
return XhtmlUtils.getCompositeId(rootId, suffix);
}
@Override
- protected String getClientId(FacesContext context, UIComponent component)
+ protected String getClientId(
+ FacesContext context,
+ UIComponent component)
{
TableRenderingContext tContext = TableRenderingContext.getCurrentInstance();
return tContext.getTableId();
@@ -1213,16 +1253,11 @@
// translation keys
private static final String _SHOW_ALL_DETAILS_TEXT_KEY = "af_table.SHOW_ALL_DETAILS";
-
private static final String _HIDE_ALL_DETAILS_TEXT_KEY = "af_table.HIDE_ALL_DETAILS";
-
private static final String _SELECT_ALL_TEXT_KEY = "af_tableSelectMany.SELECT_ALL";
-
private static final String _SELECT_NONE_TEXT_KEY = "af_tableSelectMany.SELECT_NONE";
-
- public static final String LINKS_DIVIDER_TEXT = "\u00a0|\u00a0";
-
private static final Object _IE_SCROLL_KEY = new Object();
+ public static final String LINKS_DIVIDER_TEXT = "\u00a0|\u00a0";
private PropertyKey _autoSubmitKey;
private PropertyKey _summaryKey;
Modified: myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java?rev=896009&r1=896008&r2=896009&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java (original)
+++ myfaces/trinidad/branches/2.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java Tue Jan 5 11:48:54 2010
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,6 +20,7 @@
import java.io.IOException;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -51,9 +52,10 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+
/**
* Renderer for process train components
- *
+ *
*/
public class TrainRenderer
extends XhtmlRenderer
@@ -65,14 +67,16 @@
{
super(CoreTrain.TYPE);
}
-
+
/**
*/
@SuppressWarnings("unchecked")
@Override
- public void decode(FacesContext context, UIComponent component)
+ public void decode(
+ FacesContext context,
+ UIComponent component)
{
- Map<String, String> requestMap =
+ Map<String, String> requestMap =
context.getExternalContext().getRequestParameterMap();
Object event = requestMap.get(XhtmlConstants.EVENT_PARAM);
@@ -144,7 +148,7 @@
}
}
}
-
+
/**
* @return
*/
@@ -156,15 +160,15 @@
@Override
protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
FacesBean bean)
throws IOException
{
// Since Train is a naming container, we can be more
// efficient about skipping its children
- if (!PartialPageUtils.containsPprTargets(arc,
+ if (!PartialPageUtils.containsPprTargets(rc,
component,
getClientId(context, component)))
{
@@ -177,7 +181,7 @@
"TRAINRENDERER_ONLY_RENDERS_INSTANCE", new Object[]{UIXProcess.class.getName(), component.getClass().getName()}));
}
- if (arc.getFormData() == null)
+ if (rc.getFormData() == null)
{
_LOG.warning("TRAIN_MUST_INSIDE_FORM");
return;
@@ -188,35 +192,35 @@
if (stamp != null)
{
- Train train = new Train(context, arc, process, stamp);
+ Train train = new Train(context, rc, process, stamp);
try
{
process.setRowKey(train.getFocusRowKey());
-
+
// Renders some fields and scripts
- _renderHiddenFields(context, arc, train);
-
+ _renderHiddenFields(context, rc, train);
+
ResponseWriter writer = context.getResponseWriter();
-
+
// Need to render the frame even if there's no visible station
// to support PPR.
writer.startElement(XhtmlConstants.TABLE_ELEMENT, component);
process.setRowKey(train.getInitialRowKey());
renderId(context, component);
- renderAllAttributes(context, arc, bean);
+ renderAllAttributes(context, rc, component, bean);
// Does not seem to be needed and this is not XHTML 1.0 Strict compliant
// writer.writeAttribute("align", "center", null);
-
+
if(!train.getStations().isEmpty())
{
process.setRowKey(train.getFocusRowKey());
-
+
// There're visible stations currently, let render them.
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
- _renderTrain(context, arc, process, bean, stamp, train);
+ _renderTrain(context, rc, process, bean, stamp, train);
writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
}
finally
@@ -233,15 +237,17 @@
_encodeChildren(context, arc, process, stamp, trainState, length);
*/
}
-
+
@Override
protected void renderAllAttributes(
- FacesContext context,
- RenderingContext arc,
- FacesBean bean) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
+ FacesBean bean
+ ) throws IOException
{
- super.renderAllAttributes(context, arc, bean);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ super.renderAllAttributes(context, rc, component, bean);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
}
/**
@@ -250,39 +256,45 @@
*/
@Override
protected void renderStyleAttributes(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
+ UIComponent component,
FacesBean bean)
throws IOException
{
- renderStyleAttributes(context,
- arc,
- bean,
- SkinSelectors.AF_TRAIN_ROOT_STYLE_CLASS);
+ renderStyleAttributes(
+ context,
+ rc,
+ component,
+ bean,
+ SkinSelectors.AF_TRAIN_ROOT_STYLE_CLASS);
}
-
+
private void _preRenderIconBlock(
- FacesContext context,
- RenderingContext arc) throws IOException
+ FacesContext context,
+ RenderingContext rc
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
// Icon cell
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
// Icons need to be in a table to stretch well
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
- OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+ OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, "width: 100%", null);
-
+
writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
}
-
- private void _postRenderIconBlock(FacesContext context) throws IOException
+
+ private void _postRenderIconBlock(
+ FacesContext context
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
@@ -290,15 +302,15 @@
}
private void _renderHiddenFields(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext rc,
Train train)
throws IOException
{
- if((train.getFormName() != null) && supportsScripting(arc))
+ if((train.getFormName() != null) && supportsScripting(rc))
{
// render hidden fields to hold the form data
- FormData formData = arc.getFormData();
+ FormData formData = rc.getFormData();
if (formData != null)
{
formData.addNeededValue(XhtmlConstants.EVENT_PARAM);
@@ -308,627 +320,650 @@
}
// Render script submission code.
- ProcessUtils.renderNavSubmitScript(context, arc);
+ ProcessUtils.renderNavSubmitScript(context, rc);
}
}
-
+
private void _renderContentRowLtr(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- UIComponent stamp,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ UIComponent stamp,
+ Train train
+ ) throws IOException
{
ParentTrain parentTrain = train.getParentTrain();
-
+
// Render parent start
if(parentTrain != null && parentTrain.hasParentStart())
{
- _renderParentContent(context, arc, parentTrain.getParentStart());
+ _renderParentContent(context, rc, parentTrain.getParentStart());
}
-
+
for(Station station : train.getStations())
{
- _renderStationContent(context, arc, process, stamp, station);
+ _renderStationContent(context, rc, process, stamp, station);
}
-
+
// Render parent end
if(parentTrain != null && parentTrain.hasParentEnd())
{
- _renderParentContent(context, arc, parentTrain.getParentEnd());
+ _renderParentContent(context, rc, parentTrain.getParentEnd());
}
}
-
+
private void _renderContentRowRtl(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- UIComponent stamp,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ UIComponent stamp,
+ Train train
+ ) throws IOException
{
ParentTrain parentTrain = train.getParentTrain();
-
+
// Render parent start
if(parentTrain != null && parentTrain.hasParentEnd())
{
- _renderParentContent(context, arc, parentTrain.getParentEnd());
+ _renderParentContent(context, rc, parentTrain.getParentEnd());
}
-
+
List<Station> stations = train.getStations();
ListIterator<Station> iterator = stations.listIterator(stations.size());
while(iterator.hasPrevious())
{
- _renderStationContent(context, arc, process, stamp, iterator.previous());
+ _renderStationContent(context, rc, process, stamp, iterator.previous());
}
-
+
// Render parent end
if(parentTrain != null && parentTrain.hasParentStart())
{
- _renderParentContent(context, arc, parentTrain.getParentStart());
+ _renderParentContent(context, rc, parentTrain.getParentStart());
}
}
-
+
private void _renderIconBlock(
- FacesContext context,
- RenderingContext arc,
- List<String> iconNames,
- String shortDesc,
- String styleClass,
- String iconStyleClass,
- List<String> stateStyleClasses) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ List<String> iconNames,
+ String shortDesc,
+ String styleClass,
+ String iconStyleClass,
+ List<String> stateStyleClasses
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
-
+
stateStyleClasses.add(styleClass);
stateStyleClasses.add(iconStyleClass);
-
- renderStyleClasses(context,
- arc,
+
+ renderStyleClasses(context,
+ rc,
stateStyleClasses.toArray(_EMPTY_STRING_ARRAY));
-
+
if(iconNames != null)
{
- // Render the first valid icon found. The list should be in
+ // Render the first valid icon found. The list should be in
// decreasing priority order.
for(String iconName : iconNames)
{
- Icon icon = arc.getIcon(iconName);
+ Icon icon = rc.getIcon(iconName);
if(icon != null)
{
- OutputUtils.renderIcon(context, arc, icon, shortDesc, null);
+ OutputUtils.renderIcon(context, rc, icon, shortDesc, null);
break;
}
}
}
-
+
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
private void _renderIconRowLtr(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
{
ParentTrain parentTrain = train.getParentTrain();
-
+
// Render parent start
if(parentTrain != null && parentTrain.hasParentStart())
{
- _renderParentStartLtr(context, arc, process, train);
+ _renderParentStartLtr(context, rc, process, train);
}
-
+
for(Station station : train.getStations())
{
- _renderStationIconLtr(context, arc, process, station);
+ _renderStationIconLtr(context, rc, process, station);
}
-
+
// Render parent end
if(parentTrain != null && parentTrain.hasParentEnd())
{
- _renderParentEndLtr(context, arc, process, train);
+ _renderParentEndLtr(context, rc, process, train);
}
}
-
+
private void _renderIconRowRtl(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
{
ParentTrain parentTrain = train.getParentTrain();
-
+
// Render parent end
if(parentTrain != null && parentTrain.hasParentEnd())
{
- _renderParentEndRtl(context, arc, process, train);
+ _renderParentEndRtl(context, rc, process, train);
}
-
+
List<Station> stations = train.getStations();
ListIterator<Station> iterator = stations.listIterator(stations.size());
while(iterator.hasPrevious())
{
- _renderStationIconRtl(context, arc, process, iterator.previous());
+ _renderStationIconRtl(context, rc, process, iterator.previous());
}
-
+
// Render parent start
if(parentTrain != null && parentTrain.hasParentStart())
{
- _renderParentStartRtl(context, arc, process, train);
+ _renderParentStartRtl(context, rc, process, train);
}
-
+
}
-
+
private void _renderJoin(
- FacesContext context,
- RenderingContext arc,
- String stateStyleClass,
- boolean overflow) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String stateStyleClass,
+ boolean overflow
+ ) throws IOException
{
if (_STATE_PARENT.equals(stateStyleClass))
{
_renderJoin(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_PARENT_JOIN_STYLE_CLASS,
null);
}
else if (overflow)
{
_renderJoin(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_OVERFLOW_JOIN_STYLE_CLASS,
stateStyleClass);
}
else
{
_renderJoin(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_JOIN_STYLE_CLASS,
stateStyleClass);
}
}
-
+
private void _renderJoin(
- FacesContext context,
- RenderingContext arc,
- String joinStyleClass,
- String stateStyleClass) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String joinStyleClass,
+ String stateStyleClass
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
- renderStyleClasses(context,
- arc,
+ renderStyleClasses(context,
+ rc,
new String[]{
- joinStyleClass,
+ joinStyleClass,
stateStyleClass});
-
+
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
private void _renderJoinIconBlock(
- FacesContext context,
- RenderingContext arc,
- String stateStyleClass,
- boolean overflow) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String stateStyleClass,
+ boolean overflow
+ ) throws IOException
{
if (_STATE_PARENT.equals(stateStyleClass))
{
_renderJoinIconBlock(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_PARENT_JOIN_STYLE_CLASS,
null);
}
else if(overflow)
{
_renderJoinIconBlock(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_OVERFLOW_JOIN_STYLE_CLASS,
stateStyleClass);
}
else
{
_renderJoinIconBlock(context,
- arc,
+ rc,
SkinSelectors.AF_TRAIN_JOIN_STYLE_CLASS,
stateStyleClass);
}
}
-
+
private void _renderJoinIconBlock(
- FacesContext context,
- RenderingContext arc,
- String joinStyleClass,
- String stateStyleClass) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ String joinStyleClass,
+ String stateStyleClass
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, "width: 50%", null);
- renderStyleClasses(context,
- arc,
+ renderStyleClasses(context,
+ rc,
new String[]{
- joinStyleClass,
+ joinStyleClass,
stateStyleClass});
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
private void _renderParentContent(
- FacesContext context,
- RenderingContext arc,
- Station parent) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ Station parent) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
String baseStyleClass = parent.getBaseStyleClass();
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, "3", null);
- renderStyleClasses(context,
- arc,
+ renderStyleClasses(context,
+ rc,
new String[]{
baseStyleClass,
baseStyleClass + _SUFFIX_CONTENT});
-
+
/* -= Simon =-
* FIXME HACK for MSIE CSS bug involving composite style classes.
* Since the bug is most obvious with join background images
* I hard code background-image to none to fix it.
* See Jira for issue ADFFACES-206.
*/
- if(arc.getAgent().getAgentName().equalsIgnoreCase(Agent.AGENT_IE))
+ if(rc.getAgent().getAgentName().equalsIgnoreCase(Agent.AGENT_IE))
{
- writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
- "background-image:none;",
+ writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
+ "background-image:none;",
null);
}
-
+
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
private void _renderParentEnd(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train,
- String leftState,
- String rightState) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train,
+ String leftState,
+ String rightState
+ ) throws IOException
{
// Add join
- _renderJoin(context, arc, leftState, false);
-
+ _renderJoin(context, rc, leftState, false);
+
// Icon cell
- _preRenderIconBlock(context, arc);
-
+ _preRenderIconBlock(context, rc);
+
// Add join
- _renderJoinIconBlock(context, arc, leftState, false);
-
+ _renderJoinIconBlock(context, rc, leftState, false);
+
// Add the parent's stop icon
- _renderParentEndIconBlock(context, arc, process, train);
-
+ _renderParentEndIconBlock(context, rc, process, train);
+
// Add join
- _renderJoinIconBlock(context, arc, rightState, false);
-
+ _renderJoinIconBlock(context, rc, rightState, false);
+
// End icon cell
_postRenderIconBlock(context);
-
+
// Add join
- _renderJoin(context, arc, rightState, false);
+ _renderJoin(context, rc, rightState, false);
}
-
+
private void _renderParentEndLtr(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
- {
- _renderParentEnd(context,
- arc,
- process,
- train,
- _STATE_PARENT,
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
+ {
+ _renderParentEnd(context,
+ rc,
+ process,
+ train,
+ _STATE_PARENT,
null);
}
-
+
private void _renderParentEndRtl(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
- {
- _renderParentEnd(context,
- arc,
- process,
- train,
- null,
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
+ {
+ _renderParentEnd(context,
+ rc,
+ process,
+ train,
+ null,
_STATE_PARENT);
}
-
+
private void _renderParentEndIconBlock(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
{
assert train.getParentTrain().hasParentEnd();
Station parent = train.getParentTrain().getParentEnd();
-
+
process.setRowKey(parent.getRowKey());
-
- _renderStationIconBlock(context, arc, process, parent);
-
+
+ _renderStationIconBlock(context, rc, process, parent);
+
// Restore model
process.setRowKey(train.getInitialRowKey());
}
-
+
private void _renderParentStartIconBlock(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
{
assert train.getParentTrain().hasParentStart();
Station parent = train.getParentTrain().getParentStart();
-
+
process.setRowKey(parent.getRowKey());
- _renderStationIconBlock(context, arc, process, parent);
-
+ _renderStationIconBlock(context, rc, process, parent);
+
// Restore model
process.setRowKey(train.getInitialRowKey());
}
-
+
private void _renderParentStart(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train,
- String leftState,
- String rightState) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train,
+ String leftState,
+ String rightState
+ ) throws IOException
{
// Add join
- _renderJoin(context, arc, leftState, false);
-
+ _renderJoin(context, rc, leftState, false);
+
// Icon cell
- _preRenderIconBlock(context, arc);
-
+ _preRenderIconBlock(context, rc);
+
// Add join
- _renderJoinIconBlock(context, arc, leftState, false);
-
+ _renderJoinIconBlock(context, rc, leftState, false);
+
// Add the parent's stop icon
- _renderParentStartIconBlock(context, arc, process, train);
-
+ _renderParentStartIconBlock(context, rc, process, train);
+
// Add join
- _renderJoinIconBlock(context, arc, rightState, false);
-
+ _renderJoinIconBlock(context, rc, rightState, false);
+
_postRenderIconBlock(context);
// End icon cell
-
+
// Add join
- _renderJoin(context, arc, rightState, false);
+ _renderJoin(context, rc, rightState, false);
}
-
+
private void _renderParentStartLtr(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
- {
- _renderParentStart(context,
- arc,
- process,
- train,
- null,
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
+ {
+ _renderParentStart(context,
+ rc,
+ process,
+ train,
+ null,
_STATE_PARENT);
}
-
+
private void _renderParentStartRtl(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Train train) throws IOException
- {
- _renderParentStart(context,
- arc,
- process,
- train,
- _STATE_PARENT,
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Train train
+ ) throws IOException
+ {
+ _renderParentStart(context,
+ rc,
+ process,
+ train,
+ _STATE_PARENT,
null);
}
-
+
private void _renderStationContent(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- UIComponent stamp,
- Station station) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ UIComponent stamp,
+ Station station
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
-
+
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
-
+
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, "3", null);
-
+
String baseStyleClass = station.getBaseStyleClass();
-
+
List<String> stateStyleClasses = station.getStates();
stateStyleClasses.add(baseStyleClass);
stateStyleClasses.add(baseStyleClass + _SUFFIX_CONTENT);
- renderStyleClasses(context,
- arc,
+ renderStyleClasses(context,
+ rc,
stateStyleClasses.toArray(_EMPTY_STRING_ARRAY));
-
+
/* -= Simon =-
* FIXME HACK for MSIE CSS bug involving composite style classes.
* Since the bug is most obvious with join background images
* I hard code background-image to none to fix it.
* See Jira for issue ADFFACES-206.
*/
- if(arc.getAgent().getAgentName().equalsIgnoreCase(Agent.AGENT_IE))
+ if(rc.getAgent().getAgentName().equalsIgnoreCase(Agent.AGENT_IE))
{
- writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
- "background-image:none;",
+ writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
+ "background-image:none;",
null);
}
-
- Map<String, String> originalMap = arc.getSkinResourceKeyMap();
-
+
+ Map<String, String> originalMap = rc.getSkinResourceKeyMap();
+
// Init the model
process.setRowIndex(station.getRowIndex());
try
{
- arc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
+ rc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
encodeChild(context, stamp);
}
finally
{
- arc.setSkinResourceKeyMap(originalMap);
+ rc.setSkinResourceKeyMap(originalMap);
}
-
+
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
}
-
+
private void _renderStationIcon(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Station station,
- String leftJoinState,
- String rightJoinState,
- boolean overflowLeft,
- boolean overflowRight) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Station station,
+ String leftJoinState,
+ String rightJoinState,
+ boolean overflowLeft,
+ boolean overflowRight
+ ) throws IOException
{
// Add join
- _renderJoin(context, arc, leftJoinState, overflowLeft);
-
+ _renderJoin(context, rc, leftJoinState, overflowLeft);
+
// Icon cell
- _preRenderIconBlock(context, arc);
-
+ _preRenderIconBlock(context, rc);
+
// Add join
- _renderJoinIconBlock(context, arc, leftJoinState, overflowLeft);
-
+ _renderJoinIconBlock(context, rc, leftJoinState, overflowLeft);
+
// Add the parent's stop icon
- _renderStationIconBlock(context, arc, process, station);
-
+ _renderStationIconBlock(context, rc, process, station);
+
// Add join
- _renderJoinIconBlock(context, arc, rightJoinState, overflowRight);
-
+ _renderJoinIconBlock(context, rc, rightJoinState, overflowRight);
+
// End icon cell
_postRenderIconBlock(context);
-
+
// Add join
- _renderJoin(context, arc, rightJoinState, overflowRight);
+ _renderJoin(context, rc, rightJoinState, overflowRight);
}
-
+
private void _renderStationIconBlock(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Station station) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Station station
+ ) throws IOException
{
process.setRowIndex(station.getRowIndex());
String baseStyleClass = station.getBaseStyleClass();
-
- _renderIconBlock(context,
- arc,
- station.getIconNames(),
+
+ _renderIconBlock(context,
+ rc,
+ station.getIconNames(),
station.getLabel(),
baseStyleClass,
baseStyleClass + _SUFFIX_ICON_CELL,
station.getStates());
}
-
+
private void _renderStationIconLtr(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Station station) throws IOException
- {
- _renderStationIcon(context,
- arc,
- process,
- station,
- station.getStartJoinState(),
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Station station
+ ) throws IOException
+ {
+ _renderStationIcon(context,
+ rc,
+ process,
+ station,
+ station.getStartJoinState(),
station.getEndJoinState(),
station.hasPrevious() && station.getPrevious().isOverflowStart(),
station.hasNext() && station.getNext().isOverflowEnd());
}
-
+
private void _renderStationIconRtl(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- Station station) throws IOException
- {
- _renderStationIcon(context,
- arc,
- process,
- station,
- station.getEndJoinState(),
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ Station station
+ ) throws IOException
+ {
+ _renderStationIcon(context,
+ rc,
+ process,
+ station,
+ station.getEndJoinState(),
station.getStartJoinState(),
station.hasNext() && station.getNext().isOverflowEnd(),
station.hasPrevious() && station.getPrevious().isOverflowStart());
}
-
+
private void _renderTrain(
- FacesContext context,
- RenderingContext arc,
- UIXProcess process,
- FacesBean bean,
- UIComponent stamp,
- Train train) throws IOException
+ FacesContext context,
+ RenderingContext rc,
+ UIXProcess process,
+ FacesBean bean,
+ UIComponent stamp,
+ Train train
+ ) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
// Start of the icon row
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
-
- if(arc.isRightToLeft())
+
+ if(rc.isRightToLeft())
{
- _renderIconRowRtl(context, arc, process, train);
+ _renderIconRowRtl(context, rc, process, train);
}
else
{
- _renderIconRowLtr(context, arc, process, train);
+ _renderIconRowLtr(context, rc, process, train);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
// Start of the content row
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
-
- if(arc.isRightToLeft())
+
+ if(rc.isRightToLeft())
{
- _renderContentRowRtl(context, arc, process, stamp, train);
+ _renderContentRowRtl(context, rc, process, stamp, train);
}
else
{
- _renderContentRowLtr(context, arc, process, stamp, train);
+ _renderContentRowLtr(context, rc, process, stamp, train);
}
-
+
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
-
+
private static class Train
{
public Train(
- FacesContext context,
- RenderingContext arc,
+ FacesContext context,
+ RenderingContext arc,
UIXProcess process,
UIComponent stamp)
{
// Save the model state
int activeIndex = _loadStations(process, stamp);
int visibleStopCount = _getVisibleStopCount(arc);
-
+
_formName = arc.getFormData().getName();
_isSubTrain = _loadIsSubTrain(process);
-
+
if(!_stations.isEmpty())
{
// There's something visible in the train
@@ -942,42 +977,42 @@
// No overflow, yay!
_resolveStandard();
}
-
+
_initLabels(arc, process, stamp);
_initParentTrain(arc, process, stamp);
}
}
-
+
public Object getFocusRowKey()
{
return _focusRowKey;
}
-
+
public String getFormName()
{
return _formName;
}
-
+
public Object getInitialRowKey()
{
return _initialRowKey;
}
-
+
public ParentTrain getParentTrain()
{
return _parent;
}
-
+
public List<Station> getStations()
{
return _stations;
}
-
+
public boolean isSubTrain()
{
return _isSubTrain;
}
-
+
private void _createStation(
UIXProcess process,
UIComponent stamp,
@@ -989,23 +1024,23 @@
{
// The station will be visible.
_stations.add(new Station(this,
- stamp,
- index,
- process.getRowKey(),
+ stamp,
+ index,
+ process.getRowKey(),
active));
}
}
private int _getVisibleStopCount(RenderingContext arc)
{
- Object propValue =
+ Object propValue =
arc.getSkin().getProperty(SkinProperties.AF_TRAIN_VISIBLE_STOP_COUNT);
-
+
if(propValue == null)
{
return DEFAULT_MAX_VISIBLE_STOP_COUNT;
}
-
+
try
{
int count = Integer.parseInt(propValue.toString());
@@ -1014,7 +1049,7 @@
_LOG.warning("VISIBLE_STOP_COUNT_MUST_ABOVE_ZERO", count);
return DEFAULT_MAX_VISIBLE_STOP_COUNT;
}
-
+
return count;
}
catch(NumberFormatException e)
@@ -1023,9 +1058,9 @@
return DEFAULT_MAX_VISIBLE_STOP_COUNT;
}
}
-
+
private void _initLabels(
- RenderingContext arc,
+ RenderingContext arc,
UIXProcess process,
UIComponent stamp)
{
@@ -1035,9 +1070,9 @@
s.initLabel(arc, stamp);
}
}
-
+
private void _initParentTrain(
- RenderingContext arc,
+ RenderingContext arc,
UIXProcess process,
UIComponent stamp)
{
@@ -1057,7 +1092,7 @@
}
}
}
-
+
/**
* Determine if this train is a sub-train.
*/
@@ -1068,10 +1103,10 @@
{
return true;
}
-
+
return false;
}
-
+
private int _loadStations(
UIXProcess process,
UIComponent stamp)
@@ -1082,13 +1117,13 @@
// Set the model on the focus item
_focusRowKey = process.getFocusRowKey();
process.setRowKey(_focusRowKey);
-
+
int count = process.getRowCount();
int activeIndex = process.getRowIndex();
int index = 0;
-
+
assert activeIndex < count;
-
+
_stations = new ArrayList<Station>(count);
boolean bActiveStop = false;
@@ -1100,9 +1135,9 @@
if (bActiveStop)
{
// Might have an invisible active station. Thsi is weird, but still.
- // You never know what users want to do, but let support
- // it nevertheless for now.
- // selectedIndex is either the active station index or the index
+ // You never know what users want to do, but let support
+ // it nevertheless for now.
+ // selectedIndex is either the active station index or the index
// of the station just before the selected one if active is not visible.
activeIndex = _stations.size() - 1;
}
@@ -1115,7 +1150,7 @@
process.setRowKey(_initialRowKey);
}
}
-
+
private void _resolveOverflow(
int visibleStopCount,
int activeIndex)
@@ -1123,10 +1158,10 @@
assert _stations != null;
assert activeIndex >= -1;
assert activeIndex < _stations.size();
-
+
// First, resolve chaining
_resolveStandard();
-
+
// We have more stations than the max available, so we have an overflow
// for sure.
if(activeIndex <= 0)
@@ -1147,30 +1182,30 @@
startIndex = groupIndex * visibleStopCount - 1;
_resolveOverflowStart(startIndex);
}
-
+
int maxGroupIndex = (_stations.size() - 1) / visibleStopCount;
-
+
if(groupIndex < maxGroupIndex)
{
// We have a next overflow
int overflowIndex = (groupIndex + 1) * visibleStopCount;
-
+
// endIndex is exclusive
endIndex = overflowIndex + 1;
-
+
_resolveOverflowEnd(overflowIndex);
}
_stations = _stations.subList(startIndex, endIndex);
}
}
-
+
private void _resolveOverflowEnd(int index)
{
assert _stations != null;
assert index >= 0;
assert index < _stations.size();
-
+
Station station = _stations.get(index);
station.setOverflowEnd(true);
if(station.hasPrevious() && station.getPrevious().isDisabled())
@@ -1178,16 +1213,16 @@
// If previous stop is disabled, so is the overflow
station.setDisabled(true);
}
-
+
station.setNext(null);
}
-
+
private void _resolveOverflowStart(int index)
{
assert _stations != null;
assert index >= 0;
assert index < _stations.size();
-
+
Station station = _stations.get(index);
station.setOverflowStart(true);
if(station.hasNext() && station.getNext().isDisabled())
@@ -1195,22 +1230,22 @@
// If next stop is disabled, so is the overflow
station.setDisabled(true);
}
-
+
station.setPrevious(null);
}
-
+
private void _resolveStandard()
{
if(_stations.size() > 1)
{
Iterator<Station> iterator = _stations.iterator();
-
+
Station previous = null;
Station current = iterator.next();
Station next = iterator.next();
-
+
_updateStation(current, previous, next);
-
+
while(iterator.hasNext())
{
previous = current;
@@ -1218,24 +1253,24 @@
next = iterator.next();
_updateStation(current, previous, next);
}
-
+
next.setPrevious(current);
}
}
-
+
private boolean _shouldRenderParentTrain(RenderingContext arc)
{
- Object propValue =
+ Object propValue =
arc.getSkin().getProperty(SkinProperties.AF_TRAIN_RENDER_PARENT_TRAIN);
-
+
if(propValue == null)
{
return DEFAULT_RENDER_PARENT_TRAIN;
}
-
+
return Boolean.TRUE.equals(propValue);
}
-
+
private void _updateStation(
Station current,
Station previous,
@@ -1244,7 +1279,7 @@
current.setPrevious(previous);
current.setNext(next);
}
-
+
private Object _focusRowKey;
private String _formName;
private Object _initialRowKey;
@@ -1269,7 +1304,7 @@
_parentStart = false;
_train = train;
}
-
+
@SuppressWarnings("unchecked")
public Station(
Train train,
@@ -1279,7 +1314,7 @@
boolean active)
{
Map<String, Object> attributes = stamp.getAttributes();
-
+
_rowIndex = index;
_rowKey = rowKey;
_active = active;
@@ -1289,7 +1324,7 @@
_parentStart = false;
_train = train;
}
-
+
public String getBaseStyleClass()
{
if(isOverflowEnd())
@@ -1313,7 +1348,7 @@
return SkinSelectors.AF_TRAIN_STOP_STYLE_CLASS;
}
}
-
+
public String getEndJoinState()
{
if(isOverflowEnd())
@@ -1345,7 +1380,7 @@
return _STATE_UNVISITED;
}
}
-
+
public List<String> getIconNames()
{
if(isOverflowEnd())
@@ -1369,32 +1404,32 @@
return _getStopIconNames();
}
}
-
+
public String getLabel()
{
return _label;
}
-
+
public Station getNext()
{
return _next;
}
-
+
public Station getPrevious()
{
return _previous;
}
-
+
public int getRowIndex()
{
return _rowIndex;
}
-
+
public Object getRowKey()
{
return _rowKey;
}
-
+
public String getStartJoinState()
{
if(isOverflowStart())
@@ -1426,7 +1461,7 @@
return _STATE_UNVISITED;
}
}
-
+
public List<String> getStates()
{
List<String> states = new ArrayList<String>(5);
@@ -1434,7 +1469,7 @@
{
return states;
}
-
+
if(isActive())
{
states.add(_STATE_ACTIVE);
@@ -1448,20 +1483,20 @@
{
states.add(_STATE_UNVISITED);
}
-
+
if(isDisabled())
{
states.add(_STATE_READ_ONLY);
}
-
+
return states;
}
-
+
public boolean hasNext()
{
return _next != null;
}
-
+
public boolean hasPrevious()
{
return _previous != null;
@@ -1473,7 +1508,7 @@
* it is the text of the link or "Previous" or "More"
*/
public void initLabel(
- RenderingContext arc,
+ RenderingContext arc,
UIComponent stamp)
{
if(isOverflowStart())
@@ -1501,88 +1536,88 @@
}
}
}
-
+
public boolean isActive()
{
return _active;
}
-
+
public boolean isDisabled()
{
return _disabled;
}
-
+
public boolean isNextDisabled()
{
return hasNext() && _next.isDisabled();
}
-
+
public boolean isOverflowEnd()
{
return _overflowEnd;
}
-
+
public boolean isOverflowStart()
{
return _overflowStart;
}
-
+
public boolean isParentEnd()
{
return _parentEnd;
}
-
+
public boolean isParentStart()
{
return _parentStart;
}
-
+
public boolean isPreviousDisabled()
{
return hasPrevious() && _previous.isDisabled();
}
-
+
public boolean isVisited()
{
return _visited;
}
-
+
public void setDisabled(boolean disabled)
{
_disabled = disabled;
}
-
+
public void setNext(Station next)
{
_next = next;
}
-
+
public void setOverflowEnd(boolean overflowEnd)
{
_overflowEnd = overflowEnd;
}
-
+
public void setOverflowStart(boolean overflowStart)
{
_overflowStart = overflowStart;
_visited = true;
}
-
+
public void setParentEnd(boolean parentEnd)
{
_parentEnd = parentEnd;
}
-
+
public void setParentStart(boolean parentStart)
{
_parentStart = parentStart;
}
-
+
public void setPrevious(Station previous)
{
_previous = previous;
}
-
+
private boolean _getBooleanAttribute(
Map<String, Object> attributes,
String attributeName,
@@ -1593,7 +1628,7 @@
{
return defaultValue;
}
-
+
return Boolean.TRUE.equals(value);
}
@@ -1615,27 +1650,27 @@
altTextKey = _NEXT_KEY;
}
- String altText =
- XhtmlUtils.getFormattedString(arc.getTranslatedString(altTextKey),
+ String altText =
+ XhtmlUtils.getFormattedString(arc.getTranslatedString(altTextKey),
new String[]{text});
-
+
return altText;
}
-
+
private List<String> _getIconNames(String baseSelector)
{
LinkedList<String> names = new LinkedList<String>();
StringBuilder builder = new StringBuilder(64);
builder.append(baseSelector);
-
+
int suffixLength = SkinSelectors.ICON_SUFFIX.length();
int baseIndex = builder.length();
-
+
builder.append(SkinSelectors.ICON_SUFFIX);
names.addFirst(builder.toString());
builder.delete(baseIndex, baseIndex + suffixLength);
-
+
if(isActive())
{
builder.append(_SUFFIX_ACTIVE);
@@ -1648,14 +1683,14 @@
{
builder.append(_SUFFIX_UNVISITED);
}
-
+
baseIndex = builder.length();
-
+
builder.append(SkinSelectors.ICON_SUFFIX);
names.addFirst(builder.toString());
builder.delete(baseIndex, baseIndex + suffixLength);
-
+
if (isDisabled())
{
builder.append(_SUFFIX_READ_ONLY);
@@ -1664,22 +1699,22 @@
}
return names;
}
-
+
private List<String> _getOverflowEndIconNames()
{
return _getIconNames(SkinSelectors.AF_TRAIN_OVERFLOW_END_STYLE_CLASS);
}
-
+
private List<String> _getOverflowStartIconNames()
{
return _getIconNames(SkinSelectors.AF_TRAIN_OVERFLOW_START_STYLE_CLASS);
}
-
+
private List<String> _getStopIconNames()
{
return _getIconNames(SkinSelectors.AF_TRAIN_STOP_STYLE_CLASS);
}
-
+
private boolean _active; // Is this station the active one?
private boolean _disabled; // Disabled attribute
private boolean _overflowEnd; // Is this station the next step set link?
@@ -1687,19 +1722,19 @@
private boolean _parentEnd; // Is this station a parent end?
private boolean _parentStart; // Is this station a parent start?
private boolean _visited; // visited attribute
-
+
private int _rowIndex; // Row index
-
+
private Object _rowKey; // Row key
-
+
private String _label; // This station's label
-
+
private Station _next;
private Station _previous;
-
+
private Train _train;
}
-
+
private static class ParentTrain
{
public ParentTrain(
@@ -1710,10 +1745,10 @@
{
List<Station> stations = train.getStations();
int stationCount = stations.size();
-
+
boolean hasParentStart = !stations.get(0).isOverflowStart();
boolean hasParentEnd = !stations.get(stationCount - 1).isOverflowEnd();
-
+
if(hasParentStart || hasParentEnd)
{
Object parentStartRowKey = process.getContainerRowKey();
@@ -1725,9 +1760,9 @@
_parentStart.setParentStart(true);
_parentStart.initLabel(arc, stamp);
}
-
+
rowIndex = rowIndex + 1;
-
+
// Check if the parent has more steps, render it only if it does
hasParentEnd = rowIndex < process.getRowCount();
if(hasParentEnd)
@@ -1737,55 +1772,55 @@
_parentEnd.setParentEnd(true);
_parentEnd.initLabel(arc, stamp);
}
-
+
// Restore the model
process.setRowKey(train.getInitialRowKey());
}
}
-
+
public Station getParentEnd()
{
return _parentEnd;
}
-
+
public Station getParentStart()
{
return _parentStart;
}
-
+
public boolean hasParentEnd()
{
return _parentEnd != null;
}
-
+
public boolean hasParentStart()
{
return _parentStart != null;
}
-
+
private Station _parentEnd;
private Station _parentStart;
}
/**
- * Gives the amount of visible stops that get rendered by default if no
+ * Gives the amount of visible stops that get rendered by default if no
* amount is specified by the -tr-visible-stop-count skin property.
*/
public static final int DEFAULT_MAX_VISIBLE_STOP_COUNT = 6;
-
+
/**
- * Determines if the parent train of sub-trains should be rendered by
+ * Determines if the parent train of sub-trains should be rendered by
* default if not specified by the -tr-render-parent-train skin property.
*/
public static final boolean DEFAULT_RENDER_PARENT_TRAIN = false;
-
+
private static final String _STATE_ACTIVE = SkinSelectors.STATE_PREFIX + "Selected";
private static final String _STATE_DISABLED = SkinSelectors.STATE_PREFIX + "Disabled";
private static final String _STATE_PARENT = SkinSelectors.STATE_PREFIX + "Parent";
private static final String _STATE_READ_ONLY = SkinSelectors.STATE_PREFIX + "ReadOnly";
private static final String _STATE_UNVISITED = SkinSelectors.STATE_PREFIX + "Unvisited";
private static final String _STATE_VISITED = SkinSelectors.STATE_PREFIX + "Visited";
-
+
private static final String _SUFFIX_CONTENT = "-content";
private static final String _SUFFIX_ICON_CELL = "-icon-cell";
@@ -1804,18 +1839,18 @@
private static final String _MORE_KEY = "af_train.MORE";
private static final String _PREVIOUS_KEY = "af_train.PREVIOUS";
- private static final TrinidadLogger _LOG =
+ private static final TrinidadLogger _LOG =
TrinidadLogger.createTrinidadLogger(TrainRenderer.class);
-
+
private static final String[] _EMPTY_STRING_ARRAY;
-
+
private static final Map<String, String> _RESOURCE_KEY_MAP;
-
+
static
{
_EMPTY_STRING_ARRAY = new String[0];
-
- // Not adding the base link classes as before, those are a nuisance
+
+ // Not adding the base link classes as before, those are a nuisance
// while defining the skin since oyu cannot inhibit them as they're
// on the same level as the train selectors.
_RESOURCE_KEY_MAP = new TreeMap<String, String>();