private String processThisFragment(PageContext context) throws PageAction { // determine what controller to use Object controller = getController(context.getRequest()); PageView view = null; if (controller == null) { // some views can specify their controller try { view = getView(null, context.getRequest()); ProviderAndName controllerProviderAndName = view.getController(); if (controllerProviderAndName != null) { controller = getController( controllerProviderAndName.getProvider(), controllerProviderAndName.getName()); } } catch (Exception ex) { // this probably means we didn't find a view. Pass now to fail later } // TODO determine the controller from the view if (controller == null) { // go with the blank controller controller = emptyController; } } context.setController(controller); // let the controller handle the request // TODO: refactor because fragment controllers can now also return a FragmentRequest Object resultObject = handleRequestWithController(context); if (resultObject instanceof PageAction) { throw (PageAction) resultObject; } String result = (String) resultObject; // check if there was redirect (other than via a thrown PageAction) if (result != null && result.startsWith("redirect:")) { String toApplicationUrl = result.substring("redirect:".length()); throw new Redirect(toApplicationUrl); } // If the controller returns a simple string, we interpret that as a view in the requested // provider. // The controller should return "*:viewName" to search all providers. if (result != null && result.indexOf(':') <= 0) { result = context.getRequest().getMappedProviderName() + ":" + result; } // determine what view to use // (if the controller requests the default view, and we have it from earlier, we use that) if (result != null || view == null) { view = getView(result, context.getRequest()); } context.setView(view); String output = view.render(context); return output; }
@Transformer public PageView addPortletSetup(PageView pageView) throws Exception { Layout layout = getLayoutLocalServirce().getLayout(pageView.getPlid()); Collection<PortletSetup> portletSetups = new ArrayList<>(); for (String portletId : pageView.getPortlets()) { Map<String, String[]> map = getPortletPreferencesFactory().getStrictLayoutPortletSetup(layout, portletId).getMap(); portletSetups.add(new PortletSetup(portletId, map)); } pageView.setPortletSetups(portletSetups); return pageView; }
@Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case "CHANGE": pf = PrinterJob.getPrinterJob().pageDialog(pf); setMediaSizeInfo(); pages.setPageFormat(pf); break; case "PRINT": PrinterJob pjob = PrinterJob.getPrinterJob(); pjob.setPageable(new MyPageable(pages.getNumberOfPages(), pf, p)); if (pjob.printDialog() == false) return; try { pjob.print(); } catch (PrinterException e1) { JOptionPane.showMessageDialog( this, "Druckfehler: " + e1.getMessage(), "Fehler", JOptionPane.WARNING_MESSAGE); } break; case "CANCEL": setVisible(false); break; } }
public void doBodyRefresh(ComponentBuilder bodyComponentBuilder) { view.setBody(bodyComponentBuilder); }
public void onSubMenuSelected(SubMenuItem subMenuItem) { // TODO check access rights for the current user view.setCurrentSubMenuItem(subMenuItem); }
public void onMenuSelected(MainMenuItem menuItem) { view.setCurrentMenuItem(menuItem); }