/** * Search for editor extensions and initialize them. * * @param id editor entity id */ private void createExtensions(Long id) { // Step 1 - find and instantiate extensions... String entityType = context.getEntityDescriptor().getId(); List<Object> extensionObjs = EditorExtensionUtils.getExtensions(EXTENSION_POINT_EDITOR_EXT, entityType); for (Object extObj : extensionObjs) { if (extObj instanceof IEntityEditorExtension) { IEntityEditorExtension extension = (IEntityEditorExtension) extObj; extensions.add(extension); } else { log.error( "EntityEditorExtension for entity " + entityType + " does not implement IEntityEditorExtension interface."); } } // Step 2 - initialize extensions for (IEntityEditorExtension extension : extensions) { extension.initialize(context, editor); extension.addActions(toolbar); } List<ICustomEntityActionCreator> tabExtensions = EditorExtensionUtils.getExtensions("entityEditorActions", entityType); for (ICustomEntityActionCreator entityActionCreator : tabExtensions) { toolbar .addGroup() .addAction( entityActionCreator.createAction( ExtendedApplication.getInstance(this).getSite(), entityType, String.valueOf(id))); } }
@Override public void modelContentChanged(EditorModelEvent event) { if (EditorModelEvent.CLOSE_REQUEST == event.getEventType()) { // someone wants to close this Site site = ExtendedApplication.getInstance(this).getSite(); site.popPage(this); } }
/* (non-Javadoc) * @see de.jwic.base.Control#actionPerformed(java.lang.String, java.lang.String) */ @Override public void actionPerformed(String actionId, String parameter) { if ("undoChanges".equalsIgnoreCase(actionId)) { tableModel.getUserConfigHandler().updateRelatedConfig(true); onCancel(); // to close the window } else if ("saveCurrent".equalsIgnoreCase(actionId)) { tableModel.getUserConfigHandler().updateRelatedConfig(false); onCancel(); // to close the window } else if ("saveNew".equalsIgnoreCase(actionId)) { final IUserViewConfiguration uvc = tableModel.getUserConfigHandler().createConfigWithCurrentSettings(); UserViewConfigurationControl ctrl = createUserConfigControl(uvc, true); ctrl.actionEdit(); ctrl.addListener( new IUserViewConfigurationControlListener() { @Override public void onConfigDeleted(Event event) {} @Override public void onConfigApplied(Event event) {} @Override public void onConfigUpdated(Event event) { // if it's a new config created from current settings, we need to apply it after it's // saved, to make it the main one tableModel.getUserConfigHandler().applyConfig(uvc); } }); } else if ("loadProfile".equalsIgnoreCase(actionId)) { // to prevent opening the dialog multiple times if (loadProfileWindow != null) { return; } loadProfileWindow = new LoadProfileWindow(ExtendedApplication.getInstance(this).getSite(), tableModel); loadProfileWindow.addDialogWindowListener( new DialogWindowAdapter() { @Override public void onDialogAborted(DialogEvent event) { loadProfileWindow = null; } }); loadProfileWindow.show(); } }
protected void closeEditor() { Site site = ExtendedApplication.getInstance(this).getSite(); site.popPage(this); }
/* (non-Javadoc) * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) */ @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if (!Trace.isEnabled()) { chain.doFilter(req, res); } else { ITraceContext traceCtx = Trace.startTrace(); try { traceCtx.setAttribute(ATTR_REMOTE_ADDR, req.getRemoteAddr()); if (req instanceof HttpServletRequest) { HttpServletRequest hReq = (HttpServletRequest) req; traceCtx.setAttribute(ATTR_QUERY_STRING, hReq.getQueryString()); traceCtx.setAttribute(ATTR_METHOD, hReq.getMethod()); traceCtx.setAttribute(ATTR_REQUEST_URI, hReq.getRequestURI()); traceCtx.setAttribute(ATTR_REMOTE_USER, hReq.getRemoteUser()); String s = hReq.getParameter("__action"); if (s != null) { traceCtx.setAttribute(ATTR_JWIC_ACTION, s); } s = hReq.getParameter("__ctrlid"); if (s != null) { traceCtx.setAttribute(ATTR_JWIC_CONTROL, s); } } chain.doFilter(req, res); if (req instanceof HttpServletRequest) { HttpServletRequest hReq = (HttpServletRequest) req; String s = hReq.getParameter("_msid"); if (s != null) { // JWic Session ID -> See if its a XWic App and store info. SessionContext ctx = JWicRuntime.getJWicRuntime().getSessionContext(hReq.getSession().getId(), s, hReq); if (ctx != null) { if (ctx.getApplication() instanceof ExtendedApplication) { ExtendedApplication eApp = (ExtendedApplication) ctx.getApplication(); Site site = eApp.getSite(); if (site != null) { traceCtx.setAttribute(ATTR_SITE_MODULE, site.getActiveModuleKey()); traceCtx.setAttribute(ATTR_SITE_SUBMODULE, site.getActiveSubModuleKey()); BreadCrumbControl bcc = (BreadCrumbControl) site.getControl("breadCrumb"); if (bcc != null) { StringBuilder path = new StringBuilder(); for (String key : bcc.getBreadCrumbs()) { if (path.length() != 0) { path.append(" >> "); } path.append(bcc.getCrumbTitle(key)); } traceCtx.setAttribute(ATTR_USER_PATH, path.toString()); } } } } } } } finally { // log trace information? Trace.endTrace(); Trace.getDataManager().handleTraceResult(traceCtx); } } }