Author: julien(a)jboss.com
Date: 2008-06-30 14:27:15 -0400 (Mon, 30 Jun 2008)
New Revision: 11220
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Log:
add a bit of layouting and styling in ajax client
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java 2008-06-30
18:27:15 UTC (rev 11220)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Constants
+{
+
+ /** . */
+ public static final String LAYOUT_ID =
"org.jboss.portal.presentation.layout_id";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT = "simple";
+
+ /** . */
+ public static final String REGION_LAYOUT = "region";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT = "desktop";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT_ORIENTATION =
"org.jboss.portal.presentation.layout.simple.orientation";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT_INDEX =
"org.jboss.portal.presentation.layout.simple.index";
+
+ /** . */
+ public static final String VERTICAL_ORIENTATION = "vertical";
+
+ /** . */
+ public static final String HORIZONTAL_ORIENTATION = "horizontal";
+
+ /** . */
+ public static final String REGION_LAYOUT_TEMPLATE =
"org.jboss.portal.presentation.layout.region.template";
+
+ /** . */
+ public static final String REGION_LAYOUT_NAME =
"org.jboss.portal.presentation.layout.region.name";
+
+ /** . */
+ public static final String REGION_LAYOUT_INDEX =
"org.jboss.portal.presentation.layout.region.index";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT_X =
"org.jboss.portal.presentation.layout.desktop.x";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT_Y =
"org.jboss.portal.presentation.layout.desktop.y";
+
+}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-06-30
17:38:53 UTC (rev 11219)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-06-30
18:27:15 UTC (rev 11220)
@@ -52,20 +52,29 @@
private Map children;
/** . */
+ private Map properties;
+
+ /** . */
private AjaxObject parent;
- protected AjaxObject(String id)
+ protected AjaxObject(String id, Map properties)
{
this.id = id;
this.children = new HashMap();
+ this.properties = properties;
}
+ public final Object getPropertyValue(String propertyName)
+ {
+ return properties.get(propertyName);
+ }
+
public final Context getContext()
{
return context;
}
- public Collection getChildren()
+ public final Collection getChildren()
{
return children.values();
}
@@ -153,16 +162,16 @@
{
throw new IllegalStateException("Already a root
page");
}
- object = root = new AjaxPage(addObject.getObjectId());
+ object = root = new AjaxPage(addObject.getObjectId(),
addObject.getObjectProperties());
break;
case ObjectType.PAGE:
- object = root = new AjaxPage(addObject.getObjectId());
+ object = root = new AjaxPage(addObject.getObjectId(),
addObject.getObjectProperties());
break;
case ObjectType.WINDOW:
- object = new AjaxWindow(addObject.getObjectId());
+ object = new AjaxWindow(addObject.getObjectId(),
addObject.getObjectProperties());
break;
case ObjectType.PANE:
- object = new AjaxPane(addObject.getObjectId());
+ object = new AjaxPane(addObject.getObjectId(),
addObject.getObjectProperties());
break;
}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-06-30
17:38:53 UTC (rev 11219)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-06-30
18:27:15 UTC (rev 11220)
@@ -22,14 +22,16 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
public class AjaxPage extends AjaxPane
{
- public AjaxPage(String id)
+ public AjaxPage(String id, Map properties)
{
- super(id);
+ super(id, properties);
}
}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-06-30
17:38:53 UTC (rev 11219)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-06-30
18:27:15 UTC (rev 11220)
@@ -25,9 +25,14 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Panel;
import java.util.Iterator;
+import java.util.Map;
+import org.jboss.portal.presentation.ajax.client.Constants;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
@@ -39,25 +44,54 @@
private Label title;
/** . */
- private VerticalPanel container;
+ private Panel container;
/** . */
- private VerticalPanel widget;
+ private Widget widget;
- public AjaxPane(String id)
+ public AjaxPane(String id, Map properties)
{
- super(id);
+ super(id, properties);
//
Label title = new Label("Pane " + id);
+ VerticalPanel widget = new VerticalPanel();
+ Panel container;
//
- VerticalPanel container = new VerticalPanel();
- VerticalPanel widget = new VerticalPanel();
+ String layoutId = (String)getPropertyValue(Constants.LAYOUT_ID);
+
+ //
+ if (Constants.SIMPLE_LAYOUT.equals(layoutId))
+ {
+ String orientation =
(String)getPropertyValue(Constants.SIMPLE_LAYOUT_ORIENTATION);
+
+ //
+ if (orientation == null || !Constants.VERTICAL_ORIENTATION.equals(orientation))
+ {
+ container = new HorizontalPanel();
+ }
+ else
+ {
+ container = new VerticalPanel();
+ }
+ }
+ else
+ {
+ // todo
+ container = new VerticalPanel();
+ }
+
+ //
widget.add(title);
widget.add(container);
//
+ widget.setStyleName("pf-Pane");
+ title.setStyleName("pf-Title");
+ container.setStyleName("pf-Container");
+
+ //
this.title = title;
this.container = container;
this.widget = widget;
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-30
17:38:53 UTC (rev 11219)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-30
18:27:15 UTC (rev 11220)
@@ -63,9 +63,9 @@
/** . */
private HTML markup;
- public AjaxWindow(String id)
+ public AjaxWindow(String id, Map properties)
{
- super(id);
+ super(id, properties);
//
Label title = new Label("Window " + id);
@@ -75,6 +75,11 @@
widget.add(markup);
//
+ widget.setStyleName("pf-Window");
+ title.setStyleName("pf-Title");
+ markup.setStyleName("pf-Markup");
+
+ //
this.title = title;
this.markup = markup;
this.widget = widget;
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-06-30
17:38:53 UTC (rev 11219)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-06-30
18:27:15 UTC (rev 11220)
@@ -3,4 +3,28 @@
font-family:Courier New;
font-size:12px;
font-weight:bold;
+}
+
+.pf-Pane {
+border: 1px solid black;
+padding: 1px;
+}
+
+.pf-Window {
+border: 1px solid black;
+padding: 1px;
+}
+
+.pf-Title {
+border: 1px solid black;
+padding: 1px;
+}
+
+.pf-Markup {
+border: 1px solid black;
+padding: 1px;
+}
+.pf-Container {
+border: 1px solid black;
+padding: 1px;
}
\ No newline at end of file