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 2010/01/06 13:53:42 UTC
svn commit: r896425 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache/myfaces/tobago/model/
core/src/main/java/org/apache/myfaces/tobag...
Author: lofwyr
Date: Wed Jan 6 12:53:24 2010
New Revision: 896425
URL: http://svn.apache.org/viewvc?rev=896425&view=rev
Log:
TOBAGO-606: Layout Manager
Add new attributes currentWidth and currentHeight to hold computed values (before this change it can't be distinguish values set by the attribute and computed values)
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Interval.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/IntervalList.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageState.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentBase.java
myfaces/tobago/trunk/example/addressbook/lib/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Layout.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java Wed Jan 6 12:53:24 2010
@@ -148,7 +148,7 @@
if (size != null) {
size = size.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
size = size.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
- LayoutUtils.setSize(orientation, getLayoutContainer(), size);
+ LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), size);
}
}
@@ -164,7 +164,7 @@
if (!list.isEmpty()) {
// find rest
LayoutContainer container = getLayoutContainer();
- Measure available = LayoutUtils.getSize(orientation, container);
+ Measure available = LayoutUtils.getCurrentSize(orientation, container);
if (available != null) {
for (PixelMeasure value : grid.getSizes(orientation)) {
available = available.subtractNotNegative(value);
@@ -212,7 +212,7 @@
size = size.add(pixelMeasures[i + k]);
size = size.add(getSpacing(orientation));
}
- LayoutUtils.setSize(orientation, component, size);
+ LayoutUtils.setCurrentSize(orientation, component, size);
} else {
LOG.warn("Size is null, should be debugged... i=" + i + " grid=" + grid, new RuntimeException());
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java Wed Jan 6 12:53:24 2010
@@ -58,10 +58,6 @@
public static final String FORM_ACCEPT_CHARSET = "utf-8";
- private static final int DEFAULT_WIDTH = 1024;
-
- private static final int DEFAULT_HEIGHT = 768;
-
private String formId;
private String actionId;
@@ -232,11 +228,11 @@
.getRequestParameterMap().get(name);
if (value != null) {
StringTokenizer tokenizer = new StringTokenizer(value, ";");
- int width = Integer.parseInt(tokenizer.nextToken());
- int height = Integer.parseInt(tokenizer.nextToken());
+ Measure width = Measure.parse(tokenizer.nextToken());
+ Measure height = Measure.parse(tokenizer.nextToken());
if (pageState != null) {
- pageState.setClientWidth(width);
- pageState.setClientHeight(height);
+ pageState.setClientWidth(width.getPixel());
+ pageState.setClientHeight(height.getPixel());
}
facesContext.getExternalContext().getRequestMap().put("tobago-page-clientDimension-width", width);
facesContext.getExternalContext().getRequestMap().put("tobago-page-clientDimension-height", height);
@@ -284,29 +280,6 @@
this.defaultActionId = defaultActionId;
}
- protected Integer getWidthInternal() {
- Integer requestWidth =
- (Integer) FacesContext.getCurrentInstance().getExternalContext().
- getRequestMap().get("tobago-page-clientDimension-width");
- if (requestWidth != null) {
- return requestWidth;
- } else {
- return DEFAULT_WIDTH;
- }
- }
-
-
- protected Integer getHeightInternal() {
- Integer requestHeight =
- (Integer) FacesContext.getCurrentInstance().getExternalContext().
- getRequestMap().get("tobago-page-clientDimension-height");
- if (requestHeight != null) {
- return requestHeight;
- } else {
- return DEFAULT_HEIGHT;
- }
- }
-
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
throws FacesException {
return FacesUtils.invokeOnComponent(context, this, clientId, callback);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java Wed Jan 6 12:53:24 2010
@@ -94,7 +94,7 @@
|| orientation == Orientation.VERTICAL && !verticalAuto) {
// find rest
LayoutContainer container = getLayoutContainer();
- Measure available = LayoutUtils.getSize(orientation, container);
+ Measure available = LayoutUtils.getCurrentSize(orientation, container);
if (available != null) {
available = available.subtractNotNegative(LayoutUtils.getBeginOffset(orientation, container));
available = available.subtractNotNegative(LayoutUtils.getEndOffset(orientation, container));
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java Wed Jan 6 12:53:24 2010
@@ -62,7 +62,6 @@
public void preProcessing(Orientation orientation) {
// process auto tokens
- int i = 0;
IntervalList intervals = new IntervalList();
for (LayoutComponent component : getLayoutContainer().getComponents()) {
@@ -80,7 +79,7 @@
Measure size = intervals.computeAuto();
size = size.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
size = size.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
- LayoutUtils.setSize(orientation, getLayoutContainer(), size);
+ LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), size);
}
}
@@ -91,7 +90,7 @@
|| orientation == Orientation.VERTICAL && !verticalAuto) {
// find rest
LayoutContainer container = getLayoutContainer();
- Measure available = LayoutUtils.getSize(orientation, container);
+ Measure available = LayoutUtils.getCurrentSize(orientation, container);
if (available != null) {
available = available.subtractNotNegative(LayoutUtils.getBeginOffset(orientation, container));
available = available.subtractNotNegative(LayoutUtils.getEndOffset(orientation, container));
@@ -99,7 +98,7 @@
for (LayoutComponent component : getLayoutContainer().getComponents()) {
component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
- LayoutUtils.setSize(orientation, component, available);
+ LayoutUtils.setCurrentSize(orientation, component, available);
// call sub layout manager
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Interval.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Interval.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Interval.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Interval.java Wed Jan 6 12:53:24 2010
@@ -25,21 +25,21 @@
private Measure maximum;
- private Measure fixed;
+ private Measure current;
public Interval(LayoutComponent component, Orientation orientation) {
this(
orientation == Orientation.HORIZONTAL ? component.getMinimumWidth() : component.getMinimumHeight(),
orientation == Orientation.HORIZONTAL ? component.getPreferredWidth() : component.getPreferredHeight(),
orientation == Orientation.HORIZONTAL ? component.getMaximumWidth() : component.getMaximumHeight(),
- orientation == Orientation.HORIZONTAL ? component.getWidth() : component.getHeight());
+ orientation == Orientation.HORIZONTAL ? component.getCurrentWidth() : component.getCurrentHeight());
}
- public Interval(Measure minimum, Measure preferred, Measure maximum, Measure fixed) {
+ public Interval(Measure minimum, Measure preferred, Measure maximum, Measure current) {
this.minimum = minimum;
this.preferred = preferred;
this.maximum = maximum;
- this.fixed = fixed;
+ this.current = current;
}
public Measure getMinimum() {
@@ -66,11 +66,26 @@
this.maximum = maximum;
}
- public Measure getFixed() {
- return fixed;
+ public Measure getCurrent() {
+ return current;
}
- public void setFixed(Measure fixed) {
- this.fixed = fixed;
+ public void setCurrent(Measure current) {
+ this.current = current;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[");
+ builder.append(minimum);
+ builder.append("<=");
+ builder.append(preferred);
+ builder.append("<=");
+ builder.append(maximum);
+ builder.append(",");
+ builder.append(current);
+ builder.append("]");
+ return builder.toString();
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/IntervalList.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/IntervalList.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/IntervalList.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/IntervalList.java Wed Jan 6 12:53:24 2010
@@ -29,11 +29,11 @@
public Measure computeAuto() {
Measure auto;
- List<Measure> fixedList = collectFixed();
+ List<Measure> currentList = collectCurrent();
List<Measure> minimumList = collectMinimum();
List<Measure> maximumList = collectMaximum();
- if (!fixedList.isEmpty()) {
- auto = max(max(minimumList), max(fixedList));
+ if (!currentList.isEmpty()) {
+ auto = max(max(minimumList), max(currentList));
} else {
Measure maximumOfMinimumList = max(minimumList);
Measure minimumOfMaximumList = min(maximumList);
@@ -41,7 +41,7 @@
LOG.warn("!");
auto = maximumOfMinimumList;
} else {
- List preferredInInterval = findPreferredInInterval(maximumOfMinimumList, minimumOfMaximumList);
+ List<Measure> preferredInInterval = findPreferredInInterval(maximumOfMinimumList, minimumOfMaximumList);
if (!preferredInInterval.isEmpty()) {
auto = max(preferredInInterval);
} else {
@@ -53,11 +53,11 @@
return auto;
}
- private List<Measure> collectFixed() {
+ private List<Measure> collectCurrent() {
List<Measure> result = new ArrayList<Measure>();
for (Interval interval : this) {
- if (interval.getFixed() != null) {
- result.add(interval.getFixed());
+ if (interval.getCurrent() != null) {
+ result.add(interval.getCurrent());
}
}
return result;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java Wed Jan 6 12:53:24 2010
@@ -30,6 +30,12 @@
Measure getHeight();
void setHeight(Measure height);
+ Measure getCurrentWidth();
+ void setCurrentWidth(Measure width);
+
+ Measure getCurrentHeight();
+ void setCurrentHeight(Measure height);
+
Measure getMinimumWidth();
void setMinimumWidth(Measure minimumWidth);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java Wed Jan 6 12:53:24 2010
@@ -78,9 +78,9 @@
buffer.append(component.getClass().getSimpleName());
if (component instanceof LayoutBase) {
buffer.append("(");
- buffer.append(((LayoutBase) component).getWidth());
+ buffer.append(((LayoutBase) component).getCurrentWidth());
buffer.append(", ");
- buffer.append(((LayoutBase) component).getHeight());
+ buffer.append(((LayoutBase) component).getCurrentHeight());
buffer.append(")");
}
if (component instanceof LayoutContainer) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java Wed Jan 6 12:53:24 2010
@@ -127,34 +127,35 @@
return orientation == Orientation.HORIZONTAL ? container.getLeftOffset() : container.getTopOffset();
}
- public static Measure getSize(Orientation orientation, LayoutContainer container) {
- return orientation == Orientation.HORIZONTAL ? container.getWidth() : container.getHeight();
+ public static Measure getCurrentSize(Orientation orientation, LayoutContainer container) {
+ return orientation == Orientation.HORIZONTAL ? container.getCurrentWidth() : container.getCurrentHeight();
}
- public static void setSize(Orientation orientation, LayoutBase component, Measure size) {
+ public static void setCurrentSize(Orientation orientation, LayoutBase component, Measure size) {
if (orientation == Orientation.HORIZONTAL) {
if (component.getWidth() != null) { // to not override set sizes
- return;
+ size = component.getWidth();
+ } else {
+ if (size.greaterThan(component.getMaximumWidth())) {
+ size = component.getMaximumWidth();
+ }
+ if (size.lessThan(component.getMinimumWidth())) {
+ size = component.getMinimumWidth();
+ }
}
- if (size.greaterThan(component.getMaximumWidth())) {
- size = component.getMaximumWidth();
- }
- if (size.lessThan(component.getMinimumWidth())) {
- size = component.getMinimumWidth();
- }
- component.setWidth(size);
+ component.setCurrentWidth(size);
} else {
if (component.getHeight() != null) { // to not override set sizes
- return;
- }
- if (size.greaterThan(component.getMaximumHeight())) {
- size = component.getMaximumHeight();
+ size = component.getHeight();
+ } else {
+ if (size.greaterThan(component.getMaximumHeight())) {
+ size = component.getMaximumHeight();
+ }
+ if (size.lessThan(component.getMinimumHeight())) {
+ size = component.getMinimumHeight();
+ }
}
- if (size.lessThan(component.getMinimumHeight())) {
- size = component.getMinimumHeight();
- }
- component.setHeight(size);
+ component.setCurrentHeight(size);
}
}
-
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageState.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageState.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageState.java Wed Jan 6 12:53:24 2010
@@ -17,13 +17,22 @@
* limitations under the License.
*/
+/**
+ * @deprecated since 1.5.0, please configure constraints for the page size with a tc:gridLayoutConstraints tag
+ * inside the tc:page tag.
+ */
+@Deprecated
public interface PageState {
+ @Deprecated
int getClientWidth();
+ @Deprecated
void setClientWidth(int width);
+ @Deprecated
int getClientHeight();
+ @Deprecated
void setClientHeight(int height);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java Wed Jan 6 12:53:24 2010
@@ -17,6 +17,11 @@
* limitations under the License.
*/
+/**
+ * @deprecated since 1.5.0, please configure constraints for the page size with a tc:gridLayoutConstraints tag
+ * inside the tc:page tag.
+ */
+@Deprecated
public class PageStateImpl implements PageState {
private int clientWidth;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java Wed Jan 6 12:53:24 2010
@@ -63,7 +63,7 @@
String rendererType = layout.getRendererType();
- width = layout.getWidth();
+ width = layout.getCurrentWidth();
if (width != null) {
// TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
width = width.subtractNotNegative(
@@ -75,7 +75,7 @@
width = width.subtractNotNegative(
ResourceManagerUtil.getThemeMeasure(facesContext, layout, "css.border-right-width"));
}
- height = layout.getHeight();
+ height = layout.getCurrentHeight();
if (height != null) {
// TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
height = height.subtractNotNegative(
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentBase.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentBase.java Wed Jan 6 12:53:24 2010
@@ -26,6 +26,24 @@
public interface IsGridLayoutComponentBase {
/**
+ * This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
+ *
+ * @param currentWidth The current width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "getWidth()")
+ void setCurrentWidth(String currentWidth);
+
+ /**
+ * This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
+ *
+ * @param currentHeight The current height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "getHeight()")
+ void setCurrentHeight(String currentHeight);
+
+ /**
* @param columnSpan The number of horizontal cells this component should use.
*/
@UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "1")
Modified: myfaces/tobago/trunk/example/addressbook/lib/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Layout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/lib/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Layout.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/lib/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Layout.java (original)
+++ myfaces/tobago/trunk/example/addressbook/lib/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/Layout.java Wed Jan 6 12:53:24 2010
@@ -19,6 +19,11 @@
import org.apache.myfaces.tobago.model.PageStateImpl;
+/**
+ * @deprecated since 1.5.0, please configure constraints for the page size with a tc:gridLayoutConstraints tag
+ * inside the tc:page tag.
+ */
+@Deprecated
public class Layout extends PageStateImpl {
private int width;
Modified: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java (original)
+++ myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java Wed Jan 6 12:53:24 2010
@@ -30,6 +30,9 @@
private Measure width;
private Measure height;
+ private Measure currentWidth;
+ private Measure currentHeight;
+
private Measure minimumWidth;
private Measure minimumHeight;
@@ -85,6 +88,22 @@
this.height = height;
}
+ public Measure getCurrentWidth() {
+ return currentWidth;
+ }
+
+ public void setCurrentWidth(Measure currentWidth) {
+ this.currentWidth = currentWidth;
+ }
+
+ public Measure getCurrentHeight() {
+ return currentHeight;
+ }
+
+ public void setCurrentHeight(Measure currentHeight) {
+ this.currentHeight = currentHeight;
+ }
+
public Measure getMinimumWidth() {
return minimumWidth;
}
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=896425&r1=896424&r2=896425&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 Wed Jan 6 12:53:24 2010
@@ -263,7 +263,7 @@
UIComponent timePanel = box.findComponent("timePanel");
if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
UITime time = (UITime) timePanel.findComponent("time");
- Measure popupHeight = popup.getHeight();
+ Measure popupHeight = popup.getCurrentHeight();
popupHeight = popupHeight.add(getResourceManager().getThemeMeasure(facesContext, time, "preferredHeight"));
popup.setHeight(popupHeight);
DateTimeConverter dateTimeConverter
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=896425&r1=896424&r2=896425&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 Wed Jan 6 12:53:24 2010
@@ -128,8 +128,8 @@
AbstractUIPage page = ComponentUtils.findPage(facesContext, messages);
- popup.setWidth(new PixelMeasure(page.getWidth().getPixel() - 200));
- popup.setHeight(new PixelMeasure(page.getHeight().getPixel() - 200));
+ popup.setWidth(page.getCurrentWidth().subtract(200));
+ popup.setHeight(page.getCurrentHeight().subtract(200));
popup.setLeft(new PixelMeasure(100));
popup.setTop(new PixelMeasure(100));
popup.setRendered(true);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Wed Jan 6 12:53:24 2010
@@ -463,7 +463,7 @@
// XXX better to take this fact into layout management.
// XXX is also useful in boxes, etc.
Measure topOffset = getBottomOffset(facesContext, page);
- style.setHeight(page.getHeight().subtract(topOffset));
+ style.setHeight(page.getCurrentHeight().subtract(topOffset));
style.setTop(topOffset);
writer.writeStyleAttribute(style);
}
@@ -677,4 +677,28 @@
return Measure.ZERO;
}
}
+
+ @Override
+ public Measure getWidth(FacesContext facesContext, Configurable component) {
+ // width of the actual browser window
+ Measure width = (Measure) FacesContext.getCurrentInstance().getExternalContext()
+ .getRequestMap().get("tobago-page-clientDimension-width");
+ if (width != null) {
+ return width;
+ } else {
+ return super.getWidth(facesContext, component);
+ }
+ }
+
+ @Override
+ public Measure getHeight(FacesContext facesContext, Configurable component) {
+ // height of the actual browser window
+ Measure height = (Measure) FacesContext.getCurrentInstance().getExternalContext()
+ .getRequestMap().get("tobago-page-clientDimension-height");
+ if (height != null) {
+ return height;
+ } else {
+ return super.getHeight(facesContext, component);
+ }
+ }
}
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=896425&r1=896424&r2=896425&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 Wed Jan 6 12:53:24 2010
@@ -84,14 +84,14 @@
}
final StringBuilder contentStyle = new StringBuilder(32);
- if (component.getWidth() != null) {
+ if (component.getCurrentWidth() != null) {
contentStyle.append("width: ");
- contentStyle.append(component.getWidth().getPixel());
+ contentStyle.append(component.getCurrentWidth().getPixel());
contentStyle.append("; ");
}
- if (component.getHeight() != null) {
+ if (component.getCurrentHeight() != null) {
contentStyle.append("height: ");
- contentStyle.append(component.getHeight().getPixel());
+ contentStyle.append(component.getCurrentHeight().getPixel());
contentStyle.append("; ");
}
contentStyle.append("z-index: ");
@@ -127,10 +127,10 @@
final StringBuilder frameSize = new StringBuilder(32);
// full client area
frameSize.append("width: ");
- frameSize.append(page.getWidth().getPixel());
+ frameSize.append(page.getCurrentWidth().getPixel());
frameSize.append("; ");
frameSize.append("height: ");
- frameSize.append(page.getHeight().getPixel());
+ frameSize.append(page.getCurrentHeight().getPixel());
frameSize.append("; ");
writer.writeAttribute(HtmlAttributes.STYLE, frameSize.toString(), false);
} else {
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=896425&r1=896424&r2=896425&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 Wed Jan 6 12:53:24 2010
@@ -275,7 +275,7 @@
// BEGIN RENDER BODY CONTENT
Style bodyStyle = new Style();
bodyStyle.setPosition(Position.RELATIVE);
- bodyStyle.setWidth(sheet.getWidth());
+ bodyStyle.setWidth(sheet.getCurrentWidth());
bodyStyle.setHeight(sheetHeight.subtract(footerHeight));
writer.startElement(HtmlConstants.DIV, null);
@@ -1163,7 +1163,7 @@
}
}
- Measure space = data.getWidth();
+ Measure space = data.getCurrentWidth();
space = space.subtractNotNegative(getContentBorder(facesContext, data));
if (needVerticalScrollbar(facesContext, data, style)) {
space = space.subtractNotNegative(getScrollbarWidth(facesContext, data));
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=896425&r1=896424&r2=896425&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 Wed Jan 6 12:53:24 2010
@@ -275,7 +275,7 @@
writer.writeAttribute(HtmlAttributes.VALIGN, "bottom", false);
writer.startElement(HtmlConstants.TD, tabGroup);
- Measure width = tabGroup.getWidth();
+ Measure width = tabGroup.getCurrentWidth();
Measure headerHeight = getResourceManager().getThemeMeasure(facesContext, tabGroup, "headerHeight");
Style header = new Style();
header.setPosition(Position.RELATIVE);
@@ -494,7 +494,7 @@
Style body = new Style();
body.setPosition(Position.RELATIVE);
body.setWidth(width);
- body.setHeight(tabGroup.getHeight().subtract(headerHeight));
+ body.setHeight(tabGroup.getCurrentHeight().subtract(headerHeight));
encodeContent(writer, facesContext, activeTab, body);
writer.endElement(HtmlConstants.TABLE);
Modified: myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java Wed Jan 6 12:53:24 2010
@@ -100,6 +100,7 @@
private void encodeBox(FacesContext facesContext, TobagoResponseWriter writer, UIBox box) throws IOException {
// todo: shadow = 0px means, that shadow is disabled, but it may be better, if we can set a boolean in the config.
+ // todo: this is possible after fixing
Measure measure = getResourceManager().getThemeMeasure(facesContext, box, "shadow");
boolean hasShadow = measure.greaterThan(Measure.ZERO);
@@ -112,8 +113,8 @@
writer.writeClassAttribute(classes);
Style shadow = new Style();
- shadow.setWidth(box.getWidth().subtract(1));
- shadow.setHeight(box.getHeight().subtract(1));
+ shadow.setWidth(box.getCurrentWidth().subtract(1));
+ shadow.setHeight(box.getCurrentHeight().subtract(1));
writer.writeStyleAttribute(shadow);
// border begin
@@ -124,8 +125,8 @@
writer.writeClassAttribute(classes);
Style border = new Style();
- border.setWidth(box.getWidth().subtract(3));
- border.setHeight(box.getHeight().subtract(3));
+ border.setWidth(box.getCurrentWidth().subtract(3));
+ border.setHeight(box.getCurrentHeight().subtract(3));
writer.writeStyleAttribute(border);
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties?rev=896425&r1=896424&r2=896425&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties Wed Jan 6 12:53:24 2010
@@ -46,6 +46,8 @@
Page.topOffset=0
Page.rightOffset=0
Page.bottomOffset=0
+Page.width=1024
+Page.height=768
Panel.leftOffset=0
Panel.topOffset=0