use of org.alfresco.web.ui.common.component.UIModeList in project acs-community-packaging by Alfresco.
the class BrowseBean method viewModeChanged.
// ------------------------------------------------------------------------------
// Navigation action event handlers
/**
* Change the current view mode based on user selection
*
* @param event ActionEvent
*/
public void viewModeChanged(ActionEvent event) {
UIModeList viewList = (UIModeList) event.getComponent();
// get the view mode ID
String viewMode = viewList.getValue().toString();
if (VIEWMODE_DASHBOARD.equals(viewMode) == false) {
// set the page size based on the style of display
int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, viewMode);
setPageSizeContent(pageSize);
setPageSizeSpaces(pageSize);
if (logger.isDebugEnabled())
logger.debug("Browse view page size set to: " + pageSize);
setDashboardView(false);
// push the view mode into the lists
setBrowseViewMode(viewMode);
// setup dispatch context for custom views
this.navigator.setupDispatchContext(this.navigator.getCurrentNode());
// browse to appropriate view
FacesContext fc = FacesContext.getCurrentInstance();
String outcome = null;
String viewId = fc.getViewRoot().getViewId();
if (viewId.equals(BROWSE_VIEW_ID) == false && viewId.equals(CATEGORY_VIEW_ID) == false) {
outcome = "browse";
}
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);
} else {
// special case for Dashboard view
setDashboardView(true);
}
}
use of org.alfresco.web.ui.common.component.UIModeList in project acs-community-packaging by Alfresco.
the class CategoriesDialog method viewModeChanged.
/**
* Change the current view mode based on user selection
*
* @param event ActionEvent
*/
public void viewModeChanged(ActionEvent event) {
UIModeList viewList = (UIModeList) event.getComponent();
// get the view mode ID
setViewMode(viewList.getValue().toString());
}
use of org.alfresco.web.ui.common.component.UIModeList in project acs-community-packaging by Alfresco.
the class NavigationBean method toolbarLocationChanged.
/**
* Action to change the toolbar location
* Currently this will changed the location from Company to the users Home space
*/
public void toolbarLocationChanged(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
try {
UIModeList locationList = (UIModeList) event.getComponent();
String location = locationList.getValue().toString();
processToolbarLocation(location, true);
} catch (InvalidNodeRefException refErr) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NOHOME), Application.getCurrentUser(context).getHomeSpaceId()), refErr);
} catch (Exception err) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
}
use of org.alfresco.web.ui.common.component.UIModeList in project acs-community-packaging by Alfresco.
the class SidebarBean method pluginChanged.
// ------------------------------------------------------------------------------
// Event handlers
public void pluginChanged(ActionEvent event) {
UIModeList pluginList = (UIModeList) event.getComponent();
// get the selected plugin
this.activePlugin = pluginList.getValue().toString();
}
use of org.alfresco.web.ui.common.component.UIModeList in project acs-community-packaging by Alfresco.
the class UISidebar method encodeBegin.
@SuppressWarnings("unchecked")
@Override
public void encodeBegin(FacesContext context) throws IOException {
if (!isRendered())
return;
ResponseWriter out = context.getResponseWriter();
out.write("<div id='sidebar' class='sidebar'>");
// render the start of the header panel
String cxPath = context.getExternalContext().getRequestContextPath();
out.write("<table cellspacing='0' cellpadding='0' style='background-color: #ffffff;' width='100%'>" + "<tr valign='top'><td width='20%'><table cellspacing='0' cellpadding='0' width='100%'>" + "<tr><td style='width: 5px; background-image: url(");
out.write(cxPath);
out.write("/images/parts/sidebar_top_grey_begin.gif)' valign='top'>" + "<img src=\"");
out.write(cxPath);
out.write("/images/parts/sidebar_grey_01.gif\" width='5' height='5' alt=''></td>" + "<td style='height: 24px; background-image: url(");
out.write(cxPath);
out.write("/images/parts/sidebar_top_grey_bg.gif)'>");
// generate the required child components if not present
if (this.getChildCount() == 1) {
// create the mode list component
UIModeList modeList = (UIModeList) context.getApplication().createComponent("org.alfresco.faces.ModeList");
modeList.setId("sidebarPluginList");
modeList.setValue(this.getActivePlugin());
modeList.setIconColumnWidth(2);
modeList.setMenu(true);
modeList.setMenuImage("/images/icons/menu.gif");
modeList.getAttributes().put("itemSpacing", 4);
modeList.getAttributes().put("styleClass", "moreActionsMenu");
modeList.getAttributes().put("selectedStyleClass", "statusListHighlight");
MethodBinding listener = context.getApplication().createMethodBinding("#{SidebarBean.pluginChanged}", new Class[] { ActionEvent.class });
modeList.setActionListener(listener);
// create the child list items component
UIListItems items = (UIListItems) context.getApplication().createComponent("org.alfresco.faces.ListItems");
ValueBinding binding = context.getApplication().createValueBinding("#{SidebarBean.plugins}");
items.setValueBinding("value", binding);
// add the list items to the mode list component
modeList.getChildren().add(items);
// create the actions component
UIActions actions = (UIActions) context.getApplication().createComponent("org.alfresco.faces.Actions");
actions.setId("sidebarActions");
actions.setShowLink(false);
setupActionGroupId(context, actions);
// add components to the sidebar
this.getChildren().add(0, modeList);
this.getChildren().add(1, actions);
} else {
// update the child UIActions component with the correct
// action group id and clear it's current children
UIActions actions = (UIActions) this.getChildren().get(1);
actions.reset();
setupActionGroupId(context, actions);
}
}
Aggregations