You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2007/02/19 17:15:41 UTC
svn commit: r509235 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
example/demo/src/main/webapp/overview/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
Author: lofwyr
Date: Mon Feb 19 08:15:40 2007
New Revision: 509235
URL: http://svn.apache.org/viewvc?view=rev&rev=509235
Log:
TOBAGO-292: "tip" attribute for tc:column to display a title on the header-elements.
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java
myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheet.jsp
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTag.java?view=diff&rev=509235&r1=509234&r2=509235
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTag.java Mon Feb 19 08:15:40 2007
@@ -19,6 +19,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SORTABLE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIColumn;
@@ -31,6 +32,7 @@
private String sortable;
private String align;
private String markup;
+ private String tip;
public String getComponentType() {
return UIColumn.COMPONENT_TYPE;
@@ -45,6 +47,7 @@
sortable = null;
align = null;
markup = null;
+ tip = null;
}
protected void setProperties(UIComponent component) {
@@ -52,6 +55,7 @@
ComponentUtil.setBooleanProperty(component, ATTR_SORTABLE, sortable);
ComponentUtil.setStringProperty(component, ATTR_ALIGN, align);
ComponentUtil.setMarkup(component, markup);
+ ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
}
public void setMarkup(String markup) {
@@ -70,9 +74,11 @@
return sortable;
}
-
public void setSortable(String sortable) {
this.sortable = sortable;
}
-}
+ public void setTip(String tip) {
+ this.tip = tip;
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java?view=diff&rev=509235&r1=509234&r2=509235
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java Mon Feb 19 08:15:40 2007
@@ -23,6 +23,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
+import org.apache.myfaces.tobago.taglib.decl.HasTip;
/*
* Created by IntelliJ IDEA.
@@ -38,7 +39,7 @@
@Tag(name = "column")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIColumn")
-public interface ColumnTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered, HasLabel {
+public interface ColumnTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered, HasLabel, HasTip {
/**
* Alignment of this column.
*/
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheet.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheet.jsp?view=diff&rev=509235&r1=509234&r2=509235
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheet.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheet.jsp Mon Feb 19 08:15:40 2007
@@ -113,7 +113,7 @@
</tc:toolBar>
</f:facet>
- <tc:sheet value="#{demo.solarList}" id="sheet"
+ <tc:sheet value="#{demo.solarList}" id="sheet"
columns="3*;1*;3*;3*;3*;3*" var="luminary"
state="#{demo.sheetState}"
showHeader="#{overviewController.sheetConfig.sheetShowHeader}"
@@ -126,13 +126,16 @@
stateChangeListener="#{demo.stateChangeListener}"
sortActionListener="#{overviewController.sheetSorter}"
selectable="#{overviewController.sheetConfig.selectable}">
+<%--
<f:facet name="reload">
<tc:reload frequency="5000"/>
</f:facet>
+--%>
<tc:column label="#{overviewBundle.solarArrayName}" id="name" sortable="true">
<tc:out value="#{luminary.name}" id="t_name"/>
</tc:column>
- <tc:column label="#{overviewBundle.solarArrayNumber}" id="number" sortable="false" align="center">
+ <tc:column label="#{overviewBundle.solarArrayNumber}" id="number" sortable="false"
+ tip="#{overviewBundle.solarArrayNumberTip}" align="center">
<tc:out value="#{luminary.number}" id="t_number"/>
</tc:column>
<tc:column label="#{overviewBundle.solarArrayOrbit}" sortable="true" id="orbit">
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?view=diff&rev=509235&r1=509234&r2=509235
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Mon Feb 19 08:15:40 2007
@@ -26,6 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.commons.lang.StringUtils;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
@@ -47,6 +48,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_BODY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_HEADER;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST_STRING;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUPOPUP;
@@ -766,15 +768,17 @@
String sheetId = component.getClientId(facesContext);
Application application = facesContext.getApplication();
- List columnWidths
- = (List) component.getAttributes().get(ATTR_WIDTH_LIST);
+ List columnWidths = (List) component.getAttributes().get(ATTR_WIDTH_LIST);
String divWidth = "width: " + columnWidths.get(columnCount) + "px;";
-
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(sheetId + "_header_box_" + columnCount);
writer.writeClassAttribute("tobago-sheet-header-box");
writer.writeAttribute(HtmlAttributes.STYLE, divWidth, null);
+ String tip = (String) column.getAttributes().get(ATTR_TIP);
+ if (tip == null) {
+ tip = "";
+ }
// ############################################
// ############################################
@@ -782,41 +786,34 @@
String sorterImage = null;
String sorterClass = "";
String sortTitle = "";
- boolean sortable =
- ComponentUtil.getBooleanAttribute(column,
- ATTR_SORTABLE);
+ boolean sortable = ComponentUtil.getBooleanAttribute(column, ATTR_SORTABLE);
if (sortable && !(column instanceof UIColumnSelector)) {
UICommand sortCommand = (UICommand) column.getFacet(UIData.FACET_SORTER);
if (sortCommand == null) {
String columnId = column.getClientId(facesContext);
- String sorterId = columnId.substring(columnId.lastIndexOf(":") + 1)
- + "_" + UIData.SORTER_ID;
- sortCommand
- = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
+ String sorterId = columnId.substring(columnId.lastIndexOf(":") + 1) + "_" + UIData.SORTER_ID;
+ sortCommand = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
sortCommand.setRendererType(RENDERER_TYPE_LINK);
sortCommand.setId(sorterId);
column.getFacets().put(UIData.FACET_SORTER, sortCommand);
}
- String onclick = "Tobago.submitAction('"
- + sortCommand.getClientId(facesContext) + "')";
+ String onclick = "Tobago.submitAction('" + sortCommand.getClientId(facesContext) + "')";
writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, null);
- writer.writeAttribute(HtmlAttributes.TITLE,
- ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
- "sheetTipSorting"),
- null);
+ if (StringUtils.isNotEmpty(tip)) {
+ tip += " - ";
+ }
+ tip += ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "sheetTipSorting");
SheetState sheetState = component.getSheetState(facesContext);
if (column.getId().equals(sheetState.getSortedColumnId())) {
if (sheetState.isAscending()) {
sorterImage = ascending;
- sortTitle = ResourceManagerUtil.getPropertyNotNull(facesContext,
- "tobago", "sheetAscending");
+ sortTitle = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "sheetAscending");
} else {
sorterImage = descending;
- sortTitle = ResourceManagerUtil.getPropertyNotNull(facesContext,
- "tobago", "sheetDescending");
+ sortTitle = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "sheetDescending");
}
}
sorterClass = " tobago-sheet-header-sortable";
@@ -825,8 +822,9 @@
// ############################################
// ############################################
- String align
- = (String) column.getAttributes().get(ATTR_ALIGN);
+ writer.writeAttribute(HtmlAttributes.TITLE, tip, null);
+
+ String align = (String) column.getAttributes().get(ATTR_ALIGN);
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(sheetId + "_header_outer_" + columnCount);
@@ -840,10 +838,8 @@
resizerClass = "tobago-sheet-header-resize";
renderColumnSelectorHeader(facesContext, writer, component, column);
} else {
- resizerClass =
- "tobago-sheet-header-resize tobago-sheet-header-resize-cursor";
- renderColumnHeaderLabel(facesContext, writer, column, sortMarkerWidth, align,
- image1x1);
+ resizerClass = "tobago-sheet-header-resize tobago-sheet-header-resize-cursor";
+ renderColumnHeaderLabel(facesContext, writer, column, sortMarkerWidth, align, image1x1);
}
writer.endElement(HtmlConstants.DIV);