本文整理匯總了Java中javax.faces.application.Application.getViewHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getViewHandler方法的具體用法?Java Application.getViewHandler怎麽用?Java Application.getViewHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.application.Application
的用法示例。
在下文中一共展示了Application.getViewHandler方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJSFInfo
import javax.faces.application.Application; //導入方法依賴的package包/類
/**
* gets JSF information like JSF version and Faces context.
*
* @return the JSF info
*/
public static Map<String, Object> getJSFInfo() {
final LinkedHashMap<String, Object> details = new LinkedHashMap<String, Object>();
final FacesContext context = FacesContext.getCurrentInstance();
final Application application = context.getApplication();
final ViewHandler viewHandler = application.getViewHandler();
final ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, context.getViewRoot().getViewId());
final LifecycleFactory LifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
details.put("JSF-Version", FacesContext.class.getPackage().getImplementationVersion());
details.put("JSF-Version-Package", FacesContext.class.getPackage().getName());
details.put("FacesContext", context.getClass());
details.put("Application", application.getClass());
details.put("ViewHandler", viewHandler.getClass());
details.put("ViewDeclarationLanguage", vdl.getClass());
details.put("LifecycleFactory", LifecycleFactory.getClass());
return details;
}
示例2: goToRightPage
import javax.faces.application.Application; //導入方法依賴的package包/類
public void goToRightPage() {
String viewId = this.originalViewId;
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ViewHandler viewHandler = app.getViewHandler();
UIViewRoot root = viewHandler.createView(context, viewId);
context.setViewRoot(root);
if ("/datacenter/dataCenterSimulationRealTime.xhtml".equals(viewId)) {
this.dataCenterControllerSimulator.initHostMachineSimulatorList();
}
if ("/datacenter/dataCenterVirtualMachinePlacement.xhtml".equals(viewId)) {
this.dataCenterController.getDataCenterVirtualMachinePlacementSimulator().setDataCenter(dataCenterController.getDataCenter());
}
if ("/datacenter/vmPlacementTestRunner.xhtml".equals(viewId)) {
this.dataCenterController.getPlacementSimulatorTestRunner().setDataCenter(dataCenterController.getDataCenter());
}
}
示例3: setId
import javax.faces.application.Application; //導入方法依賴的package包/類
@Override
public void setId(long id)
{
// discard previous unsaved changes if any
cancel();
super.setId(id);
setEnterValuesPanelExpanded(true);
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
context.renderResponse();
}
示例4: beforePhase
import javax.faces.application.Application; //導入方法依賴的package包/類
@Override
public void beforePhase(final PhaseEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
String viewId = context.getViewRoot().getViewId();
if ("/virtualMachine.xhtml".equals(viewId)
|| "/datacenter/dataCenterSimulationRealTime.xhtml"
.equals(viewId)
|| "/datacenter/dataCenterSimulationFaster.xhtml"
.equals(viewId)
|| "/analyzeMetrics.xhtml"
.equals(viewId)
|| "/datacenter/dataCenterVirtualMachinePlacement.xhtml"
.equals(viewId)
// || "/datacenter/vmPlacementTestRunner.xhtml"
// .equals(viewId)
) {
Application app = context.getApplication();
DataCenterController dataCenterController = (DataCenterController) app
.evaluateExpressionGet(context, "#{dataCenterController}",
DataCenterController.class);
Navigator navigator = (Navigator) app.evaluateExpressionGet(
context, "#{navigator}", Navigator.class);
if (dataCenterController.getDataCenterChoice() == null) {
navigator.setOriginalViewId(viewId);
ViewHandler viewHandler = app.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context,
"/datacenter/dataCenterChoice.xhtml");
context.setViewRoot(viewRoot);
}
}
}
示例5: refresh
import javax.faces.application.Application; //導入方法依賴的package包/類
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context
.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
context.renderResponse(); //Optional
}
示例6: refresh
import javax.faces.application.Application; //導入方法依賴的package包/類
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context
.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
}
示例7: refresh
import javax.faces.application.Application; //導入方法依賴的package包/類
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context
.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
// context.renderResponse(); //Optional
}
示例8: loadEmptyPage
import javax.faces.application.Application; //導入方法依賴的package包/類
public static UIViewRoot loadEmptyPage(AbstractXspTest test, FacesContext context) throws Exception{
String pageName = "/pages/pregenerated/empty.xsp";
Application application = lazyApplication(test);
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot root = viewHandler.createView(context, pageName);
if( null == root ){
throw new RuntimeException("JUnit test could not load the empty page "+pageName);
}
context.setViewRoot(root);
return root;
}
示例9: loadView
import javax.faces.application.Application; //導入方法依賴的package包/類
public static UIViewRoot loadView(AbstractXspTest test,
FacesContext context, String viewId) throws Exception{
String pageName = toPageName(viewId);
Application application = lazyApplication(test);
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot root = viewHandler.createView(context, pageName);
if( null != root ){
context.setViewRoot(root);
}
return root;
}
示例10: refresh
import javax.faces.application.Application; //導入方法依賴的package包/類
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context
.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
context.renderResponse(); //Optional
}
示例11: _appendIcon
import javax.faces.application.Application; //導入方法依賴的package包/類
private void _appendIcon(
FacesContext context,
ResponseWriter rw,
String iconUri,
boolean isRtl,
RenderingContext rc
) throws IOException
{
String styleAppender = "";
rw.startElement("img", null);
rw.writeAttribute("border", "0", null);
rw.writeAttribute("align", "absmiddle", null);
if (isPDA(rc))
{
if (isRtl)
{
rw.writeAttribute("style", "padding-left: 5px;", null);
}
else
{
rw.writeAttribute("style", "padding-right: 5px;", null);
}
}
else
{
if (isRtl)
{
rw.writeAttribute("style", "padding-left: 5px; float: right;", null);
}
else
{
rw.writeAttribute("style", "padding-right: 5px; float: left;", null);
}
}
Application application = context.getApplication();
ViewHandler handler = application.getViewHandler();
String resolvedIconUri = handler.getResourceURL(context, iconUri);
renderEncodedResourceURI(context, "src", resolvedIconUri);
rw.endElement("img");
}