org.exoplatform.wcm.webui
Class Utils

java.lang.Object
  extended by org.exoplatform.wcm.webui.Utils

public class Utils
extends java.lang.Object

Created by The eXo Platform SAS Author : Hoa Pham hoa.phamvu@exoplatform.com Oct 23, 2008


Field Summary
static java.lang.String TURN_ON_QUICK_EDIT
          The Quick edit attribute for HTTPSession
 
Constructor Summary
Utils()
           
 
Method Summary
static boolean canEditCurrentPortal(java.lang.String remoteUser)
          Can edit current portal.
static java.lang.String cleanString(java.lang.String str)
          Clean string.
static void closePopupWindow(org.exoplatform.webui.core.UIContainer container, java.lang.String popupWindowId)
          Close popup window.
static void createPopupMessage(org.exoplatform.webui.core.UIContainer container, java.lang.String message, java.lang.Object[] args, int type)
          Creates the popup message.
static void createPopupWindow(org.exoplatform.webui.core.UIContainer container, org.exoplatform.webui.core.UIComponent component, java.lang.String popupWindowId, int width, int height)
          Creates the popup window.
static java.lang.String getCurrentMode()
          Gets the current mode of the site
static javax.jcr.Node getNodeView(javax.jcr.Node originalNode)
          Deprecated. Since 1.2.2, we don't get content directly like this. Replaced by getViewableNodeByComposer(String, String, String) and by getViewableNodeByComposer(String, String, String, String)}
static org.exoplatform.webui.core.UIPopupContainer getPopupContainer(org.exoplatform.webui.core.UIContainer container)
          Gets the popup container.
static
<T> T
getService(java.lang.Class<T> clazz)
          Gets the service.
static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider()
          Gets the session provider.
static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider(org.exoplatform.webui.core.UIComponent component)
          Deprecated. Replaced by getSessionProvider()
static org.exoplatform.services.jcr.ext.common.SessionProvider getSystemProvider()
          Gets the system session provider.
static org.exoplatform.services.jcr.ext.common.SessionProvider getSystemProvider(org.exoplatform.webui.core.UIComponent component)
          Deprecated. Replaced by getSystemProvider()
static javax.jcr.Node getViewableNodeByComposer(java.lang.String repository, java.lang.String workspace, java.lang.String nodeIdentifier)
          Gets the viewable node by WCMComposer (depends on site mode)
static javax.jcr.Node getViewableNodeByComposer(java.lang.String repository, java.lang.String workspace, java.lang.String nodeIdentifier, java.lang.String version)
          Gets the viewable node by WCMComposer (depends on site mode)
static boolean isEditPortletInCreatePageWizard()
          Checks if is edits the portlet in create page wizard.
static boolean isQuickEditMode(org.exoplatform.webui.core.UIContainer container, java.lang.String popupWindowId)
          Checks if is quick editmode.
static boolean isShowDraft(javax.jcr.Node content)
          Check if the content is draft and current mode of the site is edit mode
static boolean isShowQuickEdit()
          Check if the current mode of the site is edit mode
static boolean isShowQuickEdit(javax.jcr.Node content)
          Check if the content is editable and current mode of the site is edit mode
static boolean isViewable(javax.jcr.Node node)
          Check if the node is viewable for the current user or not viewable.
static void updatePopupWindow(org.exoplatform.webui.core.UIContainer container, org.exoplatform.webui.core.UIComponent component, java.lang.String popupWindowId)
          Update popup window.
static void updatePortal(org.exoplatform.webui.application.portlet.PortletRequestContext context)
          Refresh whole portal by AJAX.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TURN_ON_QUICK_EDIT

public static final java.lang.String TURN_ON_QUICK_EDIT
The Quick edit attribute for HTTPSession

See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

isEditPortletInCreatePageWizard

public static boolean isEditPortletInCreatePageWizard()
Checks if is edits the portlet in create page wizard.

Returns:
true, if is edits the portlet in create page wizard

isQuickEditMode

public static boolean isQuickEditMode(org.exoplatform.webui.core.UIContainer container,
                                      java.lang.String popupWindowId)
Checks if is quick editmode.

Parameters:
container - the current container
popupWindowId - the popup window id
Returns:
true, if is quick editmode

canEditCurrentPortal

public static boolean canEditCurrentPortal(java.lang.String remoteUser)
                                    throws java.lang.Exception
Can edit current portal.

Parameters:
remoteUser - the remote user
Returns:
true, if successful
Throws:
java.lang.Exception - the exception

cleanString

public static java.lang.String cleanString(java.lang.String str)
Clean string.

Parameters:
str - the str
Returns:
the string

updatePortal

public static void updatePortal(org.exoplatform.webui.application.portlet.PortletRequestContext context)
Refresh whole portal by AJAX.

Parameters:
context - the portlet request context

getNodeView

@Deprecated
public static javax.jcr.Node getNodeView(javax.jcr.Node originalNode)
Deprecated. Since 1.2.2, we don't get content directly like this. Replaced by getViewableNodeByComposer(String, String, String) and by getViewableNodeByComposer(String, String, String, String)}

Get node view by publication lifecycle and current mode

