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/06/26 14:13:47 UTC
svn commit: r788668 [2/6] - in /myfaces/tobago/trunk: core/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache...
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java Fri Jun 26 12:13:41 2009
@@ -33,6 +33,7 @@
public static final String CHARSET = "charset";
public static final String CELLSPACING = "cellspacing";
public static final String CLIENT_PROPERTIES = "clientProperties";
+ public static final String COLUMN_SPAN = "columnSpan";
public static final String COLUMNS = "columns";
public static final String CONVERTER = "converter";
public static final String CREATE_SPAN = "createSpan";
@@ -91,12 +92,15 @@
public static final String MAX = "max";
public static final String MAX_SEVERITY = "maxSeverity";
public static final String MAX_NUMBER = "maxNumber";
+ public static final String MAXIMUM_HEIGHT = "maximumHeight";
+ public static final String MAXIMUM_WIDTH = "maximumWidth";
public static final String MENU_POPUP = "menuPopup";
public static final String MENU_POPUP_TYPE = "menuPopupType";
public static final String METHOD = "method";
public static final String MIN = "min";
public static final String MIN_SEVERITY = "minSeverity";
- public static final String MINIMUN_SIZE = "minimunSize";
+ public static final String MINIMUM_HEIGHT = "minimumHeight";
+ public static final String MINIMUM_WIDTH = "minimumWidth";
public static final String MODAL = "modal";
public static final String MODE = "mode";
public static final String MUTABLE = "mutable";
@@ -113,6 +117,8 @@
public static final String POPUP_LIST = "popupList";
public static final String POPUP_RESET = "popupReset";
public static final String POPUP_CALENDAR_ID = "popupCalendarId";
+ public static final String PREFERRED_HEIGHT = "preferredHeight";
+ public static final String PREFERRED_WIDTH = "preferredWidth";
public static final String PREFORMATED = "preformated";
public static final String READONLY = "readonly";
public static final String REFERENCE = "reference";
@@ -126,6 +132,7 @@
public static final String REQUIRED = "required";
public static final String RESOURCE = "resource";
public static final String ROW_ID = "rowId";
+ public static final String ROW_SPAN = "rowSpan";
public static final String ROWS = "rows";
public static final String SCRIPT_FILES = "scriptFiles";
public static final String SCROLLBAR_HEIGHT = "scrollbarHeight";
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java Fri Jun 26 12:13:41 2009
@@ -20,60 +20,15 @@
/**
* Constants for the renderer type
*/
-public final class RendererTypes {
+public final class ComponentTypes {
- public static final String BOX = "Box";
- public static final String BOX_TOOL_BAR = "BoxToolBar";
- public static final String BUTTON = "Button";
- public static final String CALENDAR = "Calendar";
- public static final String CELL = "Cell";
- public static final String COLUMN_SELECTOR = "ColumnSelector";
- public static final String COMMAND = "Command";
- public static final String DATE = "Date";
- public static final String DATE_PICKER = "DatePicker";
- public static final String DEFAULT_LAYOUT = "DefaultLayout";
- public static final String FILE = "File";
- public static final String FORM = "Form";
- public static final String GRID_LAYOUT = "GridLayout";
- public static final String HIDDEN = "Hidden";
- public static final String IN = "In";
- public static final String IMAGE = "Image";
- public static final String LINK = "Link";
- public static final String LABEL = "Label";
- public static final String MESSAGE = "Message";
- public static final String MESSAGES = "Messages";
- public static final String MENU_BAR = "MenuBar";
- public static final String MENU_COMMAND = "MenuCommand";
- public static final String OBJECT = "Object";
- public static final String OUT = "Out";
- public static final String PAGE = "Page";
- public static final String PANEL = "Panel";
- public static final String POPUP = "Popup";
- public static final String PROGRESS = "Progress";
- public static final String SCRIPT = "Script";
- public static final String SELECT_BOOLEAN_CHECKBOX = "SelectBooleanCheckbox";
- public static final String SELECT_MANY_CHECKBOX = "SelectManyCheckbox";
- public static final String SELECT_MANY_LISTBOX = "SelectManyListbox";
- public static final String SELECT_ONE_CHOICE = "SelectOneChoice";
- public static final String SELECT_ONE_RADIO = "SelectOneRadio";
- public static final String SELECT_ONE_LISTBOX = "SelectOneListbox";
- public static final String SELECT_REFERENCE = "SelectReference";
- public static final String SEPARATOR = "Separator";
- public static final String SHEET_PAGE_COMMAND = "SheetPageCommand";
- public static final String STYLE = "Style";
- public static final String TEXT_AREA = "TextArea";
- public static final String TAB_GROUP = "TabGroup";
- public static final String TAB = "Tab";
- public static final String TIME = "Time";
- public static final String TOOL_BAR = "ToolBar";
- public static final String TREE = "Tree";
- public static final String TREE_DATA = "TreeData";
- public static final String TREE_NODE = "TreeNode";
- public static final String SHEET = "Sheet";
- public static final String VERBATIM = "Verbatim";
- public static final String WIZARD = "Wizard";
+ // TODO: make a complete list.
- private RendererTypes() {
+ public static final String COLUMN = "org.apache.myfaces.tobago.Column";
+ public static final String OUT = "org.apache.myfaces.tobago.Out";
+ public static final String SELECT_BOOLEAN = "org.apache.myfaces.tobago.SelectBoolean";
+
+ private ComponentTypes() {
// to prevent instantiation
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java Fri Jun 26 12:13:41 2009
@@ -18,6 +18,7 @@
*/
import org.apache.myfaces.tobago.internal.taglib.TagUtils;
+import org.apache.myfaces.tobago.layout.Display;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
@@ -50,36 +51,40 @@
}
@Deprecated
- public static UIColumn createTextColumn(String label, String sortable, String align, String value) {
+ public static AbstractUIColumn createTextColumn(String label, String sortable, String align, String value) {
return createTextColumn(label, sortable, align, value, null);
}
- public static UIColumn createTextColumn(String label, String sortable, String align, String value, String clientId) {
- UIComponent text = createComponent(UIOutput.COMPONENT_TYPE, RendererTypes.OUT, clientId + "_t");
+ public static AbstractUIColumn createTextColumn(
+ String label, String sortable, String align, String value, String clientId) {
+ AbstractUIOut text = (AbstractUIOut) createComponent(ComponentTypes.OUT, RendererTypes.OUT, clientId + "_t");
TagUtils.setStringProperty(text, Attributes.VALUE, value);
TagUtils.setBooleanProperty(text, Attributes.CREATE_SPAN, "false");
TagUtils.setBooleanProperty(text, Attributes.ESCAPE, "false");
+ text.setDisplay(Display.INLINE);
return createColumn(label, sortable, align, text, clientId);
}
@Deprecated
- public static UIColumn createColumn(String label, String sortable, String align, UIComponent child) {
+ public static AbstractUIColumn createColumn(String label, String sortable, String align, UIComponent child) {
return createColumn(label, sortable, align, child, null);
}
- public static UIColumn createColumn(String label, String sortable, String align, UIComponent child, String clientId) {
- UIColumn column = createColumn(label, sortable, align, clientId);
+
+ public static AbstractUIColumn createColumn(
+ String label, String sortable, String align, UIComponent child, String clientId) {
+ AbstractUIColumn column = createColumn(label, sortable, align, clientId);
//noinspection unchecked
column.getChildren().add(child);
return column;
}
@Deprecated
- public static UIColumn createColumn(String label, String sortable, String align) {
+ public static AbstractUIColumn createColumn(String label, String sortable, String align) {
return createColumn(label, sortable, align, (String) null);
}
- public static UIColumn createColumn(String label, String sortable, String align, String clientId) {
- UIColumn column = (UIColumn) createComponent(UIColumn.COMPONENT_TYPE, null, clientId);
+ public static AbstractUIColumn createColumn(String label, String sortable, String align, String clientId) {
+ AbstractUIColumn column = (AbstractUIColumn) createComponent(ComponentTypes.COLUMN, null, clientId);
TagUtils.setStringProperty(column, Attributes.LABEL, label);
TagUtils.setBooleanProperty(column, Attributes.SORTABLE, sortable);
TagUtils.setStringProperty(column, Attributes.ALIGN, align);
@@ -112,8 +117,8 @@
}
public static UIComponent createUISelectBooleanFacet(FacesContext facesContext, UICommand command, String clientId) {
- UIComponent checkbox = createComponent(facesContext, UISelectBoolean.COMPONENT_TYPE,
- RendererTypes.SELECT_BOOLEAN_CHECKBOX, clientId);
+ UIComponent checkbox = createComponent(
+ facesContext, ComponentTypes.SELECT_BOOLEAN, RendererTypes.SELECT_BOOLEAN_CHECKBOX, clientId);
//noinspection unchecked
command.getFacets().put(Facets.ITEMS, checkbox);
ValueBinding valueBinding = command.getValueBinding(Attributes.VALUE);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Fri Jun 26 12:13:41 2009
@@ -62,8 +62,9 @@
public static final String SHEET_PAGE_COMMAND = "SheetPageCommand";
public static final String STYLE = "Style";
public static final String TEXT_AREA = "TextArea";
- public static final String TAB_GROUP = "TabGroup";
public static final String TAB = "Tab";
+ public static final String TAB_GROUP = "TabGroup";
+ public static final String TAB_GROUP_LAYOUT = "TabGroupLayout";
public static final String TIME = "Time";
public static final String TOOL_BAR = "ToolBar";
public static final String TREE = "Tree";
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Tags.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Tags.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Tags.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Tags.java Fri Jun 26 12:13:41 2009
@@ -18,163 +18,11 @@
*/
/**
- * Name constants of the attributes of the Tobago components.
+ * Name constants of the tags library.
*/
-public final class Attributes {
+public final class Tags {
- public static final String ACTION = "action";
- public static final String ACTION_LISTENER = "actionListener";
- public static final String ALIGN = "align";
- public static final String ALT = "alt";
- public static final String APPLICATION_ICON = "applicationIcon";
- public static final String AUTO_RELOAD = "autoReload";
- public static final String BODY_CONTENT = "bodyContent";
- public static final String BORDER = "border";
- public static final String CHARSET = "charset";
- public static final String CELLSPACING = "cellspacing";
- public static final String CLIENT_PROPERTIES = "clientProperties";
- public static final String COLUMNS = "columns";
- public static final String CONVERTER = "converter";
- public static final String CREATE_SPAN = "createSpan";
- public static final String CSS_CLASSES_BLOCKS = "cssClassesBlocks";
- public static final String DATE_INPUT_ID = "dateInputId";
- public static final String DATE_STYLE = "dateStyle";
- public static final String DEFAULT_COMMAND = "defaultCommand";
- public static final String DELAY = "delay";
- public static final String DIRECT_LINK_COUNT = "directLinkCount";
- public static final String DISABLED = "disabled";
- public static final String DOCTYPE = "doctype";
- public static final String ENCTYPE = "enctype";
- public static final String ESCAPE = "escape";
- public static final String EXPANDED = "expanded";
- public static final String EVENT = "event";
- public static final String FIRST = "first";
- public static final String FREQUENCY = "frequency";
- public static final String FOCUS = "focus";
- public static final String FOCUS_ID = "focusId";
- public static final String FOOTER_HEIGHT = "footerHeight";
- public static final String FORCE_VERTICAL_SCROLLBAR = "forceVerticalScrollbar";
- public static final String FORMAT_PATTERN = "formatPattern";
- public static final String FOR = "for";
- public static final String GLOBAL_ONLY = "globalOnly";
- public static final String HEIGHT = "height";
- public static final String HIDDEN = "hidden";
- public static final String HOVER = "hover";
- public static final String I18N = "i18n";
- public static final String ICON_SIZE = "iconSize";
- public static final String ID = "id";
- public static final String IMMEDIATE = "immediate";
- public static final String IMAGE = "image";
- public static final String INLINE = "inline";
- public static final String INNER_HEIGHT = "innerHeight";
- public static final String INNER_WIDTH = "innerWidth";
- public static final String ITEM_DESCRIPTION = "itemDescription";
- public static final String ITEM_DISABLED = "itemDisabled";
- public static final String ITEM_LABEL = "itemLabel";
- public static final String ITEM_IMAGE = "itemImage";
- public static final String ITEM_VALUE = "itemValue";
- public static final String LABEL = "label";
- public static final String LABEL_POSITION = "labelPosition";
- public static final String LAYOUT_HEIGHT = "layoutHeight";
- public static final String LAYOUT_ORDER = "layoutOrder";
- public static final String LAYOUT_WIDTH = "layoutWidth";
- public static final String LEFT = "left";
- public static final String LINK = "link";
- public static final String MARGIN = "margin";
- public static final String MARGIN_BOTTOM = "marginBottom";
- public static final String MARGIN_LEFT = "marginLeft";
- public static final String MARGIN_RIGHT = "marginRight";
- public static final String MARGIN_TOP = "marginTop";
- public static final String MARKED = "marked";
- public static final String MARKUP = "markup";
- public static final String MAX = "max";
- public static final String MAX_SEVERITY = "maxSeverity";
- public static final String MAX_NUMBER = "maxNumber";
- public static final String MENU_POPUP = "menuPopup";
- public static final String MENU_POPUP_TYPE = "menuPopupType";
- public static final String METHOD = "method";
- public static final String MIN = "min";
- public static final String MIN_SEVERITY = "minSeverity";
- public static final String MINIMUN_SIZE = "minimunSize";
- public static final String MODAL = "modal";
- public static final String MODE = "mode";
- public static final String MUTABLE = "mutable";
- public static final String NAME = "name";
- public static final String NAVIGATE = "navigate";
- public static final String NUMBER_STYLE = "numberStyle";
- public static final String ONCHANGE = "onchange";
- public static final String ONCLICK = "onclick";
- public static final String ORDER_BY = "orderBy";
- public static final String ORIENTATION = "orientation";
- public static final String PAGE_MENU = "pageMenu";
- public static final String PASSWORD = "password";
- public static final String POPUP_CLOSE = "popupClose";
- public static final String POPUP_LIST = "popupList";
- public static final String POPUP_RESET = "popupReset";
- public static final String POPUP_CALENDAR_ID = "popupCalendarId";
- public static final String PREFORMATED = "preformated";
- public static final String READONLY = "readonly";
- public static final String REFERENCE = "reference";
- public static final String RELATIVE = "relative";
- public static final String RENDERED = "rendered";
- public static final String RENDERED_PARTIALLY = "renderedPartially";
- public static final String RENDERER_TYPE = "rendererType";
- public static final String RENDER_AS = "renderAs";
- public static final String RENDER_RANGE = "renderRange";
- public static final String RENDER_RANGE_EXTERN = "renderRangeExtern";
- public static final String REQUIRED = "required";
- public static final String ROW_ID = "rowId";
- public static final String ROWS = "rows";
- public static final String SCRIPT_FILES = "scriptFiles";
- public static final String SCROLLBAR_HEIGHT = "scrollbarHeight";
- public static final String SCROLLBARS = "scrollbars";
- // Attribute name could not be the same as the method name
- // this cause an infinite loop on attribute map
- public static final String SCROLL_POSITION = "attrScrollPosition";
- public static final String SELECTED_INDEX = "selectedIndex";
- public static final String SELECTED_LIST_STRING = "selectedListString";
- public static final String SORTABLE = "sortable";
- public static final String SELECTABLE = "selectable";
- public static final String SHOW_DIRECT_LINKS = "showDirectLinks";
- public static final String SHOW_HEADER = "showHeader";
- public static final String SHOW_ICONS = "showIcons";
- public static final String SHOW_JUNCTIONS = "showJunctions";
- public static final String SHOW_PAGE_RANGE = "showPageRange";
- public static final String SHOW_ROOT = "showRoot";
- public static final String SHOW_ROOT_JUNCTION = "showRootJunction";
- public static final String SHOW_ROW_RANGE = "showRowRange";
- public static final String SHOW_SUMMARY = "showSummary";
- public static final String SHOW_DETAIL = "showDetail";
- public static final String SPAN_X = "spanX";
- public static final String SPAN_Y = "spanY";
- public static final String SRC = "src";
- public static final String STATE = "state";
- public static final String STATE_PREVIEW = "statePreview";
- public static final String STYLE = "style";
- public static final String STYLE_BODY = "style_body";
- public static final String STYLE_CLASS = "styleClass";
- public static final String STYLE_HEADER = "style_header";
- public static final String STYLE_INNER = "style_inner";
- public static final String STYLE_FILES = "styleFiles";
- public static final String SUPPRESS_TOOLBAR_CONTAINER = "suppressToolbarContainer";
- public static final String SWITCH_TYPE = "switchType";
- public static final String TAB_INDEX = "tabIndex";
- public static final String TARGET = "target";
- public static final String TIME_STYLE = "timeStyle";
- public static final String TIMEZONE = "timezone";
- public static final String TITLE = "title";
- public static final String TIP = "tip";
- public static final String TOP = "top";
- public static final String TRANSITION = "transition";
- public static final String TYPE = "type";
- public static final String VALUE = "value";
- public static final String VALUE_CHANGE_LISTENER = "valueChangeListener";
- public static final String VAR = "var";
- public static final String UNIT = "unit";
- public static final String UPDATE = "update";
- public static final String VALIDATOR = "validator";
- public static final String WIDTH = "width";
- public static final String WIDTH_LIST = "widthList";
- public static final String WIDTH_LIST_STRING = "widthListString";
- public static final String Z_INDEX = "zIndex";
+ // todo: add some tag names
+
+ public static final String GRID_LAYOUT_CONSTRAINT = "gridLayoutConstraint";
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java Fri Jun 26 12:13:41 2009
@@ -17,12 +17,9 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.layout.Component;
-import org.apache.myfaces.tobago.layout.Constraints;
import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.context.FacesContext;
@@ -31,8 +28,6 @@
public abstract class UIInputBase extends javax.faces.component.UIInput
implements AjaxComponent, SupportsMarkup, Component {
- private static final Log LOG = LogFactory.getLog(UIInputBase.class);
-
// TODO can this removed?
public void updateModel(FacesContext facesContext) {
if (ComponentUtil.mayUpdateModel(this)) {
@@ -46,17 +41,4 @@
public abstract Integer getTabIndex();
-// LAYOUT Begin
- public Constraints getConstraints() {
- AbstractUIGridConstraints constraints = (AbstractUIGridConstraints) getFacet(Facets.CONSTRAINTS);
-
- // fixme
- if (constraints == null) {
- constraints = new MockUIGridConstraints();
- getFacets().put(Facets.CONSTRAINTS, constraints);
- }
- return constraints;
- }
-
- // LAYOUT End
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java Fri Jun 26 12:13:41 2009
@@ -20,7 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.renderkit.LayoutRenderer;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
@@ -43,19 +43,19 @@
}
private static void setInnerWidth(FacesContext facesContext, UIComponent component) {
- Integer layoutWidth = LayoutUtil.getLayoutWidth(component);
+ Integer layoutWidth = LayoutUtils.getLayoutWidth(component);
if (layoutWidth != null) {
int space = layoutWidth.intValue();
- int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, true);
+ int innerSpace = LayoutUtils.getInnerSpace(facesContext, component, space, true);
component.getAttributes().put(Attributes.INNER_WIDTH, Integer.valueOf(innerSpace));
}
}
private static void setInnerHeight(FacesContext facesContext, UIComponent component) {
- Integer layoutHeight = LayoutUtil.getLayoutHeight(component);
+ Integer layoutHeight = LayoutUtils.getLayoutHeight(component);
if (layoutHeight != null) {
int space = layoutHeight.intValue();
- int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, false);
+ int innerSpace = LayoutUtils.getInnerSpace(facesContext, component, space, false);
component.getAttributes().put(Attributes.INNER_HEIGHT, Integer.valueOf(innerSpace));
}
}
@@ -67,11 +67,7 @@
public static UILayout getLayout(UIComponent component) {
UILayout layout = (UILayout) component.getFacet(Facets.LAYOUT);
if (layout == null) {
- if (component instanceof LayoutProvider) {
- layout = ((LayoutProvider) component).provideLayout();
- } else {
- layout = UIDefaultLayout.getInstance();
- }
+ layout = UIDefaultLayout.getInstance();
}
return layout;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java Fri Jun 26 12:13:41 2009
@@ -31,20 +31,9 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-/*
- * User: weber
- * Date: Feb 28, 2005
- * Time: 3:05:19 PM
- */
-public class UIPanelBase extends javax.faces.component.UIPanel
+public abstract class UIPanelBase extends javax.faces.component.UIPanel
implements AjaxComponent, InvokeOnComponent {
- public void encodeChildren(FacesContext facesContext) throws IOException {
- if (isRendered()) {
- UILayout.getLayout(this).encodeChildrenOfComponent(facesContext, this);
- }
- }
-
public void processDecodes(FacesContext context) {
if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoFacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoFacesContext.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoFacesContext.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoFacesContext.java Fri Jun 26 12:13:41 2009
@@ -22,9 +22,9 @@
import org.apache.myfaces.tobago.component.AbstractUIPopup;
import javax.faces.context.FacesContext;
-import java.util.Set;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
public class TobagoFacesContext extends FacesContextWrapper {
@@ -39,7 +39,7 @@
private Set<String> styleBlocks;
- private Set<String> onloadScripts;
+ private SetUniqueList onloadScripts;
private Set<String> onunloadScripts;
@@ -63,7 +63,7 @@
styleFiles = new ListOrderedSet();
styleFiles.add(DEFAULT_STYLE);
styleBlocks = new ListOrderedSet();
- onloadScripts = new ListOrderedSet();
+ onloadScripts = SetUniqueList.decorate(new ArrayList());
onunloadScripts = new ListOrderedSet();
onexitScripts = new ListOrderedSet();
onsubmitScripts = new ListOrderedSet();
@@ -111,7 +111,7 @@
return styleBlocks;
}
- public Set<String> getOnloadScripts() {
+ public List<String> getOnloadScripts() {
return onloadScripts;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Component.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Component.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Component.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Component.java Fri Jun 26 12:13:41 2009
@@ -17,10 +17,45 @@
* limitations under the License.
*/
-/**
- * Date: 23.01.2008 20:10:36
- */
+// XXX rename to LayoutComponent
public interface Component {
- Constraints getConstraints();
+ Integer getColumnSpan();
+ void setColumnSpan(Integer columnSpan);
+
+ Integer getRowSpan();
+ void setRowSpan(Integer rowSpan);
+
+ Measure getWidth();
+ void setWidth(Measure width);
+
+ Measure getHeight();
+ void setHeight(Measure height);
+
+ void setMinimumWidth(Measure minimumWidth);
+
+ void setMinimumHeight(Measure minimumHeight);
+
+ void setPreferredWidth(Measure preferredWidth);
+
+ void setPreferredHeight(Measure preferredHeight);
+
+ void setMaximumWidth(Measure maximumWidth);
+
+ void setMaximumHeight(Measure maximumHeight);
+
+ Measure getLeft();
+ void setLeft(Measure left);
+
+ Measure getTop();
+ void setTop(Measure top);
+
+ Integer getHorizontalIndex();
+ void setHorizontalIndex(Integer horizontalIndex);
+
+ Integer getVerticalIndex();
+ void setVerticalIndex(Integer verticalIndex);
+
+ Display getDisplay();
+ void setDisplay(Display display);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Constraints.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Constraints.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Constraints.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Constraints.java Fri Jun 26 12:13:41 2009
@@ -20,5 +20,6 @@
/*
* Date: 13.02.2008 20:47:02
*/
+// XXX rename to LayoutContraint
public interface Constraints {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Container.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Container.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Container.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Container.java Fri Jun 26 12:13:41 2009
@@ -19,9 +19,7 @@
import java.util.List;
-/**
- * Date: 23.01.2008 20:10:16
- */
+// XXX rename to LayoutContainer
public interface Container extends Component {
List<Component> getComponents();
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Display.java (from r788313, myfaces/tobago/branches/tobago-1.1.x-progress-layout/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Display.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Display.java&p1=myfaces/tobago/branches/tobago-1.1.x-progress-layout/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java&r1=788313&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.1.x-progress-layout/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Display.java Fri Jun 26 12:13:41 2009
@@ -17,28 +17,18 @@
* limitations under the License.
*/
-import org.apache.commons.lang.StringUtils;
+public enum Display {
-/*
- * Date: 23.01.2008 20:12:30
- */
-public abstract class Measure {
+ BLOCK("block"),
+ INLINE("inline");
- // todo: refactor and consolidate with LayoutToken
+ private String value;
- public static Measure parse(String value) {
- if (StringUtils.isEmpty(value)) {
- return new PixelMeasure(0); // fixme: may return a "default measure", or is Pixel the default?
- }
- if (value.toLowerCase().matches("\\d+px")) {// XXX no regexp here: user LayoutTokens.parse !!!
- return new PixelMeasure(Integer.parseInt(value.substring(0, value.length() - 2)));
- }
- throw new IllegalArgumentException("Can't parse to any measure: '" + value + "'");
+ Display(String value) {
+ this.value = value;
}
- public abstract Measure add(Measure m);
-
- public abstract Measure substractNotNegative(Measure m);
-
- public abstract int getPixel();
+ public String getValue() {
+ return value;
+ }
}
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=788668&r1=788667&r2=788668&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 Fri Jun 26 12:13:41 2009
@@ -17,15 +17,10 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.AbstractUIGridConstraints;
import org.apache.myfaces.tobago.layout.math.EquationManager;
public class LayoutContext {
- private static final Log LOG = LogFactory.getLog(LayoutContext.class);
-
private EquationManager horizontal;
private EquationManager vertical;
private Container container;
@@ -46,22 +41,21 @@
public void layout() {
- horizontal.setFixedLength(0, ((AbstractUIGridConstraints) container.getConstraints()).getWidth().getPixel());
- vertical.setFixedLength(0, ((AbstractUIGridConstraints) container.getConstraints()).getHeight().getPixel());
+ horizontal.addComponentRoot();
+ vertical.addComponentRoot();
+
+ if (container.getWidth() != null) {
+ horizontal.setFixedLength(0, container.getWidth().getPixel());
+ }
+ if (container.getHeight() != null) {
+ vertical.setFixedLength(0, container.getHeight().getPixel());
+ }
- horizontal.descend(0, 1);
- vertical.descend(0, 1);
- container.getLayoutManager().collect(this, container);
- horizontal.ascend();
- vertical.ascend();
+ container.getLayoutManager().collect(this, container, 0, 0);
horizontal.solve();
vertical.solve();
- horizontal.descend(0, 1);
- vertical.descend(0, 1);
container.getLayoutManager().distribute(this, container);
- horizontal.ascend();
- vertical.ascend();
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java Fri Jun 26 12:13:41 2009
@@ -19,7 +19,7 @@
public interface LayoutManager {
- void collect(LayoutContext layoutContext, Container container);
+ void collect(LayoutContext layoutContext, Container container, int horizontalIndex, int verticalIndex);
void distribute(LayoutContext layoutContext, Container container);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java Fri Jun 26 12:13:41 2009
@@ -18,11 +18,19 @@
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.Serializable;
/*
* Date: 23.01.2008 20:12:30
*/
-public abstract class Measure {
+public abstract class Measure implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log LOG = LogFactory.getLog(Measure.class);
// todo: refactor and consolidate with LayoutToken
@@ -33,6 +41,10 @@
if (value.toLowerCase().matches("\\d+px")) {// XXX no regexp here: user LayoutTokens.parse !!!
return new PixelMeasure(Integer.parseInt(value.substring(0, value.length() - 2)));
}
+ if (value.matches("\\d+")) {// XXX no regexp here: user LayoutTokens.parse !!!
+ LOG.warn("Measure parser found value without unit. Assuming px for value='" + value + "'.");
+ return new PixelMeasure(Integer.parseInt(value));
+ }
throw new IllegalArgumentException("Can't parse to any measure: '" + value + "'");
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java Fri Jun 26 12:13:41 2009
@@ -35,6 +35,10 @@
this.pixel = pixel;
}
+ public PixelMeasure(double value) {
+ this((int) (value + 0.5));
+ }
+
public Measure add(Measure m) {
return new PixelMeasure(pixel + m.getPixel());
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java Fri Jun 26 12:13:41 2009
@@ -24,4 +24,8 @@
Component getComponent();
RealCell getRealCell();
+
+ boolean isInFirstRow();
+
+ boolean isInFirstColumn();
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java Fri Jun 26 12:13:41 2009
@@ -79,7 +79,7 @@
if (i == 0 && j == 0) {
actualCell = cell;
} else {
- actualCell = new PseudoCell(cell);
+ actualCell = new PseudoCell(cell, i == 0, j == 0);
}
assert grid.get(i + columnCursor, j + rowCursor) == null : "Position in the cell must be free.";
grid.set(i + columnCursor, j + rowCursor, actualCell);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/PseudoCell.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/PseudoCell.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/PseudoCell.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/PseudoCell.java Fri Jun 26 12:13:41 2009
@@ -22,9 +22,13 @@
public class PseudoCell implements Cell {
private RealCell realCell;
+ private boolean inFirstColumn;
+ private boolean inFirstRow;
- public PseudoCell(RealCell realCell) {
+ public PseudoCell(RealCell realCell, boolean inFirstColumn, boolean inFirstRow) {
this.realCell = realCell;
+ this.inFirstColumn = inFirstColumn;
+ this.inFirstRow = inFirstRow;
}
public Component getComponent() {
@@ -34,4 +38,12 @@
public RealCell getRealCell() {
return realCell;
}
+
+ public boolean isInFirstColumn() {
+ return inFirstColumn;
+ }
+
+ public boolean isInFirstRow() {
+ return inFirstRow;
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/RealCell.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/RealCell.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/RealCell.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/RealCell.java Fri Jun 26 12:13:41 2009
@@ -37,6 +37,14 @@
return this;
}
+ public boolean isInFirstRow() {
+ return true;
+ }
+
+ public boolean isInFirstColumn() {
+ return true;
+ }
+
public int getColumnSpan() {
return columnSpan;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java Fri Jun 26 12:13:41 2009
@@ -28,69 +28,69 @@
private static final Log LOG = LogFactory.getLog(EquationManager.class);
private SystemOfEquations equations;
- private Node current;
private double[] result;
- public EquationManager() {
- equations = new SystemOfEquations(0);
- current = new Node(0, null);
- addSubTree(1);
+ public int addComponentRoot() {
+ equations = new SystemOfEquations(1);
+ return 0;
}
- public void addSubTree(int number) {
-
- assert number > 0;
- int n = equations.getNumberOfVariables();
- int[] newIndices = equations.addVariables(number);
- if (!current.isRoot()) {
- equations.addEqualsEquation(new PartitionEquation(
- newIndices[0], newIndices[newIndices.length - 1] + 1, current.getIndexOfVariable(), current.getSpan()));
- }
- for (int i = n; i < n + number; i++) {
- assert newIndices[i - n] == i;
- current.getChildren().add(new Node(i, current));
- }
- }
-
- public void descend(int index, int span) {
- current = current.getChildren().get(index);
- current.setSpan(span);
+ public void setFixedLength(int index, int length) {
+ equations.addEqualsEquation(new FixedEquation(index, length));
+ LOG.info(equations);
}
- public void ascend() {
- current = current.getParent();
+ public int[] divide(int index, int number) {
+ int[] newIndices = addSubTree(index, number, 1);
+ LOG.info(equations);
+ return newIndices;
}
- public void setFixedLength(int index, int length) {
- equations.addEqualsEquation(new FixedEquation(getIndexOfVariable(index), length));
+ public int addComponent(int index, int span) {
+ int[] newIndices = addSubTree(index, 1, span);
+ LOG.info(equations);
+ return newIndices[0];
}
- private int getIndexOfVariable(int index) {
- return current.getChildren().get(index).getIndexOfVariable();
+ private int[] addSubTree(int index, int number, int span) {
+
+ assert number > 0;
+ assert span > 0;
+
+ int[] newIndices = equations.addVariables(number);
+ equations.addEqualsEquation(new PartitionEquation(
+ newIndices[0],
+ newIndices[newIndices.length - 1] + 1,
+ index,
+ span));
+ return newIndices;
}
public void setProportion(int index1, int index2, int factor1, int factor2) {
- equations.addEqualsEquation(
- new ProportionEquation(getIndexOfVariable(index1), getIndexOfVariable(index2), factor1, factor2));
+ equations.addEqualsEquation(new ProportionEquation(index1, index2, factor1, factor2));
+ LOG.info(equations);
}
public void solve() {
+
+ LOG.info("solve:\n" + equations);
+
equations.prepare();
equations.gauss();
- equations.step2();
+ equations.reduce();
result = equations.result();
}
- public double getValue() {
- assert result != null;
- double sum = 0.0;
- for (int i = 0; i < current.getSpan(); i++) {
- sum += result[current.getIndexOfVariable() + i];
- }
- return sum;
- }
-
public double[] getResult() {
return result;
}
+
+ public int getNumberOfVariable() {
+ return equations.getNumberOfVariables();
+ }
+
+ @Override
+ public String toString() {
+ return "EquationManager: " + equations.toString();
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java Fri Jun 26 12:13:41 2009
@@ -34,4 +34,9 @@
row[index] = 1.0;
row[row.length - 1] = result;
}
+
+ @Override
+ public String toString() {
+ return "FixedEquation: x_" + index + " = " + result;
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java Fri Jun 26 12:13:41 2009
@@ -31,11 +31,10 @@
private int span;
/**
- *
- * @param begin lowest index
- * @param end one more than the largest index
+ * @param begin lowest index
+ * @param end one more than the largest index
* @param parent parent index
- * @param span number of parent cells
+ * @param span number of parent cells
*/
public PartitionEquation(int begin, int end, int parent, int span) {
this.begin = begin;
@@ -45,7 +44,7 @@
}
public void fillRow(double[] row) {
- assert begin >= 0 && end > 0 && parent >=0 && span > 0;
+ assert begin >= 0 && end > 0 && parent >= 0 && span > 0;
assert begin < end;
assert parent + span <= begin || parent >= end;
@@ -64,4 +63,29 @@
row[i] = -1.0;
}
}
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("PartitionEquation: ");
+ builder.append(" x_");
+ builder.append(parent);
+ if (span > 2) {
+ builder.append(" + ...");
+ }
+ if (span >= 2) {
+ builder.append(" + x_");
+ builder.append(parent + span - 1);
+ }
+ builder.append(" = ");
+ builder.append("x_");
+ builder.append(begin);
+ if (end - begin > 2) {
+ builder.append(" + ...");
+ }
+ if (end - begin >= 2) {
+ builder.append(" + x_");
+ builder.append(end - 1);
+ }
+ return builder.toString();
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java Fri Jun 26 12:13:41 2009
@@ -30,16 +30,21 @@
this.factor1 = factor1;
this.factor2 = factor2;
}
-/*
- public void fillRow(double[] row) {
- Arrays.fill(row, 0.0);
- row[index1] = factor2;
- row[index2] = -factor1;
- }
-*/
+
public void fillRow(double[] row) {
for (int i = 0; i < row.length; i++) {
- row[i] = i == index1 ? factor2 : i == index2 ? -factor1 : 0.0;
+ row[i]
+ = i == index1
+ ? factor2
+ : i == index2
+ ? -factor1
+ : 0.0;
}
}
+
+ @Override
+ public String toString() {
+ return "ProportionEquation: " + factor2 + " * x_" + index1 + " = " + factor1 + " * x_" + index2;
+ }
+
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Node.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Node.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Node.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java Fri Jun 26 12:13:41 2009
@@ -17,21 +17,29 @@
* limitations under the License.
*/
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import java.util.ArrayList;
import java.util.List;
-public class Node {
+public class ReferenceToVariable {
+
+ private static final Log LOG = LogFactory.getLog(ReferenceToVariable.class);
private int indexOfVariable;
- private List<Node> children;
- private Node parent;
+ private List<SubsetOfReferencesToVariables> subsets;
+ private List<ReferenceToVariable> children;
+ private int currentSubsetIndex;
+ private ReferenceToVariable parent;
private int span;
- public Node(int indexOfVariable, Node parent) {
+ public ReferenceToVariable(int indexOfVariable, ReferenceToVariable parent) {
this.indexOfVariable = indexOfVariable;
this.parent = parent;
- this.children = new ArrayList<Node>();
+ this.subsets = new ArrayList<SubsetOfReferencesToVariables>();
+ this.currentSubsetIndex = -1;
}
public int getIndexOfVariable() {
@@ -42,11 +50,39 @@
this.indexOfVariable = indexOfVariable;
}
- public List<Node> getChildren() {
+ public void newChildrenSet() {
+ subsets.add(new SubsetOfReferencesToVariables());
+ incrementCurrentSubsetIndex();
+ }
+
+ public List<ReferenceToVariable> getChildren() {
return children;
}
- public Node getParent() {
+ @Deprecated
+ public SubsetOfReferencesToVariables getCurrentSubset() {
+ try {
+ return subsets.get(currentSubsetIndex);
+ } catch (IndexOutOfBoundsException e) {
+ LOG.error("Error in algorythm! Continuing with wrong Data...", e);
+ return subsets.get(subsets.size() - 1);
+ }
+ }
+
+ public void incrementCurrentSubsetIndex() {
+ currentSubsetIndex++;
+ }
+
+ public void resetCurrentSubsetIndex() {
+ currentSubsetIndex = -1;
+ for (SubsetOfReferencesToVariables nodes : subsets) {
+ for (ReferenceToVariable node : nodes.getVariables()) {
+ node.resetCurrentSubsetIndex();
+ }
+ }
+ }
+
+ public ReferenceToVariable getParent() {
return parent;
}
@@ -61,4 +97,34 @@
public void setSpan(int span) {
this.span = span;
}
+
+ @Override
+ public String toString() {
+ return toString(0);
+ }
+
+ public String toString(int depth) {
+ StringBuilder builder = new StringBuilder();
+
+ repeat(builder, " ", depth);
+
+ builder
+ .append("x_")
+ .append(indexOfVariable)
+ .append("\n");
+
+ LOG.info(builder);
+
+ for (SubsetOfReferencesToVariables subset : subsets) {
+ builder.append(subset.toString(depth + 1, indexOfVariable));
+ }
+
+ return builder.toString();
+ }
+
+ private void repeat(StringBuilder builder, String value, int count) {
+ for (int i = 0; i < count; i++) {
+ builder.append(value);
+ }
+ }
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java?rev=788668&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java Fri Jun 26 12:13:41 2009
@@ -0,0 +1,68 @@
+package org.apache.myfaces.tobago.layout.math;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SubsetOfReferencesToVariables {
+
+ private static final Log LOG = LogFactory.getLog(SubsetOfReferencesToVariables.class);
+
+ private final List<ReferenceToVariable> variables;
+
+ public SubsetOfReferencesToVariables() {
+ this.variables = new ArrayList<ReferenceToVariable>();
+ }
+
+ public List<ReferenceToVariable> getVariables() {
+ return variables;
+ }
+
+ @Override
+ public String toString() {
+ return toString(0, 0);
+ }
+
+ public String toString(int depth, int indexOfVariable) {
+ StringBuilder builder = new StringBuilder();
+ repeat(builder, " ", depth);
+ builder.append("S(");
+ builder.append("x_");
+ builder.append(indexOfVariable);
+ builder.append(")\n");
+
+ LOG.info(builder);
+
+ for (ReferenceToVariable variable : variables) {
+ builder.append(variable.toString(depth + 1));
+ }
+
+ return builder.toString();
+ }
+
+ private void repeat(StringBuilder builder, String value, int count) {
+ for (int i = 0; i < count; i++) {
+ builder.append(value);
+ }
+ }
+
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java Fri Jun 26 12:13:41 2009
@@ -83,28 +83,43 @@
private static final Log LOG = LogFactory.getLog(SystemOfEquations.class);
+ /**
+ * Values smaller than this EPSILON should be treated as zero.
+ */
+ public static final double EPSILON = 0.0000001;
+
private int numberOfVariables;
private List<Equation> equations = new ArrayList<Equation>();
private double[][] data;
+ private Step step;
public SystemOfEquations(int numberOfVariables) {
this.numberOfVariables = numberOfVariables;
+ this.step = Step.NEW;
}
public void addEqualsEquation(FixedEquation equation) {
+ assert step == Step.NEW;
+
equations.add(equation);
}
public void addEqualsEquation(PartitionEquation equation) {
+ assert step == Step.NEW;
+
equations.add(equation);
}
public void addEqualsEquation(ProportionEquation equation) {
+ assert step == Step.NEW;
+
equations.add(equation);
}
public int[] addVariables(int number) {
+ assert step == Step.NEW;
assert number > 0;
+
int[] indices = new int[number];
for (int i = 0; i < number; i++) {
indices[i] = numberOfVariables + i;
@@ -114,7 +129,20 @@
}
public void prepare() {
+ assert step == Step.NEW;
+ step = step.next();
// data = new double[equations.size() + equalEquations.size()][];
+
+ // if there are more variables than equations
+ // fill the rest with zero rows.
+ for (int j = equations.size(); j < numberOfVariables; j++) {
+ equations.add(new ZeroEquation());
+ }
+
+ if (numberOfVariables != equations.size()) {
+ LOG.warn("SOE have not korrekt dimensions: " + this);
+ }
+
data = new double[equations.size()][];
for (int i = 0; i < equations.size(); i++) {
data[i] = new double[numberOfVariables + 1];
@@ -125,22 +153,38 @@
data[i + equations.size()] = equalEquations.get(i);
}
*/
+ step = step.next();
}
public void gauss() {
-// prepare();
+ LOG.info(this);
- for (int j = 0; j < data.length; j++) {
+ assert step == Step.PREPARED;
+ step = step.next();
+
+ int min = Math.min(data.length, numberOfVariables);
+
+ for (int j = 0; j < min; j++) {
// normalize row
+ LOG.info(this);
double factor = data[j][j];
- if (factor == 0) {
+ if (isZero(factor)) {
int nonZeroIndex = findNonZero(j);
if (nonZeroIndex != -1) {
swapRow(j, nonZeroIndex);
factor = data[j][j];
} else {
- LOG.info("nicht eindeutig lösbar");
+ int fullZeroIndex = findFullZero();
+ if (fullZeroIndex != -1) {
+ swapRow(j, fullZeroIndex);
+ data[j][j] = 1.0;
+ data[j][numberOfVariables] = 100.0; // todo: default
+ LOG.warn("Setting free (undefined) variable x_" + j + " to " + data[j][numberOfVariables]);
+ factor = data[j][j];
+ } else {
+ LOG.error("Not unique solvable: " + this);
+ }
}
}
divideRow(j, factor);
@@ -149,17 +193,32 @@
substractMultipleOfRowJToRowK(j, k);
}
}
+
+ step = step.next();
}
- public void step2() {
+ public void reduce() {
+ assert step == Step.TRIANGULAR;
+ step = step.next();
+
+ LOG.info(this);
for (int j = equations.size() - 1; j >= 0; j--) {
+ if (rowNull(j)) {
+ LOG.error("Not solvable: " + this);
+ continue;
+ }
for (int k = j - 1; k >= 0; k--) {
substractMultipleOfRowJToRowK(j, k);
}
}
+
+ step = step.next();
}
public double[] result() {
+ assert step == Step.DIAGONAL;
+
+ LOG.info(this);
double[] result = new double[numberOfVariables];
for (int i = 0; i < numberOfVariables; i++) {
result[i] = data[i][numberOfVariables];
@@ -174,14 +233,35 @@
}
private int findNonZero(int j) {
- for (int k = j + 1; k < equations.size(); k++) {
- if (data[k][j] != 0.0) {
+ for (int k = j + 1; k < data.length; k++) {
+ if (isNotZero(data[k][j])) {
return k;
}
}
return -1;
}
+ /**
+ * Searches for a row where all values are zero (comes from ZeroEquation)
+ *
+ * @return The row index or -1 if nothing was found.
+ */
+ private int findFullZero() {
+ for (int j = data.length - 1; j >= 0; j--) {
+ boolean allZero = true;
+ for (double value : data[j]) {
+ if (isNotZero(value)) {
+ allZero = false;
+ break;
+ }
+ }
+ if (allZero) {
+ return j;
+ }
+ }
+ return -1;
+ }
+
private void divideRow(int j, double denominator) {
// todo: denominator != null
for (int i = 0; i < numberOfVariables + 1; i++) {
@@ -191,13 +271,37 @@
private void substractMultipleOfRowJToRowK(int j, int k) {
double factor = data[k][j];
- if (factor != 0) {
+ if (isNotZero(factor)) {
for (int i = 0; i < numberOfVariables + 1; i++) {
data[k][i] -= data[j][i] * factor;
}
}
}
+ private boolean isZero(double factor) {
+ return Math.abs(factor) < EPSILON;
+ }
+
+ private boolean isNotZero(double factor) {
+ return Math.abs(factor) >= EPSILON;
+ }
+
+ /**
+ * Determines if the row j has only null entries, accept the last one.
+ *
+ * @param j Index of the row to test.
+ * @return Is the row quasi null?
+ */
+ private boolean rowNull(int j) {
+ for (int i = 0; i < numberOfVariables; i++) {
+ if (isNotZero(data[j][i])) {
+ return false;
+ }
+ }
+ return true;
+
+ }
+
public double[][] getData() {
return data;
}
@@ -208,25 +312,51 @@
@Override
public String toString() {
- String result;
- if (data == null) { // the toString0 needed the data, but it may not be initilized.
- prepare();
- result = toString0();
- data = null; // reset the state
- } else {
- result = toString0();
+ StringBuilder builder = new StringBuilder();
+ builder.append(
+ step + " number of equations=" + equations.size() + " number of variables=" + numberOfVariables + " ");
+ switch (step) {
+ case NEW:
+ case PREPARE_IN_PROGRESS:
+ toString1(builder, equations);
+ break;
+ case PREPARED:
+ toString0(builder, true);
+ break;
+ default:
+ toString0(builder, false);
+ break;
+ }
+ return builder.toString();
+ }
+
+ private void toString0(StringBuilder builder, boolean showEquation) {
+ builder.append("[\n");
+ for (int i = 0; i < data.length; i++) {
+ builder.append(Arrays.toString(data[i]));
+ if (showEquation) {
+ builder.append(" from ");
+ builder.append(equations.get(i));
+ }
+ builder.append("\n");
}
- return result;
+ builder.append("]");
}
- private String toString0() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("[\n");
- for (double[] row : data) {
- buffer.append(Arrays.toString(row));
- buffer.append("\n");
+ private void toString1(StringBuilder builder, List<Equation> equations) {
+ builder.append("[\n");
+ for (Equation equation : equations) {
+ builder.append(equation);
+ builder.append(",\n");
+ }
+ builder.append("]");
+ }
+
+ private static enum Step {
+ NEW, PREPARE_IN_PROGRESS, PREPARED, GAUSS_IN_PROGRESS, TRIANGULAR, REDUCE_IN_PROGRESS, DIAGONAL;
+
+ public Step next() {
+ return values()[ordinal() + 1];
}
- buffer.append("]");
- return buffer.toString();
}
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java Fri Jun 26 12:13:41 2009
@@ -19,19 +19,14 @@
import java.util.Arrays;
-public final class FixedEquation implements Equation {
-
- private int index;
- private double result;
-
- public FixedEquation(int index, double result) {
- this.index = index;
- this.result = result;
- }
+public final class ZeroEquation implements Equation {
public void fillRow(double[] row) {
Arrays.fill(row, 0.0);
- row[index] = 1.0;
- row[row.length - 1] = result;
+ }
+
+ @Override
+ public String toString() {
+ return "ZeroEquation (no meaning)";
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRenderer.java Fri Jun 26 12:13:41 2009
@@ -20,7 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -52,7 +52,7 @@
LOG.info("Can't calculate fixedHeight! "
+ "using estimation by contained components. ");
}
- height += LayoutUtil.calculateFixedHeightForChildren(facesContext, component);
+ height += LayoutUtils.calculateFixedHeightForChildren(facesContext, component);
LayoutInformationProvider containerRenderer =
ComponentUtil.getRenderer(facesContext, component);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java Fri Jun 26 12:13:41 2009
@@ -28,7 +28,7 @@
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UILayout;
import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -64,7 +64,7 @@
+ "using estimation by contained components. ");
}
- height = LayoutUtil.calculateFixedHeightForChildren(facesContext, component);
+ height = LayoutUtils.calculateFixedHeightForChildren(facesContext, component);
height += getHeaderHeight(facesContext, component);
height += getPaddingHeight(facesContext, component);
return height;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java Fri Jun 26 12:13:41 2009
@@ -27,7 +27,7 @@
import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -109,7 +109,7 @@
int fixedSpace = 0;
if (component instanceof Cell) {
- List children = LayoutUtil.addChildren(new ArrayList(), component);
+ List children = LayoutUtils.addChildren(new ArrayList(), component);
for (Object aChildren : children) {
UIComponent child = (UIComponent) aChildren;
@@ -164,7 +164,7 @@
public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
- prepareDimension(facesContext, component);
+// prepareDimension(facesContext, component);
final String rendererType = component.getRendererType();
if (rendererType != null) {
final String rendererName = getRendererName(rendererType);
@@ -173,8 +173,8 @@
} else {
LOG.error("No renderType for " + component);
}
- layoutSpace(facesContext, component, true);
- layoutSpace(facesContext, component, false);
+// layoutSpace(facesContext, component, true);
+// layoutSpace(facesContext, component, false);
}
void prepareDimension(FacesContext facesContext, UIComponent component) {
@@ -184,19 +184,19 @@
}
void setInnerWidth(FacesContext facesContext, UIComponent component) {
- Integer layoutWidth = LayoutUtil.getLayoutWidth(component);
+ Integer layoutWidth = LayoutUtils.getLayoutWidth(component);
if (layoutWidth != null) {
int space = layoutWidth.intValue();
- int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, true);
+ int innerSpace = LayoutUtils.getInnerSpace(facesContext, component, space, true);
component.getAttributes().put(Attributes.INNER_WIDTH, Integer.valueOf(innerSpace));
}
}
void setInnerHeight(FacesContext facesContext, UIComponent component) {
- Integer layoutHeight = LayoutUtil.getLayoutHeight(component);
+ Integer layoutHeight = LayoutUtils.getLayoutHeight(component);
if (layoutHeight != null) {
int space = layoutHeight.intValue();
- int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, false);
+ int innerSpace = LayoutUtils.getInnerSpace(facesContext, component, space, false);
component.getAttributes().put(Attributes.INNER_HEIGHT, Integer.valueOf(innerSpace));
}
}
@@ -208,11 +208,11 @@
String layoutAttribute;
String styleAttribute;
if (width) {
- layoutSpace = LayoutUtil.getLayoutWidth(component);
+ layoutSpace = LayoutUtils.getLayoutWidth(component);
layoutAttribute = Attributes.LAYOUT_WIDTH;
styleAttribute = HtmlAttributes.WIDTH;
} else {
- layoutSpace = LayoutUtil.getLayoutHeight(component);
+ layoutSpace = LayoutUtils.getLayoutHeight(component);
layoutAttribute = Attributes.LAYOUT_HEIGHT;
styleAttribute = HtmlAttributes.HEIGHT;
}
@@ -223,7 +223,7 @@
if (space == -1
&& (!RendererTypes.OUT.equals(component.getRendererType()))) {
UIComponent parent = component.getParent();
- space = LayoutUtil.getInnerSpace(facesContext, parent, width);
+ space = LayoutUtils.getInnerSpace(facesContext, parent, width);
if (space > 0 && !ComponentUtil.isFacetOf(component, parent)) {
component.getAttributes().put(layoutAttribute, Integer.valueOf(space));
if (width) {
@@ -248,7 +248,7 @@
}
UIComponent layout = component.getFacet(Facets.LAYOUT);
if (layout != null) {
- int layoutSpace2 = LayoutUtil.getInnerSpace(facesContext, component,
+ int layoutSpace2 = LayoutUtils.getInnerSpace(facesContext, component,
width);
if (layoutSpace2 > 0) {
layout.getAttributes().put(layoutAttribute, Integer.valueOf(layoutSpace2));
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CssProperties.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CssProperties.java?rev=788668&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CssProperties.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CssProperties.java Fri Jun 26 12:13:41 2009
@@ -0,0 +1,33 @@
+package org.apache.myfaces.tobago.renderkit.css;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public final class CssProperties {
+
+ // to avoid instantiation
+ private CssProperties() {
+ }
+
+ public static final String DISPLAY = "display";
+
+ public static final String POSITION = "position";
+
+ public static final class Position {
+ public static final String ABSOLUTE = "absolute";
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlStyleMap.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlStyleMap.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlStyleMap.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlStyleMap.java Fri Jun 26 12:13:41 2009
@@ -54,7 +54,16 @@
return null;
}
LOG.error("", new Exception());
- return Integer.parseInt(obj.toString());
+ String string = obj.toString();
+ try {
+ return Integer.parseInt(string);
+ } catch (NumberFormatException e) {
+ LOG.warn("TODO: Fix measure issue in HtmlStyleMap: '" + obj + "'");
+ if (string.endsWith("px")) {
+ return Integer.parseInt(string.substring(0, string.length() - 2));
+ }
+ throw e;
+ }
}
public String toString() {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -24,7 +24,6 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
@@ -45,7 +44,7 @@
allowedChildComponenents = "org.apache.myfaces.tobago.GridLayout")})
-public interface BoxTagDeclaration extends HasIdBindingAndRendered, HasDeprecatedDimension, HasLabel {
+public interface BoxTagDeclaration extends HasIdBindingAndRendered, HasLabel {
/**
* Indicate markup of this component.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -21,11 +21,11 @@
import org.apache.myfaces.tobago.apt.annotation.Facet;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
import org.apache.myfaces.tobago.taglib.decl.HasCommandType;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedWidth;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasImage;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
@@ -35,6 +35,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.IsDefaultCommand;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
/*
@@ -49,16 +50,16 @@
@BodyContentDescription(anyTagOf = "facestag")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIButtonCommand",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UICommand",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIButton",
rendererType = RendererTypes.BUTTON,
allowedChildComponenents = "NONE",
facets = {
@Facet(name= Facets.CONFIRMATION, description = "Contains a UIOutput instance with the confirmation message.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Output"),
+ allowedChildComponenents = ComponentTypes.OUT),
@Facet(name=Facets.POPUP, description = "Contains a UIPopup instance.",
allowedChildComponenents = "org.apache.myfaces.tobago.Popup")})
public interface ButtonTagDeclaration extends AbstractCommandTagDeclaration,
HasIdBindingAndRendered, HasLabelAndAccessKey, HasImage,
- IsDisabled, HasCommandType, IsDefaultCommand, HasDeprecatedWidth, HasTip,
- IsInline, HasTarget, HasMarkup, HasTabIndex {
+ IsDisabled, HasCommandType, IsDefaultCommand, HasTip,
+ IsInline, HasTarget, HasMarkup, HasTabIndex, IsGridLayoutComponent {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -23,24 +23,30 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-
-/*
- * Date: 10.02.2006
- * Time: 22:20:01
- */
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
/**
* Renders a panel-like layout element with the ability to span over more than
* one layout cell. A cell may only contain one child.
+ * @deprecated The Cell is deprecated since Tobago 1.1
*/
+@Deprecated
@Tag(name = "cell")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UICell",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanelBase",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUICell",
interfaces = "org.apache.myfaces.tobago.component.Cell",
componentType = "org.apache.myfaces.tobago.Cell",
rendererType = RendererTypes.CELL)
-public interface CellTagDeclaration extends HasIdBindingAndRendered {
+public interface CellTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent {
+
+ @UIComponentTagAttribute(type = {"java.lang.Integer"},
+ defaultValue = "1")
+ void setColumnSpan(String columnSpan);
+
+ @UIComponentTagAttribute(type = {"java.lang.Integer"},
+ defaultValue = "1")
+ void setRowSpan(String rowSpan);
/**
* Count of layout columns to span over.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -21,15 +21,11 @@
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
-/*
- * Date: 20.02.2006
- * Time: 22:10:07
- */
-
/**
* Renders a UIComponent that represents a single column of data within a
* parent UIData component.
@@ -37,8 +33,8 @@
@Tag(name = "column")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIColumn",
- uiComponentBaseClass = "javax.faces.component.UIColumn",
- componentType = "org.apache.myfaces.tobago.Column")
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIColumn",
+ componentType = ComponentTypes.COLUMN)
//rendererType = "Column")
public interface ColumnTagDeclaration extends HasIdBindingAndRendered, HasLabel, HasTip {
/**