use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class BrowseBean method setDashboardView.
/**
* @param dashboardView The dashboard view mode to set.
*/
public void setDashboardView(boolean dashboardView) {
this.dashboardView = dashboardView;
if (dashboardView == true) {
FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard");
}
}
use of javax.faces.context.FacesContext 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 javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class AdminNodeBrowseBean method submitSearch.
/**
* Action to submit search
*
* @return next action
*/
public String submitSearch() {
long start = System.currentTimeMillis();
RetryingTransactionCallback<String> searchCallback = new RetryingTransactionCallback<String>() {
public String execute() throws Throwable {
if (queryLanguage.equals("noderef")) {
// ensure node exists
NodeRef nodeRef = new NodeRef(query);
boolean exists = getNodeService().exists(nodeRef);
if (!exists) {
throw new AlfrescoRuntimeException("Node " + nodeRef + " does not exist.");
}
setNodeRef(nodeRef);
return "node";
} else if (queryLanguage.equals("selectnodes")) {
List<NodeRef> nodes = getSearchService().selectNodes(getNodeRef(), query, null, getNamespaceService(), false);
searchResults = new SearchResults(nodes);
return "search";
}
// perform search
searchResults = new SearchResults(getSearchService().query(getNodeRef().getStoreRef(), queryLanguage, query));
return "search";
}
};
try {
String result = getTransactionService().getRetryingTransactionHelper().doInTransaction(searchCallback, true);
this.searchElapsedTime = System.currentTimeMillis() - start;
return result;
} catch (Throwable e) {
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setDetail("Search failed due to: " + e.toString());
context.addMessage("searchForm:query", message);
return "error";
}
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class ImportDialog method reset.
/**
* Resets the dialog state back to the default
*/
public void reset() {
this.file = null;
this.fileName = null;
this.runInBackground = true;
// delete the temporary file we uploaded earlier
if (this.file != null) {
this.file.delete();
}
// remove the file upload bean from the session
FacesContext ctx = FacesContext.getCurrentInstance();
ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class ImportDialog method getContainerTitle.
@Override
public String getContainerTitle() {
FacesContext fc = FacesContext.getCurrentInstance();
String name = Application.getMessage(fc, MSG_LEFT_QUOTE) + browseBean.getActionSpace().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
return MessageFormat.format(Application.getMessage(fc, MSG_IMPORT_TITLE), name);
}
Aggregations