Parameters:
originalNode - the original node
Returns:
the node is got by publication lifecycle and current mode. Return original node if node doesn't join to any lifecycle.

getViewableNodeByComposer

public static javax.jcr.Node getViewableNodeByComposer(java.lang.String repository,
                                                       java.lang.String workspace,
                                                       java.lang.String nodeIdentifier)
Gets the viewable node by WCMComposer (depends on site mode)

Parameters:
repository - the repository's name
workspace - the workspace's name
nodeIdentifier - the node's path or node's UUID
Returns:
the viewable node. Return null if nodeIdentifier is invalid
See Also:
getViewableNodeByComposer()

getViewableNodeByComposer

public static javax.jcr.Node getViewableNodeByComposer(java.lang.String repository,
                                                       java.lang.String workspace,
                                                       java.lang.String nodeIdentifier,
                                                       java.lang.String version)
Gets the viewable node by WCMComposer (depends on site mode)

Parameters:
repository - the repository's name
workspace - the workspace's name
nodeIdentifier - the node's path or node's UUID
version - the base version (e.g. WCMComposer.BASE_VERSION)
Returns:
the viewable node. Return null if nodeIdentifier is invalid
See Also:
getViewableNodeByComposer(), WCMComposer

getCurrentMode

public static java.lang.String getCurrentMode()
Gets the current mode of the site

Returns:
the current mode (e.g. WCMComposer.MODE_EDIT)
See Also:
WCMComposer

isShowDraft

public static boolean isShowDraft(javax.jcr.Node content)
Check if the content is draft and current mode of the site is edit mode

Parameters:
content - the content node.
Returns:
true, the content is draft and current mode is edit mode, otherwise return false.

isShowQuickEdit

public static boolean isShowQuickEdit()
Check if the current mode of the site is edit mode

Returns:
true, if current mode is edit mode

isShowQuickEdit

public static boolean isShowQuickEdit(javax.jcr.Node content)
Check if the content is editable and current mode of the site is edit mode

Parameters:
content - the content node
Returns:
true if there is no content if the content is editable and current mode is edit mode

isViewable

public static boolean isViewable(javax.jcr.Node node)
Check if the node is viewable for the current user or not viewable.
return True if the node is viewable, otherwise will return False

Parameters:
node: - The node to check

createPopupWindow

public static void createPopupWindow(org.exoplatform.webui.core.UIContainer container,
                                     org.exoplatform.webui.core.UIComponent component,
                                     java.lang.String popupWindowId,
                                     int width,
                                     int height)
                              throws java.lang.Exception
Creates the popup window. Each portlet have a UIPopupContainer.
Every UIPopupWindow created by this method is belong to this container.

Parameters:
container - the current container
component - the component which will be display as a popup
popupWindowId - the popup's ID
width - the width of the popup
height - the height of the popup
Throws:
java.lang.Exception - the exception

closePopupWindow

public static void closePopupWindow(org.exoplatform.webui.core.UIContainer container,
                                    java.lang.String popupWindowId)
Close popup window.

Parameters:
container - the current container
popupWindowId - the popup's ID

updatePopupWindow

public static void updatePopupWindow(org.exoplatform.webui.core.UIContainer container,
                                     org.exoplatform.webui.core.UIComponent component,
                                     java.lang.String popupWindowId)
Update popup window.

Parameters:
container - the container
component - the component which will be replace for the old one in the same popup
popupWindowId - the popup's ID

getPopupContainer

public static org.exoplatform.webui.core.UIPopupContainer getPopupContainer(org.exoplatform.webui.core.UIContainer container)
Gets the popup container.

Parameters:
container - the current container
Returns:
the popup container

createPopupMessage

public static void createPopupMessage(org.exoplatform.webui.core.UIContainer container,
                                      java.lang.String message,
                                      java.lang.Object[] args,
                                      int type)
Creates the popup message.

Parameters:
container - the current container
message - the message key
args - the arguments to show in the message
type - the message's type (e.g. ApplicationMessage.INFO)
See Also:
ApplicationMessage

getService

public static <T> T getService(java.lang.Class<T> clazz)
Gets the service.

Parameters:
clazz - the class of the service
Returns:
the service

getSessionProvider

@Deprecated
public static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider(org.exoplatform.webui.core.UIComponent component)
Deprecated. Replaced by getSessionProvider()

Gets the session provider.

Returns:
the session provider
See Also:
SessionProviderFactory

getSessionProvider

public static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider()
Gets the session provider.

Returns:
the session provider
See Also:
SessionProviderFactory

getSystemProvider

@Deprecated
public static org.exoplatform.services.jcr.ext.common.SessionProvider getSystemProvider(org.exoplatform.webui.core.UIComponent component)
Deprecated. Replaced by getSystemProvider()

Gets the system session provider.

Returns:
the system session provider
See Also:
SessionProviderFactory

getSystemProvider

public static org.exoplatform.services.jcr.ext.common.SessionProvider getSystemProvider()
Gets the system session provider.

Returns:
the system session provider
See Also:
SessionProviderFactory


Copyright © 2010 eXo Platform SAS. All Rights Reserved.