You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:58:25 UTC
svn commit: r673833 [9/18] - in /myfaces/tomahawk/trunk:
core/src/main/java/org/apache/myfaces/component/
core/src/main/java/org/apache/myfaces/component/html/ext/
core/src/main/java/org/apache/myfaces/component/html/util/
core/src/main/java/org/apache...
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEndConversation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEndConversation.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEndConversation.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEndConversation.java Thu Jul 3 14:58:05 2008
@@ -39,187 +39,187 @@
*/
public class UIEndConversation extends AbstractConversationComponent
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.EndConversation";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.EndConversation";
- private String onOutcome;
- private String errorOutcome;
- private Boolean restart;
- private MethodBinding restartAction;
-
- private boolean inited = false;
-
- /*
- public static class ConversationEndAction extends AbstractConversationActionListener
- {
- public void doConversationAction(AbstractConversationComponent abstractConversationComponent)
- {
- ConversationManager.getInstance().registerEndConversation(getConversationName());
- }
- }
- */
-
- public void encodeBegin(FacesContext context) throws IOException
- {
- super.encodeBegin(context);
-
- UICommand command = ConversationUtils.findParentCommand(this);
- if (command != null)
- {
- if (!inited)
- {
- /*
- ConversationEndAction actionListener = new ConversationEndAction();
- actionListener.setConversationName(getName());
- command.addActionListener(actionListener);
- */
- MethodBinding original = command.getAction();
- command.setAction(new EndConversationMethodBindingFacade(
- getName(),
- getOnOutcomes(),
- original,
- getErrorOutcome(),
- getRestart(),
- getRestartAction()));
- inited = true;
- }
- }
- else
- {
- ConversationUtils.endAndRestartConversation(context,
- getName(),
- getRestart(),
- getRestartAction());
- }
- }
-
- private Collection getOnOutcomes()
- {
- String onOutcome = getOnOutcome();
- if (onOutcome == null || onOutcome.trim().length() < 1)
- {
- return null;
- }
-
- return Arrays.asList(StringUtils.trim(StringUtils.splitShortString(onOutcome, ',')));
- }
-
- public void restoreState(FacesContext context, Object state)
- {
- Object[] states = (Object[]) state;
- super.restoreState(context, states[0]);
- inited = ((Boolean) states[1]).booleanValue();
- onOutcome = (String) states[2];
- errorOutcome = (String) states[3];
- restart = (Boolean) states[4];
- restartAction = (MethodBinding) restoreAttachedState(context, states[5]);
- }
-
- public Object saveState(FacesContext context)
- {
- return new Object[]
- {
- super.saveState(context),
- inited ? Boolean.TRUE : Boolean.FALSE,
- onOutcome,
- errorOutcome,
- restart,
- saveAttachedState(context, restartAction)
- };
- }
-
- /**
- * end the conversation only if the action outcome matches the given onOutcome.
- *
- * This can be a comma separated list.
- *
- * @JSFProperty
- * @return
- */
- public String getOnOutcome()
- {
- if (onOutcome != null)
- {
- return onOutcome;
- }
- ValueBinding vb = getValueBinding("onOutcome");
- if (vb == null)
- {
- return null;
- }
- return (String) vb.getValue(getFacesContext());
- }
-
- public void setOnOutcome(String onOutcome)
- {
- this.onOutcome = onOutcome;
- }
-
- /**
- * on exception use the given outcome for further navigation
- *
- * @JSFProperty
- * @return
- */
- public String getErrorOutcome()
- {
- if (errorOutcome != null)
- {
- return errorOutcome;
- }
- ValueBinding vb = getValueBinding("errorOutcome");
- if (vb == null)
- {
- return null;
- }
- return (String) vb.getValue(getFacesContext());
- }
-
- public void setErrorOutcome(String errorOutcome)
- {
- this.errorOutcome = errorOutcome;
- }
-
- /**
- * true|false|valueBinding - true if the conversation should be restarted immediately
- *
- * @JSFProperty
- * @return
- */
- public Boolean getRestart()
- {
- if (restart != null)
- {
- return restart;
- }
- ValueBinding vb = getValueBinding("restart");
- if (vb == null)
- {
- return null;
- }
- return (Boolean) vb.getValue(getFacesContext());
- }
-
- public void setRestart(Boolean restart)
- {
- this.restart = restart;
- }
-
- /**
- * the action which should be called in case of a restart
- *
- * @JSFProperty
- * methodSignature = "java.lang.String"
- * returnSignature = "void"
- * stateHolder = "true"
- * @return
- */
- public MethodBinding getRestartAction()
- {
- return restartAction;
- }
-
- public void setRestartAction(MethodBinding restartAction)
- {
- this.restartAction = restartAction;
- }
+ private String onOutcome;
+ private String errorOutcome;
+ private Boolean restart;
+ private MethodBinding restartAction;
+
+ private boolean inited = false;
+
+ /*
+ public static class ConversationEndAction extends AbstractConversationActionListener
+ {
+ public void doConversationAction(AbstractConversationComponent abstractConversationComponent)
+ {
+ ConversationManager.getInstance().registerEndConversation(getConversationName());
+ }
+ }
+ */
+
+ public void encodeBegin(FacesContext context) throws IOException
+ {
+ super.encodeBegin(context);
+
+ UICommand command = ConversationUtils.findParentCommand(this);
+ if (command != null)
+ {
+ if (!inited)
+ {
+ /*
+ ConversationEndAction actionListener = new ConversationEndAction();
+ actionListener.setConversationName(getName());
+ command.addActionListener(actionListener);
+ */
+ MethodBinding original = command.getAction();
+ command.setAction(new EndConversationMethodBindingFacade(
+ getName(),
+ getOnOutcomes(),
+ original,
+ getErrorOutcome(),
+ getRestart(),
+ getRestartAction()));
+ inited = true;
+ }
+ }
+ else
+ {
+ ConversationUtils.endAndRestartConversation(context,
+ getName(),
+ getRestart(),
+ getRestartAction());
+ }
+ }
+
+ private Collection getOnOutcomes()
+ {
+ String onOutcome = getOnOutcome();
+ if (onOutcome == null || onOutcome.trim().length() < 1)
+ {
+ return null;
+ }
+
+ return Arrays.asList(StringUtils.trim(StringUtils.splitShortString(onOutcome, ',')));
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ inited = ((Boolean) states[1]).booleanValue();
+ onOutcome = (String) states[2];
+ errorOutcome = (String) states[3];
+ restart = (Boolean) states[4];
+ restartAction = (MethodBinding) restoreAttachedState(context, states[5]);
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ inited ? Boolean.TRUE : Boolean.FALSE,
+ onOutcome,
+ errorOutcome,
+ restart,
+ saveAttachedState(context, restartAction)
+ };
+ }
+
+ /**
+ * end the conversation only if the action outcome matches the given onOutcome.
+ *
+ * This can be a comma separated list.
+ *
+ * @JSFProperty
+ * @return
+ */
+ public String getOnOutcome()
+ {
+ if (onOutcome != null)
+ {
+ return onOutcome;
+ }
+ ValueBinding vb = getValueBinding("onOutcome");
+ if (vb == null)
+ {
+ return null;
+ }
+ return (String) vb.getValue(getFacesContext());
+ }
+
+ public void setOnOutcome(String onOutcome)
+ {
+ this.onOutcome = onOutcome;
+ }
+
+ /**
+ * on exception use the given outcome for further navigation
+ *
+ * @JSFProperty
+ * @return
+ */
+ public String getErrorOutcome()
+ {
+ if (errorOutcome != null)
+ {
+ return errorOutcome;
+ }
+ ValueBinding vb = getValueBinding("errorOutcome");
+ if (vb == null)
+ {
+ return null;
+ }
+ return (String) vb.getValue(getFacesContext());
+ }
+
+ public void setErrorOutcome(String errorOutcome)
+ {
+ this.errorOutcome = errorOutcome;
+ }
+
+ /**
+ * true|false|valueBinding - true if the conversation should be restarted immediately
+ *
+ * @JSFProperty
+ * @return
+ */
+ public Boolean getRestart()
+ {
+ if (restart != null)
+ {
+ return restart;
+ }
+ ValueBinding vb = getValueBinding("restart");
+ if (vb == null)
+ {
+ return null;
+ }
+ return (Boolean) vb.getValue(getFacesContext());
+ }
+
+ public void setRestart(Boolean restart)
+ {
+ this.restart = restart;
+ }
+
+ /**
+ * the action which should be called in case of a restart
+ *
+ * @JSFProperty
+ * methodSignature = "java.lang.String"
+ * returnSignature = "void"
+ * stateHolder = "true"
+ * @return
+ */
+ public MethodBinding getRestartAction()
+ {
+ return restartAction;
+ }
+
+ public void setRestartAction(MethodBinding restartAction)
+ {
+ this.restartAction = restartAction;
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java Thu Jul 3 14:58:05 2008
@@ -46,130 +46,130 @@
*/
public class UIEnsureConversation extends AbstractConversationComponent
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.EnsureConversation";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.EnsureConversation";
- private String redirectTo;
- private Boolean preCheck;
+ private String redirectTo;
+ private Boolean preCheck;
- public void encodeBegin(FacesContext context) throws IOException
- {
- super.encodeBegin(context);
-
- checkConversation(context, getName());
- }
-
- public void decode(FacesContext context)
- {
- super.decode(context);
-
- try
- {
- checkConversation(context, getName());
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void restoreState(FacesContext context, Object state)
- {
- Object[] states = (Object[]) state;
-
- super.restoreState(context, states[0]);
- redirectTo = (String) states[1];
- preCheck = (Boolean) states[2];
- }
-
- public Object saveState(FacesContext context)
- {
- return new Object[]
- {
- super.saveState(context),
- redirectTo,
- preCheck
- };
- }
-
- protected void checkConversation(FacesContext context, String name) throws IOException
- {
- ConversationManager conversationManager = ConversationManager.getInstance();
-
- if (Boolean.TRUE.equals(preCheck))
- {
- String actionResult = (String) getAction().invoke(context, null);
- if (actionResult == null)
- {
- // no further action, maybe the user started a conversation
- return;
- }
-
- conversationManager.getMessager().setConversationNotActive(context, getName());
- return;
- }
- else if (!conversationManager.hasConversation(name))
- {
- if (getAction() != null)
- {
- String actionResult = (String) getAction().invoke(context, null);
- if (actionResult == null)
- {
- // no further action, maybe the user started a conversation
- return;
- }
- conversationManager.getMessager().setConversationNotActive(context, getName());
-
- // hopefully the user configured the navigation as redirect ...
- context.getApplication().getNavigationHandler().handleNavigation(context, null, actionResult);
- }
- else
- {
- conversationManager.getMessager().setConversationNotActive(context, getName());
-
- String actionUrl = context.getApplication().getViewHandler().getActionURL(
- context, getRedirectTo());
- String encodedActionUrl = context.getExternalContext().encodeActionURL(actionUrl);
-
- // XXX: figure out a way to avoid this ==>
- RedirectTrackerManager manager = RedirectTrackerManager.getInstance(context);
- if (manager != null)
- {
- encodedActionUrl = manager.trackRedirect(context, encodedActionUrl);
- }
- // XXX: figure out a way to avoid this <==
-
- context.getExternalContext().redirect(encodedActionUrl);
- }
-
- return;
- }
- }
-
- /**
- * redirect to the given view if the conversation is not running
- *
- * @JSFProperty
- * @return
- */
- public String getRedirectTo()
- {
- if (redirectTo != null)
- {
- return redirectTo;
- }
- ValueBinding vb = getValueBinding("redirectTo");
- if (vb == null)
- {
- return null;
- }
- return (String) vb.getValue(getFacesContext());
- }
-
- public void setRedirectTo(String redirectTo)
- {
- this.redirectTo = redirectTo;
- }
-
+ public void encodeBegin(FacesContext context) throws IOException
+ {
+ super.encodeBegin(context);
+
+ checkConversation(context, getName());
+ }
+
+ public void decode(FacesContext context)
+ {
+ super.decode(context);
+
+ try
+ {
+ checkConversation(context, getName());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] states = (Object[]) state;
+
+ super.restoreState(context, states[0]);
+ redirectTo = (String) states[1];
+ preCheck = (Boolean) states[2];
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ redirectTo,
+ preCheck
+ };
+ }
+
+ protected void checkConversation(FacesContext context, String name) throws IOException
+ {
+ ConversationManager conversationManager = ConversationManager.getInstance();
+
+ if (Boolean.TRUE.equals(preCheck))
+ {
+ String actionResult = (String) getAction().invoke(context, null);
+ if (actionResult == null)
+ {
+ // no further action, maybe the user started a conversation
+ return;
+ }
+
+ conversationManager.getMessager().setConversationNotActive(context, getName());
+ return;
+ }
+ else if (!conversationManager.hasConversation(name))
+ {
+ if (getAction() != null)
+ {
+ String actionResult = (String) getAction().invoke(context, null);
+ if (actionResult == null)
+ {
+ // no further action, maybe the user started a conversation
+ return;
+ }
+ conversationManager.getMessager().setConversationNotActive(context, getName());
+
+ // hopefully the user configured the navigation as redirect ...
+ context.getApplication().getNavigationHandler().handleNavigation(context, null, actionResult);
+ }
+ else
+ {
+ conversationManager.getMessager().setConversationNotActive(context, getName());
+
+ String actionUrl = context.getApplication().getViewHandler().getActionURL(
+ context, getRedirectTo());
+ String encodedActionUrl = context.getExternalContext().encodeActionURL(actionUrl);
+
+ // XXX: figure out a way to avoid this ==>
+ RedirectTrackerManager manager = RedirectTrackerManager.getInstance(context);
+ if (manager != null)
+ {
+ encodedActionUrl = manager.trackRedirect(context, encodedActionUrl);
+ }
+ // XXX: figure out a way to avoid this <==
+
+ context.getExternalContext().redirect(encodedActionUrl);
+ }
+
+ return;
+ }
+ }
+
+ /**
+ * redirect to the given view if the conversation is not running
+ *
+ * @JSFProperty
+ * @return
+ */
+ public String getRedirectTo()
+ {
+ if (redirectTo != null)
+ {
+ return redirectTo;
+ }
+ ValueBinding vb = getValueBinding("redirectTo");
+ if (vb == null)
+ {
+ return null;
+ }
+ return (String) vb.getValue(getFacesContext());
+ }
+
+ public void setRedirectTo(String redirectTo)
+ {
+ this.redirectTo = redirectTo;
+ }
+
/**
* Delegate the check to the action method at all. The user has to check if
* a conversation is running. A action method is mandatory.
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java Thu Jul 3 14:58:05 2008
@@ -40,47 +40,47 @@
*/
public class UISeparateConversationContext extends UIComponentBase
{
- public static final String COMPONENT_FAMILY = "javax.faces.Component";
+ public static final String COMPONENT_FAMILY = "javax.faces.Component";
public static final String COMPONENT_TYPE = "org.apache.myfaces.SeparateConversationContext";
private final static ThreadLocal inSeperationMode = new ThreadLocal();
- public static void setInSeparationMode(boolean seperationMode)
- {
- inSeperationMode.set(seperationMode?Boolean.TRUE:Boolean.FALSE);
- }
+ public static void setInSeparationMode(boolean seperationMode)
+ {
+ inSeperationMode.set(seperationMode?Boolean.TRUE:Boolean.FALSE);
+ }
- public static boolean isInSeparationMode()
- {
- return Boolean.TRUE.equals(inSeperationMode.get());
- }
-
+ public static boolean isInSeparationMode()
+ {
+ return Boolean.TRUE.equals(inSeperationMode.get());
+ }
+
public void encodeBegin(FacesContext context) throws IOException
- {
- super.encodeBegin(context);
+ {
+ super.encodeBegin(context);
- setInSeparationMode(true);
- }
+ setInSeparationMode(true);
+ }
- public void encodeChildren(FacesContext context) throws IOException
- {
- try
- {
- RendererUtils.renderChildren(context, this);
- }
- finally
- {
- setInSeparationMode(false);
- }
- }
+ public void encodeChildren(FacesContext context) throws IOException
+ {
+ try
+ {
+ RendererUtils.renderChildren(context, this);
+ }
+ finally
+ {
+ setInSeparationMode(false);
+ }
+ }
public boolean getRendersChildren()
{
- return true;
+ return true;
}
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIStartConversation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIStartConversation.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIStartConversation.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIStartConversation.java Thu Jul 3 14:58:05 2008
@@ -44,166 +44,166 @@
private boolean inited;
private Boolean persistence;
- public static class ConversationStartAction extends AbstractConversationActionListener
- {
- private boolean persistence;
- private List beanToElevate;
-
- public void doConversationAction(AbstractConversationComponent abstractConversationComponent)
- {
- ConversationManager conversationManager = ConversationManager.getInstance();
- conversationManager.startConversation(getConversationName(), isPersistence());
-
- if (beanToElevate != null)
- {
- FacesContext context = FacesContext.getCurrentInstance();
-
- Iterator iterBeans = beanToElevate.iterator();
- while (iterBeans.hasNext())
- {
- String vb = (String) iterBeans.next();
- UIConversation.elevateBean(
- context,
- getConversationName(),
- context.getApplication().createValueBinding(vb));
- }
- }
- }
-
- public boolean isPersistence()
- {
- return persistence;
- }
-
- public void setPersistence(boolean persistence)
- {
- this.persistence = persistence;
- }
-
- public void addBeanToElevate(String beanBinding)
- {
- if (beanToElevate == null)
- {
- beanToElevate = new ArrayList();
- }
- beanToElevate.add(beanBinding);
- }
-
-
- public Object saveState(FacesContext context)
- {
- return new Object[]
- {
- super.saveState(context),
- Boolean.valueOf(persistence),
- beanToElevate
- };
- }
-
- public void restoreState(FacesContext context, Object state)
- {
- Object[] states = (Object[]) state;
- super.restoreState(context, states[0]);
- persistence = ((Boolean) states[1]).booleanValue();
- beanToElevate = (List) states[2];
- }
- }
-
- public void encodeEnd(FacesContext context) throws IOException
- {
- super.encodeEnd(context);
-
- setupConversationSystem(context);
-
- UICommand command = ConversationUtils.findParentCommand(this);
- if (command != null)
- {
- if (!inited)
- {
- ConversationStartAction actionListener = new ConversationStartAction();
- actionListener.setConversationName(getName());
- actionListener.setPersistence(toBoolean(getPersistence()));
- command.addActionListener(actionListener);
-
- Iterator iterChildren = getChildren().iterator();
- while (iterChildren.hasNext())
- {
- Object child = iterChildren.next();
- if (child instanceof UIConversation)
- {
- UIConversation conversation = (UIConversation) child;
- actionListener.addBeanToElevate(conversation.getBeanBinding().getExpressionString());
- }
- }
-
- inited = true;
- }
- }
- else
- {
- ConversationManager conversationManager = ConversationManager.getInstance();
- conversationManager.startConversation(getName(), toBoolean(getPersistence()));
- }
- }
-
- protected boolean toBoolean(Boolean bool)
- {
- if (bool != null)
- {
- return bool.booleanValue();
- }
- return false;
- }
-
- protected void setupConversationSystem(FacesContext context)
- {
- if (Boolean.TRUE.equals(context.getExternalContext().getApplicationMap().get(CONVERSATION_SYSTEM_SETUP)))
- {
- return;
- }
-
- VariableResolver originalVR = context.getApplication().getVariableResolver();
- context.getApplication().setVariableResolver(new ConversationVariableResolver(originalVR));
-
- context.getExternalContext().getApplicationMap().put(CONVERSATION_SYSTEM_SETUP, Boolean.TRUE);
- }
-
- public void restoreState(FacesContext context, Object state)
- {
- Object[] states = (Object[]) state;
- super.restoreState(context, states[0]);
- inited = ((Boolean) states[1]).booleanValue();
- persistence = (Boolean) states[2];
- }
-
- public Object saveState(FacesContext context)
- {
- return new Object[]
- {
- super.saveState(context),
- inited?Boolean.TRUE:Boolean.FALSE,
- persistence
- };
- }
-
- /**
- * true|false - if this conversation requires a persistence manager. Default: false
- *
- * @JSFProperty
- * @return
- */
- public Boolean getPersistence()
- {
+ public static class ConversationStartAction extends AbstractConversationActionListener
+ {
+ private boolean persistence;
+ private List beanToElevate;
+
+ public void doConversationAction(AbstractConversationComponent abstractConversationComponent)
+ {
+ ConversationManager conversationManager = ConversationManager.getInstance();
+ conversationManager.startConversation(getConversationName(), isPersistence());
+
+ if (beanToElevate != null)
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ Iterator iterBeans = beanToElevate.iterator();
+ while (iterBeans.hasNext())
+ {
+ String vb = (String) iterBeans.next();
+ UIConversation.elevateBean(
+ context,
+ getConversationName(),
+ context.getApplication().createValueBinding(vb));
+ }
+ }
+ }
+
+ public boolean isPersistence()
+ {
+ return persistence;
+ }
+
+ public void setPersistence(boolean persistence)
+ {
+ this.persistence = persistence;
+ }
+
+ public void addBeanToElevate(String beanBinding)
+ {
+ if (beanToElevate == null)
+ {
+ beanToElevate = new ArrayList();
+ }
+ beanToElevate.add(beanBinding);
+ }
+
+
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ Boolean.valueOf(persistence),
+ beanToElevate
+ };
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ persistence = ((Boolean) states[1]).booleanValue();
+ beanToElevate = (List) states[2];
+ }
+ }
+
+ public void encodeEnd(FacesContext context) throws IOException
+ {
+ super.encodeEnd(context);
+
+ setupConversationSystem(context);
+
+ UICommand command = ConversationUtils.findParentCommand(this);
+ if (command != null)
+ {
+ if (!inited)
+ {
+ ConversationStartAction actionListener = new ConversationStartAction();
+ actionListener.setConversationName(getName());
+ actionListener.setPersistence(toBoolean(getPersistence()));
+ command.addActionListener(actionListener);
+
+ Iterator iterChildren = getChildren().iterator();
+ while (iterChildren.hasNext())
+ {
+ Object child = iterChildren.next();
+ if (child instanceof UIConversation)
+ {
+ UIConversation conversation = (UIConversation) child;
+ actionListener.addBeanToElevate(conversation.getBeanBinding().getExpressionString());
+ }
+ }
+
+ inited = true;
+ }
+ }
+ else
+ {
+ ConversationManager conversationManager = ConversationManager.getInstance();
+ conversationManager.startConversation(getName(), toBoolean(getPersistence()));
+ }
+ }
+
+ protected boolean toBoolean(Boolean bool)
+ {
+ if (bool != null)
+ {
+ return bool.booleanValue();
+ }
+ return false;
+ }
+
+ protected void setupConversationSystem(FacesContext context)
+ {
+ if (Boolean.TRUE.equals(context.getExternalContext().getApplicationMap().get(CONVERSATION_SYSTEM_SETUP)))
+ {
+ return;
+ }
+
+ VariableResolver originalVR = context.getApplication().getVariableResolver();
+ context.getApplication().setVariableResolver(new ConversationVariableResolver(originalVR));
+
+ context.getExternalContext().getApplicationMap().put(CONVERSATION_SYSTEM_SETUP, Boolean.TRUE);
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ inited = ((Boolean) states[1]).booleanValue();
+ persistence = (Boolean) states[2];
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ inited?Boolean.TRUE:Boolean.FALSE,
+ persistence
+ };
+ }
+
+ /**
+ * true|false - if this conversation requires a persistence manager. Default: false
+ *
+ * @JSFProperty
+ * @return
+ */
+ public Boolean getPersistence()
+ {
if (persistence != null)
{
- return persistence;
+ return persistence;
}
ValueBinding vb = getValueBinding("persistence");
return vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
- }
+ }
- public void setPersistence(Boolean persistence)
- {
- this.persistence = persistence;
- }
+ public void setPersistence(Boolean persistence)
+ {
+ this.persistence = persistence;
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ValueBindingKey.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ValueBindingKey.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ValueBindingKey.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ValueBindingKey.java Thu Jul 3 14:58:05 2008
@@ -29,11 +29,11 @@
*/
public class ValueBindingKey implements Comparator
{
- public int compare(Object o1, Object o2)
- {
- ValueBinding vb1 = (ValueBinding) o1;
- ValueBinding vb2 = (ValueBinding) o2;
-
- return vb1.getExpressionString().compareTo(vb2.getExpressionString());
- }
+ public int compare(Object o1, Object o2)
+ {
+ ValueBinding vb1 = (ValueBinding) o1;
+ ValueBinding vb2 = (ValueBinding) o2;
+
+ return vb1.getExpressionString().compareTo(vb2.getExpressionString());
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertNumber/TypedNumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertNumber/TypedNumberConverter.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertNumber/TypedNumberConverter.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertNumber/TypedNumberConverter.java Thu Jul 3 14:58:05 2008
@@ -54,63 +54,63 @@
*/
public class TypedNumberConverter implements javax.faces.convert.Converter, StateHolder
{
- public static final String CONVERTER_ID = "org.apache.myfaces.custom.convertNumber.TypedNumberConverter";
+ public static final String CONVERTER_ID = "org.apache.myfaces.custom.convertNumber.TypedNumberConverter";
- private Class destType;
+ private Class destType;
- public TypedNumberConverter()
- {
- }
-
- public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
- {
- Object convertedValue = _getAsObject(facesContext, uiComponent, value);
- if (convertedValue == null)
- {
- return null;
- }
-
- Class destType = getDestType();
- if (destType == null)
- {
- ValueBinding valueBinding = uiComponent.getValueBinding("value");
- if (valueBinding != null)
- {
- destType = valueBinding.getType(facesContext);
- }
- }
-
- if (destType != null)
- {
- Converter converter = ConvertUtils.lookup(destType);
- if (converter == null)
- {
- throw new UnsupportedOperationException("cant deal with " + destType);
- }
-
- // setting type to null, in fact the documentation is wrong here and this type is never used
- convertedValue = converter.convert(null, convertedValue);
- }
-
-
- return convertedValue;
- }
-
- public void restoreState(FacesContext facesContext, Object state)
- {
- Object[] states = (Object[]) state;
- _restoreState(facesContext, states[0]);
- destType = (Class) states[1];
- }
-
- public Object saveState(FacesContext facesContext)
- {
- return new Object[]
- {
- _saveState(facesContext),
- destType
- };
- }
+ public TypedNumberConverter()
+ {
+ }
+
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
+ {
+ Object convertedValue = _getAsObject(facesContext, uiComponent, value);
+ if (convertedValue == null)
+ {
+ return null;
+ }
+
+ Class destType = getDestType();
+ if (destType == null)
+ {
+ ValueBinding valueBinding = uiComponent.getValueBinding("value");
+ if (valueBinding != null)
+ {
+ destType = valueBinding.getType(facesContext);
+ }
+ }
+
+ if (destType != null)
+ {
+ Converter converter = ConvertUtils.lookup(destType);
+ if (converter == null)
+ {
+ throw new UnsupportedOperationException("cant deal with " + destType);
+ }
+
+ // setting type to null, in fact the documentation is wrong here and this type is never used
+ convertedValue = converter.convert(null, convertedValue);
+ }
+
+
+ return convertedValue;
+ }
+
+ public void restoreState(FacesContext facesContext, Object state)
+ {
+ Object[] states = (Object[]) state;
+ _restoreState(facesContext, states[0]);
+ destType = (Class) states[1];
+ }
+
+ public Object saveState(FacesContext facesContext)
+ {
+ return new Object[]
+ {
+ _saveState(facesContext),
+ destType
+ };
+ }
/**
* The java class name the value should be converted to.
@@ -119,18 +119,18 @@
*
* @JSFProperty
*/
- public Class getDestType()
- {
- return destType;
- }
-
- public void setDestType(Class destType)
- {
- this.destType = destType;
- }
+ public Class getDestType()
+ {
+ return destType;
+ }
- /* ORIGINAL STUFF COPIED FROM javax.faces.convert.NumberConverter */
-
+ public void setDestType(Class destType)
+ {
+ this.destType = destType;
+ }
+
+ /* ORIGINAL STUFF COPIED FROM javax.faces.convert.NumberConverter */
+
// internal constants
private static final String CONVERSION_MESSAGE_ID = "javax.faces.convert.NumberConverter.CONVERSION";
@@ -180,9 +180,9 @@
}
catch (ParseException e)
{
- FacesMessage message = MessageUtils.getMessage(facesContext, CONVERSION_MESSAGE_ID, new Object[]{uiComponent.getId(),value});
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
-
+ FacesMessage message = MessageUtils.getMessage(facesContext, CONVERSION_MESSAGE_ID, new Object[]{uiComponent.getId(),value});
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+
throw new ConverterException(message, e);
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertStringUtils/StringUtilsConverter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertStringUtils/StringUtilsConverter.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertStringUtils/StringUtilsConverter.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertStringUtils/StringUtilsConverter.java Thu Jul 3 14:58:05 2008
@@ -59,35 +59,35 @@
protected Integer maxLength = null;
protected Boolean appendEllipsesDuringOutput = null;
protected Boolean appendEllipsesDuringInput = null;
-
- public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
- return null == value ? null : format(value.toString(), false);
- }
-
- public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
- return value == null ? "" : format(value.toString(), true);
- }
-
- private String format(String val, boolean duringOutput) throws ConverterException {
-
- String str;
- if (BooleanUtils.isTrue(trim)) {
- str = val.trim();
- } else {
- str = val;
- }
- // Any decorations first
- if (StringUtils.isNotEmpty(format)) {
- if ("uppercase".equalsIgnoreCase(format)) {
- str = StringUtils.upperCase(str);
- } else if ("lowercase".equalsIgnoreCase(format)) {
- str = StringUtils.lowerCase(str);
- } else if ("capitalize".equalsIgnoreCase(format)) {
- str = WordUtils.capitalizeFully(str);
- } else {
- throw new ConverterException("Invalid format '" + format + "'");
- }
- }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
+ return null == value ? null : format(value.toString(), false);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
+ return value == null ? "" : format(value.toString(), true);
+ }
+
+ private String format(String val, boolean duringOutput) throws ConverterException {
+
+ String str;
+ if (BooleanUtils.isTrue(trim)) {
+ str = val.trim();
+ } else {
+ str = val;
+ }
+ // Any decorations first
+ if (StringUtils.isNotEmpty(format)) {
+ if ("uppercase".equalsIgnoreCase(format)) {
+ str = StringUtils.upperCase(str);
+ } else if ("lowercase".equalsIgnoreCase(format)) {
+ str = StringUtils.lowerCase(str);
+ } else if ("capitalize".equalsIgnoreCase(format)) {
+ str = WordUtils.capitalizeFully(str);
+ } else {
+ throw new ConverterException("Invalid format '" + format + "'");
+ }
+ }
boolean appendEllipses =
((duringOutput)
@@ -111,8 +111,8 @@
str = str.substring(0, maxLength.intValue());
}
}
- return str;
- }
+ return str;
+ }
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[]) state;
this.format = (String) values[0];
@@ -146,12 +146,12 @@
* @JSFProperty
*/
public String getFormat() {
- return format;
- }
+ return format;
+ }
- public void setFormat(String format) {
- this.format = format;
- }
+ public void setFormat(String format) {
+ this.format = format;
+ }
/**
* Integer value for the maximum length of the rendered string.
@@ -164,9 +164,9 @@
return maxLength;
}
- public void setMaxLength(Integer maxLength) {
- this.maxLength = maxLength;
- }
+ public void setMaxLength(Integer maxLength) {
+ this.maxLength = maxLength;
+ }
/**
* Boolean value determining if data should be truncated with ellipses
@@ -202,11 +202,11 @@
*
* @JSFProperty
*/
- public Boolean getTrim() {
- return trim;
- }
-
- public void setTrim(Boolean trim) {
- this.trim = trim;
- }
+ public Boolean getTrim() {
+ return trim;
+ }
+
+ public void setTrim(Boolean trim) {
+ this.trim = trim;
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java Thu Jul 3 14:58:05 2008
@@ -40,119 +40,119 @@
* @version $Revision$ $Date$
*/
public abstract class AbstractCSVValidator extends ValidatorBase {
- /**
- * <p>The standard converter id for this converter.</p>
- */
- public static final String VALIDATOR_ID = "org.apache.myfaces.validator.csv";
- /**
- * <p>The message identifiers of the {@link FacesMessage} to be created if
- * the check fails.</p>
- */
- public static final String CSV_NOT_STRING_MESSAGE_ID = "org.apache.myfaces.csv.NOT_STRING";
- public static final String CSV_INVALID_SEPARATOR_MESSAGE_ID = "org.apache.myfaces.csv.INVALID_SEPARATOR";
- public static final String CSV_SUFFIX_MESSAGE_ID = "org.apache.myfaces.csv.SUFFIX";
- private static final String DEFAULT_SEPARATOR = ",";
-
- /**
- * @JSFProperty
- * @return the VALIDATOR_ID of the actual validator to be used
- */
+ /**
+ * <p>The standard converter id for this converter.</p>
+ */
+ public static final String VALIDATOR_ID = "org.apache.myfaces.validator.csv";
+ /**
+ * <p>The message identifiers of the {@link FacesMessage} to be created if
+ * the check fails.</p>
+ */
+ public static final String CSV_NOT_STRING_MESSAGE_ID = "org.apache.myfaces.csv.NOT_STRING";
+ public static final String CSV_INVALID_SEPARATOR_MESSAGE_ID = "org.apache.myfaces.csv.INVALID_SEPARATOR";
+ public static final String CSV_SUFFIX_MESSAGE_ID = "org.apache.myfaces.csv.SUFFIX";
+ private static final String DEFAULT_SEPARATOR = ",";
+
+ /**
+ * @JSFProperty
+ * @return the VALIDATOR_ID of the actual validator to be used
+ */
public abstract String getSubvalidatorId();
- /**
- * @param the VALIDATOR_ID of the actual validator to be used
- */
- public abstract void setSubvalidatorId(String subvalidatorId);
-
- /**
- * @JSFProperty
- * literalOnly = "true"
- * @return the separator character to separate values
- */
- public abstract String getSeparator();
-
- /**
- * @param the separator character to separate values
- */
- public abstract void setSeparator(String separator);
-
- private FacesMessage addMessage(FacesMessage oldMsg, FacesMessage newMsg, int index, String suffixMessageKey) {
- if (oldMsg != null && newMsg.getSeverity().getOrdinal() < oldMsg.getSeverity().getOrdinal())
- return oldMsg;
- String summaryMessageText = null;
- String detailMessageText = null;
- if (oldMsg == null || newMsg.getSeverity().getOrdinal() > oldMsg.getSeverity().getOrdinal()) {
- summaryMessageText = null;
- detailMessageText = null;
- }
- else {
- summaryMessageText = oldMsg.getSummary();
- detailMessageText = oldMsg.getDetail();
- }
- Object[] args = { new Integer(index + 1) };
- FacesMessage suffixMessage = MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, suffixMessageKey, args);
- String summarySuffix = suffixMessage.getSummary();
- String detailSuffix = suffixMessage.getDetail();
- if (summarySuffix == null)
- summarySuffix = detailSuffix;
- else if (detailSuffix == null)
- detailSuffix = summarySuffix;
- String summary = newMsg.getSummary();
- if (summaryMessageText == null)
- summaryMessageText = summary + summarySuffix;
- else
- summaryMessageText += ", " + summary + summarySuffix;
- String detail = newMsg.getDetail();
- if (detailMessageText == null)
- detailMessageText = detail + detailSuffix;
- else
- detailMessageText += ", " + detail + detailSuffix;
- return new FacesMessage(newMsg.getSeverity(), summaryMessageText, detailMessageText);
- }
+ /**
+ * @param the VALIDATOR_ID of the actual validator to be used
+ */
+ public abstract void setSubvalidatorId(String subvalidatorId);
+
+ /**
+ * @JSFProperty
+ * literalOnly = "true"
+ * @return the separator character to separate values
+ */
+ public abstract String getSeparator();
+
+ /**
+ * @param the separator character to separate values
+ */
+ public abstract void setSeparator(String separator);
+
+ private FacesMessage addMessage(FacesMessage oldMsg, FacesMessage newMsg, int index, String suffixMessageKey) {
+ if (oldMsg != null && newMsg.getSeverity().getOrdinal() < oldMsg.getSeverity().getOrdinal())
+ return oldMsg;
+ String summaryMessageText = null;
+ String detailMessageText = null;
+ if (oldMsg == null || newMsg.getSeverity().getOrdinal() > oldMsg.getSeverity().getOrdinal()) {
+ summaryMessageText = null;
+ detailMessageText = null;
+ }
+ else {
+ summaryMessageText = oldMsg.getSummary();
+ detailMessageText = oldMsg.getDetail();
+ }
+ Object[] args = { new Integer(index + 1) };
+ FacesMessage suffixMessage = MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, suffixMessageKey, args);
+ String summarySuffix = suffixMessage.getSummary();
+ String detailSuffix = suffixMessage.getDetail();
+ if (summarySuffix == null)
+ summarySuffix = detailSuffix;
+ else if (detailSuffix == null)
+ detailSuffix = summarySuffix;
+ String summary = newMsg.getSummary();
+ if (summaryMessageText == null)
+ summaryMessageText = summary + summarySuffix;
+ else
+ summaryMessageText += ", " + summary + summarySuffix;
+ String detail = newMsg.getDetail();
+ if (detailMessageText == null)
+ detailMessageText = detail + detailSuffix;
+ else
+ detailMessageText += ", " + detail + detailSuffix;
+ return new FacesMessage(newMsg.getSeverity(), summaryMessageText, detailMessageText);
+ }
- public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
+ public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
- if (facesContext == null) throw new NullPointerException("facesContext");
+ if (facesContext == null) throw new NullPointerException("facesContext");
if (uiComponent == null) throw new NullPointerException("uiComponent");
- if (value == null)
- {
- return;
- }
-
- String suffixMessageKey = getMessage();
- if (suffixMessageKey == null)
- suffixMessageKey = CSV_SUFFIX_MESSAGE_ID;
- FacesMessage facesMsg = null;
- // value must be a String
- if (!(value instanceof String)) {
- Object[] args = { value };
+ if (value == null)
+ {
+ return;
+ }
+
+ String suffixMessageKey = getMessage();
+ if (suffixMessageKey == null)
+ suffixMessageKey = CSV_SUFFIX_MESSAGE_ID;
+ FacesMessage facesMsg = null;
+ // value must be a String
+ if (!(value instanceof String)) {
+ Object[] args = { value };
throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_NOT_STRING_MESSAGE_ID, args));
- }
- Validator validator = facesContext.getApplication().createValidator(getSubvalidatorId());
- if (getSeparator() == null)
- setSeparator(DEFAULT_SEPARATOR);
- String[] values = null;
- try {
- values = ((String)value).split(getSeparator());
- }
- catch (PatternSyntaxException e) {
- Object[] args = { getSeparator() };
+ }
+ Validator validator = facesContext.getApplication().createValidator(getSubvalidatorId());
+ if (getSeparator() == null)
+ setSeparator(DEFAULT_SEPARATOR);
+ String[] values = null;
+ try {
+ values = ((String)value).split(getSeparator());
+ }
+ catch (PatternSyntaxException e) {
+ Object[] args = { getSeparator() };
throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_INVALID_SEPARATOR_MESSAGE_ID, args));
- }
- // loop through the separated values and validate each one
- for (int i = 0; i < values.length; i++) {
- if (values[i].trim().length() == 0) {
- continue;
- }
- else try {
- validator.validate(facesContext, uiComponent, values[i]);
- }
- catch (ValidatorException e) {
- facesMsg = addMessage(facesMsg, e.getFacesMessage(), i, suffixMessageKey);
- }
- }
- if (facesMsg != null)
- throw new ValidatorException(facesMsg);
- }
+ }
+ // loop through the separated values and validate each one
+ for (int i = 0; i < values.length; i++) {
+ if (values[i].trim().length() == 0) {
+ continue;
+ }
+ else try {
+ validator.validate(facesContext, uiComponent, values[i]);
+ }
+ catch (ValidatorException e) {
+ facesMsg = addMessage(facesMsg, e.getFacesMessage(), i, suffixMessageKey);
+ }
+ }
+ if (facesMsg != null)
+ throw new ValidatorException(facesMsg);
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/AbstractModalDialog.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/AbstractModalDialog.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/AbstractModalDialog.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/AbstractModalDialog.java Thu Jul 3 14:58:05 2008
@@ -38,19 +38,19 @@
public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.ModalDialog";
- /**
- * A space separated list with attribute='value' pairs, which control the behaviour of the dojo dialog.
- *
- * @JSFProperty
- */
- public abstract String getDialogAttr();
+ /**
+ * A space separated list with attribute='value' pairs, which control the behaviour of the dojo dialog.
+ *
+ * @JSFProperty
+ */
+ public abstract String getDialogAttr();
/**
* The id to control the dialog (dojo widget) with javascript.
*
* @JSFProperty
*/
- public abstract String getDialogId();
+ public abstract String getDialogId();
/**
* The name of the variable to control the dialog (dojo widget) with javascript.
@@ -66,47 +66,47 @@
*
* @JSFProperty
*/
- public abstract String getHiderIds();
+ public abstract String getHiderIds();
/**
* The URL of the view to show within the content area of the dialog
*
* @JSFProperty
*/
- public abstract String getViewId();
+ public abstract String getViewId();
- //@Override
- public boolean getRendersChildren() {
- return true;
- }
+ //@Override
+ public boolean getRendersChildren() {
+ return true;
+ }
/**
* HTML: CSS styling instructions.
*
* @JSFProperty
*/
- public abstract String getStyle();
+ public abstract String getStyle();
/**
* The CSS class for this element. Corresponds to the HTML 'class' attribute.
*
* @JSFProperty
*/
- public abstract String getStyleClass();
+ public abstract String getStyleClass();
/**
* Optional enforced dojo widgetId
*
* @JSFProperty
*/
- public abstract String getWidgetId();
+ public abstract String getWidgetId();
/**
* The title text to show in the title area
*
* @JSFProperty
*/
- public abstract String getDialogTitle();
+ public abstract String getDialogTitle();
/**
* true|false - Set to true if a close button should be rendere within the
@@ -114,18 +114,18 @@
*
* @JSFProperty
*/
- public abstract Boolean getCloseButton();
+ public abstract Boolean getCloseButton();
- /**
- * optional widget var name, if this is not used only an autogenerated value is set
- *
- * @JSFProperty
- */
- public String getWidgetVar() {
+ /**
+ * optional widget var name, if this is not used only an autogenerated value is set
+ *
+ * @JSFProperty
+ */
+ public String getWidgetVar() {
return getDialogVar();
}
- public void setWidgetVar(String widgetVar) {
+ public void setWidgetVar(String widgetVar) {
setDialogVar(widgetVar);
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/ModalDialogRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/ModalDialogRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/ModalDialogRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dialog/ModalDialogRenderer.java Thu Jul 3 14:58:05 2008
@@ -63,38 +63,38 @@
//@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
- ModalDialog dlg = (ModalDialog) component;
+ ModalDialog dlg = (ModalDialog) component;
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf = new StringBuffer();
buf.append("</div>");
- writeDialogLoader(context, dlg, buf);
+ writeDialogLoader(context, dlg, buf);
- context.getResponseWriter().write(buf.toString());
+ context.getResponseWriter().write(buf.toString());
- if (dlg.getViewId() != null)
- {
- RendererUtils.renderChildren(context, component);
- HtmlRendererUtils.writePrettyLineSeparator(context);
- }
+ if (dlg.getViewId() != null)
+ {
+ RendererUtils.renderChildren(context, component);
+ HtmlRendererUtils.writePrettyLineSeparator(context);
+ }
}
private void appendHiderIds(StringBuffer buf, ModalDialog dlg)
- {
- List hiders = new ArrayList();
+ {
+ List hiders = new ArrayList();
- if (dlg.getHiderIds() != null)
- {
+ if (dlg.getHiderIds() != null)
+ {
hiders.addAll(Arrays.asList(dlg.getHiderIds().split(",")));
}
- if (isRenderCloseButton(dlg) && dlg.getDialogTitle() != null)
- {
- hiders.add(dlg.getDialogVar() + "Closer");
- }
+ if (isRenderCloseButton(dlg) && dlg.getDialogTitle() != null)
+ {
+ hiders.add(dlg.getDialogVar() + "Closer");
+ }
- for (int i = 0; i < hiders.size(); i++)
- {
+ for (int i = 0; i < hiders.size(); i++)
+ {
String varName = "btn" + i;
buf.append("var ").append(varName).append(" = document.getElementById(\"")
.append(((String) hiders.get(i)).trim()).append("\");")
@@ -125,9 +125,9 @@
private void writeModalDialogBegin(FacesContext context, ModalDialog dlg, ResponseWriter writer) throws IOException {
StringBuffer buf = new StringBuffer();
- // writeDialogLoader(context, dlg, buf);
+ // writeDialogLoader(context, dlg, buf);
- String dlgId = getDialogId(dlg);
+ String dlgId = getDialogId(dlg);
buf.append("<div id=\"").append(dlgId).append("\"");
if(dlg.getStyle() != null)
buf.append(" style=\"").append(dlg.getStyle()).append("\"");
@@ -138,85 +138,85 @@
writer.write(buf.toString());
}
- private String getDialogId(ModalDialog dlg)
- {
- String dlgId = dlg.getId() != null ?
- dlg.getId() :
- new StringBuffer(dlg.getDialogId()).append(DIV_ID_PREFIX).toString();
- return dlgId;
- }
-
- private String writeDialogLoader(FacesContext context, ModalDialog dlg, StringBuffer buf)
- {
- String dlgId = getDialogId(dlg);
- buf.append("<script type=\"text/javascript\">")
+ private String getDialogId(ModalDialog dlg)
+ {
+ String dlgId = dlg.getId() != null ?
+ dlg.getId() :
+ new StringBuffer(dlg.getDialogId()).append(DIV_ID_PREFIX).toString();
+ return dlgId;
+ }
+
+ private String writeDialogLoader(FacesContext context, ModalDialog dlg, StringBuffer buf)
+ {
+ String dlgId = getDialogId(dlg);
+ buf.append("<script type=\"text/javascript\">")
.append("var ").append(dlg.getDialogVar()).append(";")
.append("function "+dlg.getDialogVar()+"_loader(e) {").append(dlg.getDialogVar())
.append(" = dojo.widget.createWidget(\"dialog\", {id:")
.append("\"").append(dlg.getDialogId()).append("\"");
- appendDialogAttributes(buf, dlg);
+ appendDialogAttributes(buf, dlg);
- buf.append("}, dojo.byId(\"").append(dlgId).append("\"));");
+ buf.append("}, dojo.byId(\"").append(dlgId).append("\"));");
- appendHiderIds(buf, dlg);
+ appendHiderIds(buf, dlg);
- if (dlg.getViewId() != null)
- {
- appendShowHideView(context, buf, dlg);
- }
-
- buf.append("}")
-
- // do not user timout, else you'll break the submitOnEvent component
- // .append("setTimeout('"+dlg.getDialogVar()+"_loader();', 50);")
- // do not user direct loading, else you'll break IE sometimes (always?)
- // .append(dlg.getDialogVar()+"_loader();")
- // looks like this works best for now
- .append("dojo.addOnLoad(function() {"+dlg.getDialogVar()+"_loader();});")
-
- .append("</script>");
- return dlgId;
- }
-
- private void appendShowHideView(FacesContext context, StringBuffer buf, ModalDialog dlg)
- {
- StringBuffer sbUrl = new StringBuffer();
- sbUrl.append(context.getExternalContext().getRequestContextPath());
- sbUrl.append("/");
- sbUrl.append(dlg.getViewId());
- String encodedUrl = context.getExternalContext().encodeActionURL(sbUrl.toString());
+ if (dlg.getViewId() != null)
+ {
+ appendShowHideView(context, buf, dlg);
+ }
+
+ buf.append("}")
+
+ // do not user timout, else you'll break the submitOnEvent component
+ // .append("setTimeout('"+dlg.getDialogVar()+"_loader();', 50);")
+ // do not user direct loading, else you'll break IE sometimes (always?)
+ // .append(dlg.getDialogVar()+"_loader();")
+ // looks like this works best for now
+ .append("dojo.addOnLoad(function() {"+dlg.getDialogVar()+"_loader();});")
+
+ .append("</script>");
+ return dlgId;
+ }
- buf.append(dlg.getDialogVar()).append(".oldOnShow=").append(dlg.getDialogVar()).append(".onShow;")
+ private void appendShowHideView(FacesContext context, StringBuffer buf, ModalDialog dlg)
+ {
+ StringBuffer sbUrl = new StringBuffer();
+ sbUrl.append(context.getExternalContext().getRequestContextPath());
+ sbUrl.append("/");
+ sbUrl.append(dlg.getViewId());
+ String encodedUrl = context.getExternalContext().encodeActionURL(sbUrl.toString());
+
+ buf.append(dlg.getDialogVar()).append(".oldOnShow=").append(dlg.getDialogVar()).append(".onShow;")
.append(dlg.getDialogVar())
- .append(".onShow = function() {")
+ .append(".onShow = function() {")
.append("this.oldOnShow();")
- .append("var content = document.getElementById(\"modalDialogContent")
- .append(dlg.getDialogVar())
- .append("\"); ")
- .append("window._myfaces_currentModal=")
- .append(dlg.getDialogVar())
- .append("; ")
- .append(dlg.getDialogVar())
- .append("._myfaces_ok=false; ")
- .append("content.contentWindow.location.replace('")
- .append(encodedUrl)
- .append("'); ")
- .append("}; ");
+ .append("var content = document.getElementById(\"modalDialogContent")
+ .append(dlg.getDialogVar())
+ .append("\"); ")
+ .append("window._myfaces_currentModal=")
+ .append(dlg.getDialogVar())
+ .append("; ")
+ .append(dlg.getDialogVar())
+ .append("._myfaces_ok=false; ")
+ .append("content.contentWindow.location.replace('")
+ .append(encodedUrl)
+ .append("'); ")
+ .append("}; ");
buf.append(dlg.getDialogVar()).append(".oldOnHide=").append(dlg.getDialogVar()).append(".onHide;")
.append(dlg.getDialogVar())
- .append(".onHide = function() {")
+ .append(".onHide = function() {")
.append("this.oldOnHide();")
- .append("window._myfaces_currentModal=null;")
- .append("var content = document.getElementById(\"modalDialogContent")
- .append(dlg.getDialogVar())
- .append("\"); ")
- .append("content.contentWindow.location.replace('javascript:false;'); ")
- .append("}; ");
- }
+ .append("window._myfaces_currentModal=null;")
+ .append("var content = document.getElementById(\"modalDialogContent")
+ .append(dlg.getDialogVar())
+ .append("\"); ")
+ .append("content.contentWindow.location.replace('javascript:false;'); ")
+ .append("}; ");
+ }
- public boolean getRendersChildren()
+ public boolean getRendersChildren()
{
return true;
}
@@ -228,83 +228,83 @@
*/
public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
- ModalDialog dlg = (ModalDialog) uiComponent;
- ResponseWriter writer = facesContext.getResponseWriter();
+ ModalDialog dlg = (ModalDialog) uiComponent;
+ ResponseWriter writer = facesContext.getResponseWriter();
- UIComponent titleFacet = dlg.getFacet("titleBar");
- if (titleFacet != null)
- {
- RendererUtils.renderChild(facesContext, titleFacet);
- }
- else if (dlg.getDialogTitle() != null)
- {
- AddResourceFactory.getInstance(facesContext).addStyleSheet(facesContext, AddResource.HEADER_BEGIN, ModalDialog.class, "modalDialog.css");
-
- writer.startElement(HTML.TABLE_ELEM, dlg);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogDecoration " + getStyleName(dlg, "Decoration") , null);
- writer.writeAttribute(HTML.CELLPADDING_ATTR, "2", null);
- writer.writeAttribute(HTML.CELLSPACING_ATTR, "0", null);
-
- writer.startElement(HTML.TR_ELEM, dlg);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitle " + getStyleName(dlg, "Title"), null);
-
- writer.startElement(HTML.TD_ELEM, dlg);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitleLeft " + getStyleName(dlg, "TitleLeft"), null);
- writer.writeText(dlg.getDialogTitle(), null);
- writer.endElement(HTML.TD_ELEM);
-
- writer.startElement(HTML.TD_ELEM, dlg);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitleRight " + getStyleName(dlg, "TitleRight"), null);
- if (isRenderCloseButton(dlg))
- {
- String imageUri = AddResourceFactory.getInstance(facesContext).getResourceUri(facesContext, ModalDialog.class, "close.gif");
- writer.startElement(HTML.IMG_ELEM, dlg);
- writer.writeAttribute(HTML.ID_ATTR, dlg.getDialogVar() + "Closer", null);
- writer.writeAttribute(HTML.SRC_ATTR, imageUri, null);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogCloser " + getStyleName(dlg, "Closer"), null);
- writer.endElement(HTML.IMG_ELEM);
- }
- writer.endElement(HTML.TD_ELEM);
-
- writer.endElement(HTML.TR_ELEM);
- writer.endElement(HTML.TABLE_ELEM);
- }
-
- if (dlg.getViewId() != null)
- {
- renderDialogViewFrame(facesContext, dlg);
- }
- else
- {
- RendererUtils.renderChildren(facesContext, uiComponent);
- HtmlRendererUtils.writePrettyLineSeparator(facesContext);
- }
- }
-
- protected boolean isRenderCloseButton(ModalDialog dlg)
- {
- return !Boolean.FALSE.equals(dlg.getCloseButton());
- }
-
- private String getStyleName(ModalDialog dlg, String suffix)
- {
- if (dlg.getStyleClass() != null)
- {
- return dlg.getStyleClass() + suffix;
- }
-
- return "";
- }
-
- private void renderDialogViewFrame(FacesContext facesContext, ModalDialog dlg) throws IOException
- {
- ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.IFRAME_ELEM, dlg);
- writer.writeAttribute(HTML.ID_ATTR, "modalDialogContent" + dlg.getDialogVar(), null);
- writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogContent " + getStyleName(dlg, "Content"), null);
- writer.writeAttribute(HTML.SCROLLING_ATTR, "auto", null);
- writer.writeAttribute(HTML.FRAMEBORDER_ATTR, "0", null);
- writer.endElement(HTML.IFRAME_ELEM);
- }
+ UIComponent titleFacet = dlg.getFacet("titleBar");
+ if (titleFacet != null)
+ {
+ RendererUtils.renderChild(facesContext, titleFacet);
+ }
+ else if (dlg.getDialogTitle() != null)
+ {
+ AddResourceFactory.getInstance(facesContext).addStyleSheet(facesContext, AddResource.HEADER_BEGIN, ModalDialog.class, "modalDialog.css");
+
+ writer.startElement(HTML.TABLE_ELEM, dlg);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogDecoration " + getStyleName(dlg, "Decoration") , null);
+ writer.writeAttribute(HTML.CELLPADDING_ATTR, "2", null);
+ writer.writeAttribute(HTML.CELLSPACING_ATTR, "0", null);
+
+ writer.startElement(HTML.TR_ELEM, dlg);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitle " + getStyleName(dlg, "Title"), null);
+
+ writer.startElement(HTML.TD_ELEM, dlg);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitleLeft " + getStyleName(dlg, "TitleLeft"), null);
+ writer.writeText(dlg.getDialogTitle(), null);
+ writer.endElement(HTML.TD_ELEM);
+
+ writer.startElement(HTML.TD_ELEM, dlg);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogTitleRight " + getStyleName(dlg, "TitleRight"), null);
+ if (isRenderCloseButton(dlg))
+ {
+ String imageUri = AddResourceFactory.getInstance(facesContext).getResourceUri(facesContext, ModalDialog.class, "close.gif");
+ writer.startElement(HTML.IMG_ELEM, dlg);
+ writer.writeAttribute(HTML.ID_ATTR, dlg.getDialogVar() + "Closer", null);
+ writer.writeAttribute(HTML.SRC_ATTR, imageUri, null);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogCloser " + getStyleName(dlg, "Closer"), null);
+ writer.endElement(HTML.IMG_ELEM);
+ }
+ writer.endElement(HTML.TD_ELEM);
+
+ writer.endElement(HTML.TR_ELEM);
+ writer.endElement(HTML.TABLE_ELEM);
+ }
+
+ if (dlg.getViewId() != null)
+ {
+ renderDialogViewFrame(facesContext, dlg);
+ }
+ else
+ {
+ RendererUtils.renderChildren(facesContext, uiComponent);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ }
+
+ protected boolean isRenderCloseButton(ModalDialog dlg)
+ {
+ return !Boolean.FALSE.equals(dlg.getCloseButton());
+ }
+
+ private String getStyleName(ModalDialog dlg, String suffix)
+ {
+ if (dlg.getStyleClass() != null)
+ {
+ return dlg.getStyleClass() + suffix;
+ }
+
+ return "";
+ }
+
+ private void renderDialogViewFrame(FacesContext facesContext, ModalDialog dlg) throws IOException
+ {
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.startElement(HTML.IFRAME_ELEM, dlg);
+ writer.writeAttribute(HTML.ID_ATTR, "modalDialogContent" + dlg.getDialogVar(), null);
+ writer.writeAttribute(HTML.CLASS_ATTR, "modalDialogContent " + getStyleName(dlg, "Content"), null);
+ writer.writeAttribute(HTML.SCROLLING_ATTR, "auto", null);
+ writer.writeAttribute(HTML.FRAMEBORDER_ATTR, "0", null);
+ writer.endElement(HTML.IFRAME_ELEM);
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojoaddresource/DojoAddResource.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojoaddresource/DojoAddResource.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojoaddresource/DojoAddResource.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojoaddresource/DojoAddResource.java Thu Jul 3 14:58:05 2008
@@ -81,7 +81,7 @@
private static final String PATH_SEPARATOR = "/";
protected static final Log log = LogFactory.getLog(DojoAddResource.class);
- protected static final Log logSend = LogFactory.getLog(DojoAddResource.class.getName() + ".SEND");
+ protected static final Log logSend = LogFactory.getLog(DojoAddResource.class.getName() + ".SEND");
private static final String RESOURCE_VIRTUAL_PATH = "/faces/myFacesExtensionResource";
@@ -379,19 +379,19 @@
addStyleSheet(context, getStyleInstance(context, uri));
}
- private void addStyleSheet(FacesContext context, WritablePositionedInfo styleInstance)
- {
- try
- {
- styleInstance.writePositionedInfo(context, context.getResponseWriter());
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
+ private void addStyleSheet(FacesContext context, WritablePositionedInfo styleInstance)
+ {
+ try
+ {
+ styleInstance.writePositionedInfo(context, context.getResponseWriter());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
- protected String getAbsoluteUri(FacesContext context, String uri)
+ protected String getAbsoluteUri(FacesContext context, String uri)
{
if (uri.startsWith("/"))
{
@@ -440,7 +440,7 @@
return;
}
- try
+ try
{
info.writePositionedInfo(context, context.getResponseWriter());
}
@@ -626,7 +626,7 @@
resourceUri = uri.substring(posEndCacheKey + 1);
}
- try
+ try
{
Class resourceLoader = getClass(className);
validateResourceLoader(resourceLoader);
@@ -637,9 +637,9 @@
catch (ClassNotFoundException e)
{
log.error("Could not find class for name: " + className, e);
- sendError(response, HttpServletResponse.SC_NOT_FOUND,
+ sendError(response, HttpServletResponse.SC_NOT_FOUND,
"Could not find resourceloader class for name: " + className);
- }
+ }
catch (InstantiationException e)
{
log.error("Could not instantiate class for name: " + className, e);
@@ -652,11 +652,11 @@
sendError(response, HttpServletResponse.SC_FORBIDDEN,
"Could not access resourceloader class for name: " + className);
}
- catch (IOException e)
- {
- logSend.error("Error while serving resource: " +resourceUri+", message : "+ e.getMessage(), e);
- sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- }
+ catch (IOException e)
+ {
+ logSend.error("Error while serving resource: " +resourceUri+", message : "+ e.getMessage(), e);
+ sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+ }
catch (Throwable e)
{
log.error("Unknown error while serving resource: " +resourceUri+", message : "+ e.getMessage(), e);
@@ -664,20 +664,20 @@
}
}
- protected void sendError(HttpServletResponse response, int errorCode, String errorText)
- throws IOException
- {
- try
- {
- response.sendError(errorCode, errorText);
- }
- catch (IllegalStateException e)
- {
- logSend.error("Could not send error, maybe some data has already been sent.", e);
- }
- }
+ protected void sendError(HttpServletResponse response, int errorCode, String errorText)
+ throws IOException
+ {
+ try
+ {
+ response.sendError(errorCode, errorText);
+ }
+ catch (IllegalStateException e)
+ {
+ logSend.error("Could not send error, maybe some data has already been sent.", e);
+ }
+ }
- public boolean hasHeaderBeginInfos(HttpServletRequest request)
+ public boolean hasHeaderBeginInfos(HttpServletRequest request)
{
throw new UnsupportedOperationException();
}
@@ -704,7 +704,7 @@
String myFacesJavascript = (String) request.getAttribute("org.apache.myfaces.myFacesJavascript");
if(myFacesJavascript != null)
{
- originalResponse.insert(beforeBodyEndPosition, myFacesJavascript);
+ originalResponse.insert(beforeBodyEndPosition, myFacesJavascript);
}
else
{
@@ -825,22 +825,22 @@
public void writePositionedInfo(FacesContext context, ResponseWriter writer)
throws IOException
{
- // this will include the dojo stuff in default mode. Override it yourself by adding
- // the DojoInitializer component before any other component (right after f:view)
- DojoUtils.addMainInclude(context, null, null, DojoUtils.getDjConfigInstance(context));
+ // this will include the dojo stuff in default mode. Override it yourself by adding
+ // the DojoInitializer component before any other component (right after f:view)
+ DojoUtils.addMainInclude(context, null, null, DojoUtils.getDjConfigInstance(context));
- addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, DojoAddResource.class, "dojoaddresource.js");
+ addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, DojoAddResource.class, "dojoaddresource.js");
- writer.startElement(HTML.SCRIPT_ELEM, null);
- writer.writeAttribute(HTML.SCRIPT_LANGUAGE_ATTR, HTML.SCRIPT_LANGUAGE_JAVASCRIPT, null);
+ writer.startElement(HTML.SCRIPT_ELEM, null);
+ writer.writeAttribute(HTML.SCRIPT_LANGUAGE_ATTR, HTML.SCRIPT_LANGUAGE_JAVASCRIPT, null);
writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
- // writer.write("dojo.html.insertCssFile('");
- writer.write("oamInsertCssFile('");
- writer.write(context.getExternalContext().encodeActionURL(this.getResourceUri()));
- writer.write("');");
+ // writer.write("dojo.html.insertCssFile('");
+ writer.write("oamInsertCssFile('");
+ writer.write(context.getExternalContext().encodeActionURL(this.getResourceUri()));
+ writer.write("');");
- writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HTML.SCRIPT_ELEM);
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/ResourceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/ResourceRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/ResourceRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/ResourceRenderer.java Thu Jul 3 14:58:05 2008
@@ -32,14 +32,14 @@
*/
public interface ResourceRenderer
{
- /**
- * This method will be called first, to set the contexts.
- *
+ /**
+ * This method will be called first, to set the contexts.
+ *
* @param facesContext the faces context
* @param imageContext the image context width aditional image parameters
- */
- void setContext(FacesContext facesContext, ResourceContext resourceContext) throws Exception;
-
+ */
+ void setContext(FacesContext facesContext, ResourceContext resourceContext) throws Exception;
+
/**
* The content length of the image to render.
* Set to a negative value if you don't want to set the response content length.
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/SimpleResourceContext.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/SimpleResourceContext.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/SimpleResourceContext.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dynamicResources/SimpleResourceContext.java Thu Jul 3 14:58:05 2008
@@ -28,7 +28,7 @@
*/
public class SimpleResourceContext implements ResourceContext
{
-
+
private final Map _params;
public SimpleResourceContext(Map params)
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java Thu Jul 3 14:58:05 2008
@@ -182,7 +182,7 @@
fadeColor = (fadeColor != null) ? fadeColor : DEFAULT_FADE_COLOR;
fadeColor = fadeColor.equals("") ? DEFAULT_FADE_COLOR : fadeColor;
if(fadeColor.trim().matches("^\\\\[(.*\\,)+\\\\]$")) //pattern [col,col,col] roughly
- return fadeColor;
+ return fadeColor;
else return "\""+fadeColor+"\"";
}
@@ -209,10 +209,10 @@
if (puff != null && puff.booleanValue())
{
//writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Puff(this);", null);
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
- writer.write("var "+component.getClientId(context).replaceAll("\\:","_")+"_fader = new org_apache_myfaces_effects_fader('"+component.getClientId(context)+"',300);");
- writer.endElement(HTML.SCRIPT_ELEM);
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+ writer.write("var "+component.getClientId(context).replaceAll("\\:","_")+"_fader = new org_apache_myfaces_effects_fader('"+component.getClientId(context)+"',300);");
+ writer.endElement(HTML.SCRIPT_ELEM);
}
writer.startElement(HTML.DIV_ELEM, component);
@@ -238,10 +238,10 @@
if (puff != null && puff.booleanValue())
{
writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:"+component.getClientId(context).replaceAll("\\:","_")+"_fader.fadeOut();", null);
- //writer.startElement(HTML.SCRIPT_ELEM, component);
- //writer.writeAttribute(HTML.TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
- ///writer.write("var "+component.getClientId(context).replaceAll("\\:","_")+"_fader = new org_apache_myfaces_effects_fader('"+component.getClientId(context)+"',300);");
- //writer.endElement(HTML.SCRIPT_ELEM);
+ //writer.startElement(HTML.SCRIPT_ELEM, component);
+ //writer.writeAttribute(HTML.TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+ ///writer.write("var "+component.getClientId(context).replaceAll("\\:","_")+"_fader = new org_apache_myfaces_effects_fader('"+component.getClientId(context)+"',300);");
+ //writer.endElement(HTML.SCRIPT_ELEM);
}
if (squish != null && squish.booleanValue())
{
@@ -294,7 +294,7 @@
if (fade != null && fade.booleanValue())
{
DojoUtils.addRequire(facesContext,component, "dojo.lfx.*");
- writer.startElement(HTML.SCRIPT_ELEM, component);
+ writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
writer.writeAttribute(HTML.SCRIPT_LANGUAGE_ATTR, HTML.SCRIPT_LANGUAGE_JAVASCRIPT, null);
StringBuffer commandBuffer = new StringBuffer(128);
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExcelExporterUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExcelExporterUtil.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExcelExporterUtil.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExcelExporterUtil.java Thu Jul 3 14:58:05 2008
@@ -40,37 +40,37 @@
* This class is a utility class for serving excel exporting.
*/
public class ExcelExporterUtil {
-
- private static void addColumnHeaders(HSSFSheet sheet, List columns) {
- HSSFRow rowHeader = sheet.createRow(0);
-
- for (int i = 0; i < columns.size(); i++) {
- UIColumn column = (UIColumn) columns.get(i);
- addColumnValue(rowHeader, column.getHeader(), i);
- }
- }
-
- private static List getColumns(HtmlDataTable table) {
- List columns = new ArrayList();
- for (int i = 0; i < table.getChildCount(); i++) {
- UIComponent child = (UIComponent) table.getChildren().get(i);
- if (child instanceof UIColumn) {
- columns.add(child);
- }
- }
- return columns;
- }
-
- private static void addColumnValue(HSSFRow rowHeader,
- UIComponent component, int index) {
- HSSFCell cell = rowHeader.createCell((short) index);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- if (component instanceof ValueHolder) {
- String stringValue = RendererUtils.getStringValue(FacesContext
- .getCurrentInstance(), component);
- cell.setCellValue(stringValue);
- }
- }
+
+ private static void addColumnHeaders(HSSFSheet sheet, List columns) {
+ HSSFRow rowHeader = sheet.createRow(0);
+
+ for (int i = 0; i < columns.size(); i++) {
+ UIColumn column = (UIColumn) columns.get(i);
+ addColumnValue(rowHeader, column.getHeader(), i);
+ }
+ }
+
+ private static List getColumns(HtmlDataTable table) {
+ List columns = new ArrayList();
+ for (int i = 0; i < table.getChildCount(); i++) {
+ UIComponent child = (UIComponent) table.getChildren().get(i);
+ if (child instanceof UIColumn) {
+ columns.add(child);
+ }
+ }
+ return columns;
+ }
+
+ private static void addColumnValue(HSSFRow rowHeader,
+ UIComponent component, int index) {
+ HSSFCell cell = rowHeader.createCell((short) index);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ if (component instanceof ValueHolder) {
+ String stringValue = RendererUtils.getStringValue(FacesContext
+ .getCurrentInstance(), component);
+ cell.setCellValue(stringValue);
+ }
+ }
/*
* This method is used for adding the columns values to the HSSFSheet.
@@ -167,7 +167,7 @@
* @param fileName
* @throws IOException
*/
- public static void generateEXCEL(FacesContext facesContext,
+ public static void generateEXCEL(FacesContext facesContext,
HttpServletResponse response, String fileName,
HtmlDataScroller dataScroller, boolean selectedPage)
throws IOException {
@@ -196,14 +196,14 @@
// public static void generateEXCEL(HSSFWorkbook workBook,
// RenderResponse response, String filename) throws IOException {
-// response.setContentType("application/vnd.ms-excel");
-// response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
-// response.setProperty("Cache-Control",
-// "must-revalidate, post-check=0, pre-check=0");
-// response.setProperty("Pragma", "public");
-// response.setProperty("Content-disposition", "attachment;filename="
-// + filename + ".xls");
+// response.setContentType("application/vnd.ms-excel");
+// response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+// response.setProperty("Cache-Control",
+// "must-revalidate, post-check=0, pre-check=0");
+// response.setProperty("Pragma", "public");
+// response.setProperty("Content-disposition", "attachment;filename="
+// + filename + ".xls");
//
-// workBook.write(response.getPortletOutputStream());
-// }
+// workBook.write(response.getPortletOutputStream());
+// }
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExporterConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExporterConstants.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExporterConstants.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/exporter/util/ExporterConstants.java Thu Jul 3 14:58:05 2008
@@ -19,9 +19,9 @@
package org.apache.myfaces.custom.exporter.util;
public interface ExporterConstants {
- public static String EXPORTER_TABLE_ID = "exporterTableId";
- public static String EXPORTER_FILE_NAME = "exporterFileName";
- public static String EXPORTER_FILE_TYPE = "exporterFileType";
- public static String PDF_FILE_TYPE = "PDF";
- public static String EXCEL_FILE_TYPE = "XLS";
+ public static String EXPORTER_TABLE_ID = "exporterTableId";
+ public static String EXPORTER_FILE_NAME = "exporterFileName";
+ public static String EXPORTER_FILE_TYPE = "exporterFileType";
+ public static String PDF_FILE_TYPE = "PDF";
+ public static String EXCEL_FILE_TYPE = "XLS";
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fieldset/AbstractFieldset.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fieldset/AbstractFieldset.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fieldset/AbstractFieldset.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fieldset/AbstractFieldset.java Thu Jul 3 14:58:05 2008
@@ -44,7 +44,7 @@
* tagExcluded = "true"
*/
public Object getValue() {
- return "fieldset";
+ return "fieldset";
}
/**