/** * Create an invocation request queue for the specified target. * * @param name Unique name for this queue. * @param target Target of invocation requests sent to the queue. * @param onClose Invocation request to send to the target upon queue closure (may be null). */ public InvocationRequestQueue(String name, BaseComponent target, InvocationRequest onClose) { this(name, target.getPage(), target, onClose); }
/** * Creates a thread for executing a background operation. * * @param target Target operation. * @param requester The component requesting the operation. * @param eventName Name of the event used to notify requester of completion. When fired, the * data associated with the event will be a reference to this instance and may be * interrogated to determine the outcome of the operation. */ public ThreadEx(IRunnable target, BaseComponent requester, String eventName) { this.target = target; this.event = new Event(eventName, requester, this); this.page = requester.getPage(); this.thread = new ThreadInternal(); }
/** * Create an event of the specified type, target, related target, and data. * * @param type The event type. * @param target The target of the event. * @param relatedTarget The related target that participated in the event. * @param data Arbitrary data to associate with the event. */ public Event(String type, BaseComponent target, BaseComponent relatedTarget, Object data) { this.type = type; this.target = target; this.targetId = target == null ? null : target.getId(); this.data = data; this.currentTarget = target; this.relatedTarget = relatedTarget; this.page = target != null ? target.getPage() : null; this.page = this.page == null ? ExecutionContext.getPage() : this.page; }
private void synchronizer(boolean pause) { Page page = parent == null ? null : parent.getPage(); Synchronizer synchronizer = page == null ? null : page.getSynchronizer(); if (synchronizer != null) { if (pause) { synchronizer.startQueueing(); } else { synchronizer.stopQueueing(); } } }
BaseComponent target = name.startsWith(Page.ID_PREFIX) ? container.getPage().findById(name) : container.findByName(name);
@Override public void afterInitialized(BaseComponent comp) { window = (Window) comp; window.setCloseAction(CloseAction.HIDE); comp.setAttribute("controller", this); bringToFront = comp.getPage().getAttribute(ATTR_BRING_TO_FRONT, true); layoutChangedEvent = new LayoutChangedEvent(comp, null); contextMenu.setListener(comp); clipboard.addListener(comp); comp.getPage().addEventListener("register unregister", layoutListener); }
/** * Prior to performing the transform, ensure that the referenced component is attached to * the active page. */ @Override public Object transformForClient() { if (component == null) { return null; } if (!component.isDead() && component.getPage() == null) { Page page = BaseComponent.this.page; component._attach(page != null ? page : ExecutionContext.getPage()); } return IElementIdentifier.super.transformForClient(); }
/** * Synchronize a state value to the client. * * @param state The state name. * @param value The state value. */ protected void sync(String state, Object value) { if (!dead) { if (getPage() == null) { if (inits == null) { inits = new OptionMap(); } inits.put(state, value); } else { page.getSynchronizer().invokeClient(this, "updateState", state, value, true); } } }
/** * Create popup window with specified parent and title and with default attributes. Defaults are * used: reference loadDefaults() * * @param owner Component that requested creation (may be null) * @param title Window title */ public PopupDialog(BaseComponent owner, String title) { super(); loadDefaults(); setTitle(title); if (owner != null) { setParent(owner.getPage()); } else { setParent(ExecutionContext.getPage()); } }
/** * Fires an event to the specified listener, deferring delivery if the page of the target is not * currently active. * * @param event The event to fire. * @param listener The listener to receive the event. */ public static void fireEvent(Event event, IEventListener listener) { Page page = event.getTarget() == null ? null : event.getTarget().getPage(); if (page != null && page != ExecutionContext.getPage()) { page.getEventQueue().queue(event); } else { try { listener.onEvent(event); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } } }
@Override public void afterInitialized(BaseComponent root) { super.afterInitialized(root); page = root.getPage(); session = page.getSession(); noAutoLock = page.getAttribute(ATTR_NO_AUTO_LOCK, false); timeoutWindow = (BaseUIComponent) root; getEventManager().subscribe(SessionControl.EVENT_ROOT, applicationControlListener); IUser user = securityService.getAuthenticatedUser(); lblLocked.setLabel(user == null ? null : Mode.BASELINE.getLabel(TIMEOUT_EXPIRATION, user.getFullName() + "@" + user.getSecurityDomain().getName())); setMode(Mode.BASELINE); session.addSessionListener(sessionListener); }
boolean noSync = child.getPage() == null && index < 0; child.validate(); BaseComponent oldParent = child.getParent();