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 2009/11/12 19:23:56 UTC
svn commit: r835483 [2/2] - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/ajax/api/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/config/
core/src/main/java/org/apache/myfa...
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java Thu Nov 12 18:23:51 2009
@@ -18,7 +18,7 @@
*/
/**
- * @deprecated The Cell is deprecated since Tobago 1.1
+ * @deprecated The Cell is deprecated since Tobago 1.5.0
*/
@Deprecated
public class CellRenderer extends PanelRenderer {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java Thu Nov 12 18:23:51 2009
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
/*
* Date: Jul 22, 2007
* Time: 9:32:22 PM
*/
-public class ColumnRenderer extends LayoutableRendererBase {
+public class ColumnRenderer extends LayoutComponentRendererBase {
public boolean getRendersChildren() {
return true;
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnSelectorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnSelectorRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnSelectorRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnSelectorRenderer.java Thu Nov 12 18:23:51 2009
@@ -17,12 +17,12 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
/**
* User: weber
* Date: Jul 11, 2005
* Time: 3:32:17 PM
*/
-public class ColumnSelectorRenderer extends LayoutableRendererBase {
+public class ColumnSelectorRenderer extends LayoutComponentRendererBase {
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Thu Nov 12 18:23:51 2009
@@ -40,7 +40,6 @@
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.event.PopupActionListener;
import org.apache.myfaces.tobago.layout.Measure;
-import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.util.DateFormatUtils;
@@ -50,11 +49,12 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
-import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
import java.io.IOException;
import java.util.Map;
import java.util.TimeZone;
+import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
+
public class DatePickerRenderer extends LinkRenderer {
private static final Log LOG = LogFactory.getLog(DatePickerRenderer.class);
public static final String CLOSE_POPUP = "closePopup";
@@ -186,13 +186,15 @@
public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ // todo: use Measure instead of int
component.getAttributes().put(
- Attributes.LAYOUT_WIDTH, ThemeConfig.getValue(facesContext, component, "pickerWidth"));
+ Attributes.LAYOUT_WIDTH,
+ ThemeConfig.getMeasure(facesContext, component.getRendererType(), "pickerWidth").getPixel());
if (facesContext instanceof TobagoFacesContext) {
UIPopup popup = (UIPopup) component.getFacets().get(Facets.PICKER_POPUP);
if (popup != null) {
- popup.setWidth(new PixelMeasure(ThemeConfig.getValue(facesContext, component, "CalendarPopupWidth")));
- popup.setHeight(new PixelMeasure(ThemeConfig.getValue(facesContext, component, "CalendarPopupHeight")));
+ popup.setWidth(ThemeConfig.getMeasure(facesContext, component.getRendererType(), "CalendarPopupWidth"));
+ popup.setHeight(ThemeConfig.getMeasure(facesContext, component.getRendererType(), "CalendarPopupHeight"));
((TobagoFacesContext) facesContext).getPopups().add(popup);
}
}
@@ -262,7 +264,7 @@
if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
UITime time = (UITime) timePanel.findComponent("time");
Measure popupHeight = popup.getHeight();
- popupHeight.add(ThemeConfig.getMeasure(facesContext, time.getRendererType(), "preferredHeight"));
+ popupHeight = popupHeight.add(ThemeConfig.getMeasure(facesContext, time.getRendererType(), "preferredHeight"));
popup.setHeight(popupHeight);
DateTimeConverter dateTimeConverter
= (DateTimeConverter) facesContext.getApplication().createConverter(CONVERTER_ID);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java Thu Nov 12 18:23:51 2009
@@ -17,14 +17,10 @@
* limitations under the License.
*/
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.UIGridLayout;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
@@ -34,7 +30,7 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class GridLayoutRenderer extends DefaultLayoutRenderer {
+public class GridLayoutRenderer extends RendererBase {
private static final Log LOG = LogFactory.getLog(GridLayoutRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java Thu Nov 12 18:23:51 2009
@@ -28,7 +28,7 @@
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIImage;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -41,7 +41,7 @@
import java.io.IOException;
import java.util.Locale;
-public class ImageRenderer extends LayoutableRendererBase {
+public class ImageRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(ImageRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java Thu Nov 12 18:23:51 2009
@@ -22,7 +22,7 @@
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.UILabel;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -38,7 +38,7 @@
import java.io.IOException;
import java.util.Locale;
-public class LabelRenderer extends LayoutableRendererBase {
+public class LabelRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(LabelRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Thu Nov 12 18:23:51 2009
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
@@ -39,7 +38,7 @@
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
@@ -65,7 +64,9 @@
import java.util.Map;
import java.util.StringTokenizer;
-public class MenuBarRenderer extends LayoutableRendererBase {
+import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+
+public class MenuBarRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(MenuBarRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java Thu Nov 12 18:23:51 2009
@@ -40,7 +40,7 @@
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.layout.PixelMeasure;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -57,7 +57,7 @@
import java.util.Iterator;
import java.util.Map;
-public class MessagesRenderer extends LayoutableRendererBase {
+public class MessagesRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(MessagesRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ObjectRenderer.java Thu Nov 12 18:23:51 2009
@@ -20,7 +20,7 @@
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIObject;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -31,7 +31,7 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class ObjectRenderer extends LayoutableRendererBase {
+public class ObjectRenderer extends LayoutComponentRendererBase {
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
UIObject object = (UIObject) component;
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java Thu Nov 12 18:23:51 2009
@@ -18,7 +18,7 @@
*/
import org.apache.myfaces.tobago.component.UIOut;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -30,7 +30,7 @@
import java.io.IOException;
import java.util.StringTokenizer;
-public class OutRenderer extends LayoutableRendererBase {
+public class OutRenderer extends LayoutComponentRendererBase {
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java Thu Nov 12 18:23:51 2009
@@ -31,7 +31,7 @@
import org.apache.myfaces.tobago.component.UIPanel;
import org.apache.myfaces.tobago.component.UIReload;
import org.apache.myfaces.tobago.config.TobagoConfig;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -43,7 +43,7 @@
import javax.faces.context.ResponseWriter;
import java.io.IOException;
-public class PanelRenderer extends LayoutableRendererBase implements AjaxRenderer {
+public class PanelRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
private static final Log LOG = LogFactory.getLog(PanelRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java Thu Nov 12 18:23:51 2009
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.Attributes;
@@ -33,7 +32,7 @@
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
@@ -46,7 +45,9 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class PopupRenderer extends LayoutableRendererBase implements AjaxRenderer {
+import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+
+public class PopupRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
@SuppressWarnings({"UnusedDeclaration"})
private static final Log LOG = LogFactory.getLog(PopupRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java Thu Nov 12 18:23:51 2009
@@ -28,7 +28,7 @@
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIProgress;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
@@ -41,7 +41,7 @@
import javax.swing.DefaultBoundedRangeModel;
import java.io.IOException;
-public class ProgressRenderer extends LayoutableRendererBase {
+public class ProgressRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(ProgressRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java Thu Nov 12 18:23:51 2009
@@ -21,7 +21,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UISelectBooleanCheckbox;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -35,7 +35,7 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class SelectBooleanCheckboxRenderer extends LayoutableRendererBase {
+public class SelectBooleanCheckboxRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(SelectBooleanCheckboxRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectItemsRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectItemsRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectItemsRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectItemsRenderer.java Thu Nov 12 18:23:51 2009
@@ -22,9 +22,9 @@
* $Id$
*/
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
-public class SelectItemsRenderer extends LayoutableRendererBase {
+public class SelectItemsRenderer extends LayoutComponentRendererBase {
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectReferenceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectReferenceRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectReferenceRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectReferenceRenderer.java Thu Nov 12 18:23:51 2009
@@ -25,14 +25,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class SelectReferenceRenderer extends LayoutableRendererBase {
+public class SelectReferenceRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(SelectReferenceRenderer.class);
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?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- 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 Thu Nov 12 18:23:51 2009
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.Attributes;
@@ -34,7 +33,6 @@
import org.apache.myfaces.tobago.component.UIColumnSelector;
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIData;
-import static org.apache.myfaces.tobago.component.UIData.NONE;
import org.apache.myfaces.tobago.component.UIMenu;
import org.apache.myfaces.tobago.component.UIMenuCommand;
import org.apache.myfaces.tobago.component.UIReload;
@@ -52,7 +50,7 @@
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.model.SheetState;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Position;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -80,7 +78,10 @@
import java.util.Locale;
import java.util.Map;
-public class SheetRenderer extends LayoutableRendererBase implements AjaxRenderer {
+import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+import static org.apache.myfaces.tobago.component.UIData.NONE;
+
+public class SheetRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
private static final Log LOG = LogFactory.getLog(SheetRenderer.class);
@@ -96,7 +97,7 @@
super.prepareRender(facesContext, component);
if (facesContext instanceof TobagoFacesContext) {
((TobagoFacesContext) facesContext).getScriptFiles().add(SCRIPTS[0]);
- }
+ }
}
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
@@ -105,7 +106,7 @@
UIData data = (UIData) uiComponent;
Style style = new Style(facesContext, data);
-
+
ensureColumnWidthList(facesContext, data, style);
final String sheetId = data.getClientId(facesContext);
@@ -135,7 +136,7 @@
dblClickAction = action;
}
}
- }
+ }
} else if (child instanceof UIColumnSelector) {
columnSelectorIndex = i;
}
@@ -163,10 +164,10 @@
final String[] cmds = {
"new Tobago.Sheet(\"" + sheetId + "\", " + ajaxEnabled
+ ", \"" + checked + "\", \"" + unchecked + "\", \"" + data.getSelectable()
- + "\", " + columnSelectorIndex + ", "+ frequency
- + ", " + (clickAction!=null? HtmlRendererUtils.getJavascriptString(clickAction.getId()):null)
+ + "\", " + columnSelectorIndex + ", " + frequency
+ + ", " + (clickAction != null ? HtmlRendererUtils.getJavascriptString(clickAction.getId()) : null)
+ ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, clickAction)
- + ", " + (dblClickAction!=null? HtmlRendererUtils.getJavascriptString(dblClickAction.getId()):null)
+ + ", " + (dblClickAction != null ? HtmlRendererUtils.getJavascriptString(dblClickAction.getId()) : null)
+ ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, dblClickAction)
+ ");"
};
@@ -174,7 +175,7 @@
HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
}
- private void renderSheet(FacesContext facesContext, UIData data, boolean hasClickAction, Style style)
+ private void renderSheet(FacesContext facesContext, UIData data, boolean hasClickAction, Style style)
throws IOException {
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
@@ -189,15 +190,15 @@
//Style headerStyle = (Style) attributes.get(STYLE_HEADER);
// String sheetWidthString = LayoutUtils.getStyleAttributeValue(style,
// "width");
- Integer sheetHeight;
+ Measure sheetHeight;
if (style.getHeight() == null) {
// FIXME: nullpointer if height not defined
LOG.error("no height in parent container, setting to 100");
- sheetHeight = 100;
+ sheetHeight = new PixelMeasure(100);
} else {
- sheetHeight = style.getHeight().getPixel();
+ sheetHeight = style.getHeight();
}
- int footerHeight = (Integer) data.getAttributes().get(Attributes.FOOTER_HEIGHT);
+ Measure footerHeight = (Measure) data.getAttributes().get(Attributes.FOOTER_HEIGHT);
String selectable = data.getSelectable();
@@ -249,7 +250,7 @@
writer.writeStyleAttribute(new Style());
int columnCount = 0;
- final int sortMarkerWidth = getAscendingMarkerWidth(facesContext, data);
+ Measure sortMarkerWidth = getAscendingMarkerWidth(facesContext, data);
String imageAscending = contextPath + resourceManager.getImage(viewRoot, "image/ascending.gif");
String imageDescending = contextPath + resourceManager.getImage(viewRoot, "image/descending.gif");
String img = resourceManager.getImage(viewRoot, "image/unsorted.gif", true);
@@ -282,8 +283,8 @@
Style bodyStyle = new Style();
bodyStyle.setPosition(Position.RELATIVE);
bodyStyle.setWidth(data.getWidth());
- bodyStyle.setHeight(new PixelMeasure(sheetHeight - footerHeight));
-
+ bodyStyle.setHeight(sheetHeight.subtract(footerHeight));
+
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(sheetId + "_data_div");
writer.writeClassAttribute("tobago-sheet-body-div ");
@@ -304,7 +305,6 @@
sheetBodyStyle.setHeight(null);
-
writer.startElement(HtmlConstants.TABLE, null);
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
@@ -455,11 +455,11 @@
|| isValidPagingValue(showPageRange)
|| isValidPagingValue(showDirectLinks)) {
Style footerStyle = new Style(bodyStyle);
- footerStyle.setHeight(new PixelMeasure(footerHeight));
- footerStyle.setTop(new PixelMeasure(sheetHeight - footerHeight));
+ footerStyle.setHeight(footerHeight);
+ footerStyle.setTop(sheetHeight.subtract(footerHeight));
- // "height", MessageFormat.format("{0}px", footerHeight));
- // + " top: " + (sheetHeight - footerHeight) + "px;";
+ // "height", MessageFormat.format("{0}px", footerHeight));
+ // + " top: " + (sheetHeight - footerHeight) + "px;";
writer.startElement(HtmlConstants.DIV, data);
writer.writeClassAttribute("tobago-sheet-footer");
@@ -537,7 +537,7 @@
writer.endElement(HtmlConstants.SPAN);
boolean atEnd = data.isAtEnd();
link(facesContext, application, atEnd, PageAction.NEXT, data);
- link(facesContext, application, atEnd||!data.hasRowCount(), PageAction.LAST, data);
+ link(facesContext, application, atEnd || !data.hasRowCount(), PageAction.LAST, data);
writer.endElement(HtmlConstants.SPAN);
}
@@ -546,7 +546,7 @@
}
private String createSheetPagingInfo(UIData data,
- FacesContext facesContext, String pagerCommandId, boolean row) {
+ FacesContext facesContext, String pagerCommandId, boolean row) {
String sheetPagingInfo;
if (data.getRowCount() > 0) {
Locale locale = facesContext.getViewRoot().getLocale();
@@ -646,40 +646,37 @@
int first = data.getFirst();
int rows = Math.min(data.getRowCount(), first + data.getRows()) - first;
LOG.error("20; // FIXME: make dynamic (was removed by changing the layouting");
- int heightNeeded = 20 // FIXME: make dynamic (was removed by changing the layouting
- + getFooterHeight(facesContext, data)
- + (rows * (20 /* FIXME */ + getRowPadding(facesContext, data)));
-
- return heightNeeded > style.getHeight().getPixel();
+ Measure heightNeeded = getFooterHeight(facesContext, data)
+ .add(getRowPadding(facesContext, data).add(20/*fixme*/).multiply(rows))
+ .add(20); // FIXME: make dynamic (was removed by changing the layouting
+ return heightNeeded.greaterThan(style.getHeight());
} else {
return false;
}
}
- private int getRowPadding(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getValue(facesContext, component, "rowPadding");
+ private Measure getRowPadding(FacesContext facesContext, UIComponent component) {
+ return ThemeConfig.getMeasure(facesContext, component.getRendererType(), "rowPadding");
}
private Measure getScrollbarWidth(FacesContext facesContext, UIComponent component) {
- // todo: get measure directly from theme config
- return new PixelMeasure(ThemeConfig.getValue(facesContext, component, "scrollbarWidth"));
+ return ThemeConfig.getMeasure(facesContext, component.getRendererType(), "scrollbarWidth");
}
- private void storeFooterHeight(FacesContext facesContext,
- UIComponent component) {
- component.getAttributes().put(Attributes.FOOTER_HEIGHT,
- getFooterHeight(facesContext, component));
+ private void storeFooterHeight(FacesContext facesContext, UIComponent component) {
+ component.getAttributes().put(Attributes.FOOTER_HEIGHT, getFooterHeight(facesContext, component));
}
- private int getFooterHeight(FacesContext facesContext, UIComponent component) {
- int footerHeight;
+ private Measure getFooterHeight(FacesContext facesContext, UIComponent component) {
+ // todo: use Measure instead of int
+ Measure footerHeight;
if (isValidPagingAttribute((UIData) component, Attributes.SHOW_ROW_RANGE)
|| isValidPagingAttribute((UIData) component, Attributes.SHOW_PAGE_RANGE)
|| isValidPagingAttribute((UIData) component, Attributes.SHOW_DIRECT_LINKS)) {
footerHeight =
- ThemeConfig.getValue(facesContext, component, "footerHeight");
+ ThemeConfig.getMeasure(facesContext, component.getRendererType(), "footerHeight");
} else {
- footerHeight = 0;
+ footerHeight = PixelMeasure.ZERO;
}
return footerHeight;
}
@@ -706,9 +703,8 @@
|| "right".equals(value);
}
- private int getAscendingMarkerWidth(FacesContext facesContext,
- UIComponent component) {
- return ThemeConfig.getValue(facesContext, component, "ascendingMarkerWidth");
+ private Measure getAscendingMarkerWidth(FacesContext facesContext, UIComponent component) {
+ return ThemeConfig.getMeasure(facesContext, component.getRendererType(), "ascendingMarkerWidth");
}
public boolean getRendersChildren() {
@@ -728,9 +724,9 @@
}
private void link(FacesContext facesContext, Application application,
- boolean disabled, PageAction command, UIData data)
+ boolean disabled, PageAction command, UIData data)
throws IOException {
- UICommand link= createPagingCommand(application, command, disabled);
+ UICommand link = createPagingCommand(application, command, disabled);
data.getFacets().put(command.getToken(), link);
@@ -758,9 +754,9 @@
}
private void renderColumnHeader(FacesContext facesContext,
- TobagoResponseWriter writer, UIData component,
- int columnIndex, UIColumn column, String imageAscending, String imageDescending, String imageUnsorted,
- String image1x1, int sortMarkerWidth) throws IOException {
+ TobagoResponseWriter writer, UIData component,
+ int columnIndex, UIColumn column, String imageAscending, String imageDescending, String imageUnsorted,
+ String image1x1, Measure sortMarkerWidth) throws IOException {
String sheetId = component.getClientId(facesContext);
Application application = facesContext.getApplication();
@@ -798,7 +794,7 @@
writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, false);
if (org.apache.commons.lang.StringUtils.isNotEmpty(tip)) {
- tip += " - ";
+ tip += " - ";
}
tip += ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "sheetTipSorting");
@@ -827,7 +823,7 @@
//if (columnIndex == 0) {
// writer.writeClassAttribute("tobago-sheet-header"+ sorterClass + " tobago-sheet-header-first-column");
//} else {
- writer.writeClassAttribute("tobago-sheet-header" + sorterClass);
+ writer.writeClassAttribute("tobago-sheet-header" + sorterClass);
//}
if (align != null) {
writer.writeStyleAttribute("text-align: " + align + ";");
@@ -879,7 +875,7 @@
protected void renderColumnSelectorHeader(FacesContext facesContext,
- TobagoResponseWriter writer, UIData component, UIColumn column)
+ TobagoResponseWriter writer, UIData component, UIColumn column)
throws IOException {
UIPanel menu = (UIPanel) column.getFacet(Facets.MENUPOPUP);
if (menu == null) {
@@ -926,7 +922,7 @@
}
private UIMenuCommand createMenuItem(final Application application, String label,
- String action) {
+ String action) {
UIMenuCommand menuItem
= (UIMenuCommand) application.createComponent(UIMenuCommand.COMPONENT_TYPE);
menuItem.setRendererType(RendererTypes.MENU_COMMAND);
@@ -935,10 +931,9 @@
return menuItem;
}
- private void renderColumnHeaderLabel(FacesContext facesContext,
- TobagoResponseWriter writer, UIColumn column,
- int sortMarkerWidth, String align,
- String image1x1) throws IOException {
+ private void renderColumnHeaderLabel(
+ FacesContext facesContext, TobagoResponseWriter writer, UIColumn column,
+ Measure sortMarkerWidth, String align, String image1x1) throws IOException {
String label = (String) column.getAttributes().get(Attributes.LABEL);
if (label != null) {
writer.writeText(label, null);
@@ -946,7 +941,7 @@
writer.startElement(HtmlConstants.IMG, null);
writer.writeAttribute(HtmlAttributes.SRC, image1x1, false);
writer.writeAttribute(HtmlAttributes.ALT, "", false);
- writer.writeAttribute(HtmlAttributes.WIDTH, sortMarkerWidth);
+ writer.writeAttribute(HtmlAttributes.WIDTH, sortMarkerWidth.toString(), false);
writer.writeAttribute(HtmlAttributes.HEIGHT, 1);
writer.endElement(HtmlConstants.IMG);
}
@@ -1054,7 +1049,7 @@
}
private UICommand createPagingCommand(Application application,
- PageAction command, boolean disabled) {
+ PageAction command, boolean disabled) {
UICommand link;
link = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
link.setRendererType(RendererTypes.SHEET_PAGE_COMMAND);
@@ -1066,7 +1061,7 @@
}
private void writeLinkElement(TobagoResponseWriter writer, String str, String skip,
- String id, String hrefPostfix, boolean makeLink)
+ String id, String hrefPostfix, boolean makeLink)
throws IOException {
String type = makeLink ? HtmlConstants.A : HtmlConstants.SPAN;
writer.startElement(type, null);
@@ -1082,15 +1077,14 @@
}
private Measure getContentBorder(FacesContext facesContext, UIData data) {
- // todo: get measure directly from theme config
- return new PixelMeasure(ThemeConfig.getValue(facesContext, data, "contentBorder"));
+ return ThemeConfig.getMeasure(facesContext, data.getRendererType(), "contentBorder");
}
public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
-
- UIData data = (UIData) component;
+
+ UIData data = (UIData) component;
Style style = new Style(facesContext, data);
-
+
AjaxUtils.checkParamValidity(facesContext, data, UIData.class);
// TODO find a better way
UICommand clickAction = null;
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SubviewRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SubviewRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SubviewRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SubviewRenderer.java Thu Nov 12 18:23:51 2009
@@ -24,13 +24,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class SubviewRenderer extends LayoutableRendererBase {
+public class SubviewRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(SubviewRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Thu Nov 12 18:23:51 2009
@@ -33,8 +33,6 @@
import org.apache.myfaces.tobago.component.UIPanelBase;
import org.apache.myfaces.tobago.component.UITab;
import org.apache.myfaces.tobago.component.UITabGroup;
-import static org.apache.myfaces.tobago.component.UITabGroup.SWITCH_TYPE_CLIENT;
-import static org.apache.myfaces.tobago.component.UITabGroup.SWITCH_TYPE_RELOAD_TAB;
import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.config.TobagoConfig;
@@ -45,7 +43,7 @@
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Overflow;
import org.apache.myfaces.tobago.renderkit.css.Position;
import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -68,7 +66,10 @@
import java.util.List;
import java.util.Map;
-public class TabGroupRenderer extends LayoutableRendererBase implements AjaxRenderer {
+import static org.apache.myfaces.tobago.component.UITabGroup.SWITCH_TYPE_CLIENT;
+import static org.apache.myfaces.tobago.component.UITabGroup.SWITCH_TYPE_RELOAD_TAB;
+
+public class TabGroupRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
private static final Log LOG = LogFactory.getLog(TabGroupRenderer.class);
@@ -136,11 +137,11 @@
int virtualTab = 0;
Measure currentWidth = PixelMeasure.ZERO;
- Measure navigationBarWidth = ThemeConfig.getMeasure(facesContext, tabGroup, "navigationBarWidth");
+ Measure navigationBarWidth = ThemeConfig.getMeasure(facesContext, tabGroup.getRendererType(), "navigationBarWidth");
for (UIComponent tab : (List<UIComponent>) tabGroup.getChildren()) {
if (tab instanceof UIPanelBase) {
if (tab.isRendered()) {
- currentWidth.add(tabList.getWidthList().get(virtualTab));
+ currentWidth = currentWidth.add(tabList.getWidthList().get(virtualTab));
if (SWITCH_TYPE_CLIENT.equals(switchType) || virtualTab == activeIndex) {
if (virtualTab != activeIndex) {
tabGroup.setDisplay(Display.NONE);
@@ -179,10 +180,10 @@
}
}
- private Integer getCurrentWidth(TabList tabs, int tabIndex) {
- int currentWidth = 0;
+ private Measure getCurrentWidth(TabList tabs, int tabIndex) {
+ Measure currentWidth = PixelMeasure.ZERO;
for (int i = 0; i <= tabIndex; i++) {
- currentWidth += tabs.getWidthList().get(i);
+ currentWidth = currentWidth.add(tabs.getWidthList().get(i));
}
return currentWidth;
}
@@ -190,7 +191,9 @@
private TabList getTabList(FacesContext facesContext, UITabGroup component) {
TabList tabs = new TabList();
int index = 0;
- int tabLabelExtraWidth = ThemeConfig.getValue(facesContext, component, "tabLabelExtraWidth");
+ // todo: use Measure instead of int
+ int tabLabelExtraWidth
+ = ThemeConfig.getMeasure(facesContext, component.getRendererType(), "tabLabelExtraWidth").getPixel();
boolean first = true;
for (UIComponent child : (List<UIComponent>) component.getChildren()) {
@@ -200,10 +203,10 @@
LabelWithAccessKey label = new LabelWithAccessKey(tab);
if (label.getText() != null) {
tabs.getWidthList().add(RenderUtil.calculateStringWidth2(facesContext, component, label.getText())
- + tabLabelExtraWidth);
+ .add(tabLabelExtraWidth));
} else {
tabs.getWidthList().add(RenderUtil.calculateStringWidth2(facesContext,
- component, Integer.toString(index + 1)) + tabLabelExtraWidth);
+ component, Integer.toString(index + 1)).add(tabLabelExtraWidth));
}
if (first) {
tabs.firstIndex = index;
@@ -211,7 +214,7 @@
}
tabs.lastIndex = index;
} else {
- tabs.getWidthList().add(0);
+ tabs.getWidthList().add(PixelMeasure.ZERO);
}
index++;
}
@@ -273,7 +276,7 @@
writer.startElement(HtmlConstants.TD, tabGroup);
Measure width = tabGroup.getWidth();
- Measure headerHeight = ThemeConfig.getMeasure(facesContext, tabGroup, "headerHeight");
+ Measure headerHeight = ThemeConfig.getMeasure(facesContext, tabGroup.getRendererType(), "headerHeight");
Style header = new Style();
header.setPosition(Position.RELATIVE);
header.setWidth(width);
@@ -302,9 +305,9 @@
writer.writeStyleAttribute(header);
writer.startElement(HtmlConstants.COLGROUP, tabGroup);
- for (Integer colWidth : tabList.getWidthList()) {
+ for (Measure colWidth : tabList.getWidthList()) {
writer.startElement(HtmlConstants.COL, tabGroup);
- writer.writeAttribute(HtmlAttributes.WIDTH, colWidth);
+ writer.writeAttribute(HtmlAttributes.WIDTH, colWidth.toString(), false);
writer.endElement(HtmlConstants.COL);
}
writer.endElement(HtmlConstants.COLGROUP);
@@ -392,7 +395,7 @@
innerClass.addMarkupClass(tab, "tab", "outer");
writer.startElement(HtmlConstants.TD, tab);
Style labelStyle = new Style();
- labelStyle.setWidth(new PixelMeasure(tabList.getWidthList().get(index)));
+ labelStyle.setWidth(tabList.getWidthList().get(index));
writer.writeStyleAttribute(labelStyle);
writer.writeIdAttribute(tab.getClientId(facesContext));
@@ -537,15 +540,15 @@
renderTabGroupView(context, HtmlRendererUtils.getTobagoResponseWriter(context),
(UITabGroup) component, index, SWITCH_TYPE_RELOAD_TAB,
ResourceManagerUtil.getImageWithPath(context, "image/1x1.gif"),
- ThemeConfig.getMeasure(context, component, "navigationBarWidth"), currentWidth, tabList);
+ ThemeConfig.getMeasure(context, component.getRendererType(), "navigationBarWidth"), currentWidth, tabList);
}
private static class TabList {
- private List<Integer> widthList = new ArrayList<Integer>();
+ private List<Measure> widthList = new ArrayList<Measure>();
private int firstIndex;
private int lastIndex;
- public List<Integer> getWidthList() {
+ public List<Measure> getWidthList() {
return widthList;
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabRenderer.java Thu Nov 12 18:23:51 2009
@@ -19,9 +19,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
-public class TabRenderer extends LayoutableRendererBase {
+public class TabRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(TabRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Thu Nov 12 18:23:51 2009
@@ -19,7 +19,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
import org.apache.myfaces.tobago.component.Facets;
@@ -34,7 +33,7 @@
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
@@ -55,7 +54,9 @@
import java.util.Iterator;
import java.util.List;
-public abstract class ToolBarRendererBase extends LayoutableRendererBase {
+import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+
+public abstract class ToolBarRendererBase extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(ToolBarRendererBase.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeDataRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeDataRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeDataRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeDataRenderer.java Thu Nov 12 18:23:51 2009
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class TreeDataRenderer extends LayoutableRendererBase {
+public class TreeDataRenderer extends LayoutComponentRendererBase {
@Override
public void decode(FacesContext facesContext, UIComponent component) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java Thu Nov 12 18:23:51 2009
@@ -24,7 +24,7 @@
import org.apache.myfaces.tobago.component.AbstractUITree;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -40,7 +40,7 @@
import javax.faces.context.ResponseWriter;
import java.io.IOException;
-public class TreeRenderer extends LayoutableRendererBase {
+public class TreeRenderer extends LayoutComponentRendererBase {
private static final String SCRIPT = "script/tobago-tree.js";
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/VerbatimRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/VerbatimRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/VerbatimRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/VerbatimRenderer.java Thu Nov 12 18:23:51 2009
@@ -25,7 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -34,7 +34,7 @@
import javax.faces.context.ResponseWriter;
import java.io.IOException;
-public class VerbatimRenderer extends LayoutableRendererBase {
+public class VerbatimRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(VerbatimRenderer.class);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Thu Nov 12 18:23:51 2009
@@ -22,7 +22,6 @@
Tobago.componentExtraHeight=0
Tobago.fixedWidth=250
Tobago.fixedHeight=25
-Tobago.pickerWidth=16
Tobago.pickerSpace=5
Tobago.scrollbarWidth=19
Tobago.contentBorder=0
@@ -58,6 +57,7 @@
ColumnSelector.fixedWidth=24
DatePicker.fixedWidth=16
+DatePicker.pickerWidth=16
Date.preferredHeight=25
Date.css.border-left-width=2
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java Thu Nov 12 18:23:51 2009
@@ -22,7 +22,7 @@
import org.apache.myfaces.tobago.component.UISeparator;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -35,7 +35,7 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class SeparatorRenderer extends LayoutableRendererBase {
+public class SeparatorRenderer extends LayoutComponentRendererBase {
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/WizardRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/WizardRenderer.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/WizardRenderer.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/WizardRenderer.java Thu Nov 12 18:23:51 2009
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
-public class WizardRenderer extends LayoutableRendererBase {
+public class WizardRenderer extends LayoutComponentRendererBase {
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Thu Nov 12 18:23:51 2009
@@ -29,7 +29,6 @@
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.LayoutableRenderer;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
@@ -116,16 +115,8 @@
}
public static String getRendererName(FacesContext facesContext, UIComponent component) {
- final String rendererType = component.getRendererType();
- //final String family = component.getFamily();
- if (rendererType != null//&& !"facelets".equals(family)
- ) {
- LayoutableRenderer layoutableRendererBase = ComponentUtils.getRenderer(facesContext, component);
- if (layoutableRendererBase != null) {
- return layoutableRendererBase.getRendererName(rendererType);
- }
- }
- return null;
+ String rendererType = component.getRendererType();
+ return rendererType.substring(0, 1).toLowerCase(Locale.ENGLISH) + rendererType.substring(1);
}
public static void writeLabelWithAccessKey(TobagoResponseWriter writer, LabelWithAccessKey label)
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java Thu Nov 12 18:23:51 2009
@@ -22,6 +22,8 @@
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
+import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.util.RangeParser;
@@ -108,7 +110,7 @@
if (!component.isRendered()) {
return;
}
- RendererBase renderer = ComponentUtils.getRendererBase(facesContext, component);
+ RendererBase renderer = ComponentUtils.getRenderer(facesContext, component);
boolean prepareRendersChildren = false;
if (renderer != null) {
renderer.prepareRender(facesContext, component);
@@ -180,45 +182,28 @@
}
}
- public static int calculateStringWidth2(FacesContext facesContext, UIComponent component, String text) {
- int width = 0;
- int defaultCharWidth = 0;
- try {
- defaultCharWidth = ThemeConfig.getValue(facesContext, component, "fontWidth");
- } catch (NullPointerException e) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("no value for \"fontWidth\" found in theme-config");
- }
- }
-
- String fontWidths = ResourceManagerUtil.getProperty(facesContext, "tobago", "tobago.font2.widths");
-
- for (char c : text.toCharArray()) {
- int charWidth;
- if (c >= 32 && c < 128) {
- int begin = (c - 32) * 2;
- charWidth = Integer.parseInt(fontWidths.substring(begin, begin + 2), 16);
- } else {
- charWidth = defaultCharWidth;
- }
- width += charWidth;
- }
+ public static Measure calculateStringWidth(FacesContext facesContext, UIComponent component, String text) {
+ return calculateStringWidth(facesContext, component, text, "tobago.font.widths");
+ }
- return width;
+ public static Measure calculateStringWidth2(FacesContext facesContext, UIComponent component, String text) {
+ return calculateStringWidth(facesContext, component, text, "tobago.font2.widths");
}
- public static int calculateStringWidth(FacesContext facesContext, UIComponent component, String text) {
+ private static Measure calculateStringWidth(
+ FacesContext facesContext, UIComponent component, String text, String type) {
int width = 0;
int defaultCharWidth = 0;
try {
- defaultCharWidth = ThemeConfig.getValue(facesContext, component, "fontWidth");
+ // todo: use Measure instead of int
+ defaultCharWidth = ThemeConfig.getMeasure(facesContext, component.getRendererType(), "fontWidth").getPixel();
} catch (NullPointerException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("no value for \"fontWidth\" found in theme-config");
}
}
- String fontWidths = ResourceManagerUtil.getProperty(facesContext, "tobago", "tobago.font.widths");
+ String fontWidths = ResourceManagerUtil.getProperty(facesContext, "tobago", type);
for (char c : text.toCharArray()) {
int charWidth;
@@ -231,7 +216,7 @@
width += charWidth;
}
- return width;
+ return new PixelMeasure(width);
}
public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectOne component) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java Thu Nov 12 18:23:51 2009
@@ -25,8 +25,8 @@
private boolean invokeOnComponent;
private boolean messages;
- public ComponentInfo(String sourceClass, String qualifiedName, String rendererName) {
- super(sourceClass, qualifiedName, rendererName);
+ public ComponentInfo(String sourceClass, String qualifiedName, String rendererType) {
+ super(sourceClass, qualifiedName, rendererType);
}
public boolean isInvokeOnComponent() {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java Thu Nov 12 18:23:51 2009
@@ -18,21 +18,21 @@
*/
public class RendererInfo extends ClassInfo {
- private String rendererName;
+ private String rendererType;
public RendererInfo(String sourceClass, String qualifiedName) {
super(sourceClass, qualifiedName);
}
- public RendererInfo(String sourceClass, String qualifiedName, String rendererName) {
+ public RendererInfo(String sourceClass, String qualifiedName, String rendererType) {
super(sourceClass, qualifiedName);
- this.rendererName = rendererName;
+ this.rendererType = rendererType;
}
- public String getRendererName() {
- if (rendererName != null && rendererName.length() == 0) {
+ public String getRendererType() {
+ if (rendererType != null && rendererType.length() == 0) {
return null;
}
- return rendererName;
+ return rendererType;
}
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java Thu Nov 12 18:23:51 2009
@@ -29,8 +29,8 @@
private PropertyInfo bodyContent;
private boolean checkBodyContent;
- public TagInfo(String sourceClass, String qualifiedName, String rendererName) {
- super(sourceClass, qualifiedName, rendererName);
+ public TagInfo(String sourceClass, String qualifiedName, String rendererType) {
+ super(sourceClass, qualifiedName, rendererType);
}
public TagInfo(String sourceClass, String qualifiedName) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/renderer.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/renderer.stg?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/renderer.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/renderer.stg Thu Nov 12 18:23:51 2009
@@ -49,8 +49,8 @@
extends <renderInfo.superClassName> <first(renderInfo.interfaces):{ n | implements <n> }><rest(renderInfo.interfaces):{ n | , <n> }> {
@Override
- protected final String getRendererName() {
- return "<renderInfo.rendererName>";
+ protected final String getRendererType() {
+ return "<renderInfo.rendererType>";
}
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg Thu Nov 12 18:23:51 2009
@@ -56,8 +56,8 @@
}
@Override
public String getRendererType() {
- <if(tagInfo.rendererName)>
- return "<tagInfo.rendererName>";
+ <if(tagInfo.rendererType)>
+ return "<tagInfo.rendererType>";
<else>
return null;
<endif>
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg?rev=835483&r1=835482&r2=835483&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg Thu Nov 12 18:23:51 2009
@@ -56,8 +56,8 @@
}
@Override
public String getRendererType() {
- <if(tagInfo.rendererName)>
- return "<tagInfo.rendererName>";
+ <if(tagInfo.rendererType)>
+ return "<tagInfo.rendererType>";
<else>
return null;
<endif>