Author: julien_viet
Date: 2010-01-07 19:51:57 -0500 (Thu, 07 Jan 2010)
New Revision: 1199
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java
Log:
- a bit more type safe
- added unsafe comments
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-08
00:38:50 UTC (rev 1198)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-08
00:51:57 UTC (rev 1199)
@@ -97,7 +97,7 @@
return (T)this;
}
- //
+ //
// public void processInit(WebuiRequestContext context) throws Exception {
// MonitorEvent<UIComponent> mevent = createMonitorEvent(Event.Phase.INIT,
context);
// config.getUIComponentLifecycle().init(this, context) ;
@@ -106,7 +106,7 @@
// mevent.broadcast() ;
// }
// }
- //
+ //
public void processDecode(WebuiRequestContext context) throws Exception
{
MonitorEvent<UIComponent> mevent = createMonitorEvent(Event.Phase.DECODE,
context);
@@ -258,7 +258,7 @@
String confirm = loadConfirmMesssage(event, context, beanId);
try
{
- return context.getURLBuilder().createURL(this, event.getName(), confirm, beanId,
params);
+ return context.getURLBuilder().createURL(this, event.getName(), confirm, beanId,
params).toString();
}
catch (Exception e)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java 2010-01-08
00:38:50 UTC (rev 1198)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java 2010-01-08
00:51:57 UTC (rev 1199)
@@ -39,11 +39,6 @@
private List<UIComponent> children;
- public void visit() throws Exception
- {
-
- }
-
public boolean hasChildren()
{
return children != null;
@@ -99,6 +94,7 @@
return null;
}
+ // todo (julien) : this is not type safe
@SuppressWarnings("unchecked")
public <T extends UIComponent> T getChildById(String id)
{
@@ -113,6 +109,7 @@
return null;
}
+ // todo (julien) : this is not type safe
@SuppressWarnings("unchecked")
public <T extends UIComponent> T getChild(int idx)
{
@@ -135,6 +132,7 @@
return null;
}
+ // todo (julien) : this is not type safe
@SuppressWarnings("unchecked")
public <T extends UIComponent> T replaceChild(String targetChildId, UIComponent
newComponent) throws Exception
{
@@ -154,7 +152,6 @@
throw new Exception("Cannot find the child : " + targetChildId);
}
- @SuppressWarnings("unchecked")
public <T extends UIComponent> T replaceChild(String targetChildId,
Class<T> type, String configId, String id)
throws Exception
{
@@ -162,7 +159,7 @@
WebuiApplication app = (WebuiApplication)context.getApplication();
UIComponent comp = app.createUIComponent(type, configId, id, context);
comp = replaceChild(targetChildId, comp);
- return (T)comp;
+ return type.cast(comp);
}
public <T extends UIComponent> T addChild(Class<T> type, String configId,
String id) throws Exception
@@ -174,6 +171,7 @@
return comp;
}
+ // todo (julien) : this is not type safe
@SuppressWarnings("unchecked")
public <T extends UIComponent> T findComponentById(String id)
{