@Override public WidgetPageImpl<S> append(OgemaWidget widget) { if (!widget.getPage().equals(this)) throw new IllegalArgumentException("Cannot append a widget from another page"); rootWidget.append(widget, null); return this; }
public void removeWidget(OgemaWidget widget) { String widgetId = widget.getId(); WidgetPage<?> page = widget.getPage(); // String boundPagePath = ((WidgetPageBase<?>) page).getServletBase(); // System.out.println(" session mgt removing widget " + widgetId); // String id = getId(boundPagePath,widgetId); // WidgetSessionData<? extends WidgetData> opt = options.remove(id); for (Session session : sessions.asMap().values()) { if (!session.getPage().getPage().equals(page)) continue; session.removeWidget(widgetId); } }
/** * @param groupId * a unique id * @param widgets * widgets constituting the group. It is possible to add widgets to the group later on, using {@link WidgetGroup#addWidget(OgemaWidget)} * @return * the newly created WidgetGroup * @throws IllegalArgumentException * if a WidgetGroup with the given id already exists */ @Override public final WidgetGroup registerWidgetGroup(String groupId, Collection<OgemaWidget> widgets) throws IllegalArgumentException { if (widgets == null) widgets = Collections.emptySet(); Iterator<OgemaWidget> it = widgets.iterator(); while(it.hasNext()) { OgemaWidget widget = it.next(); if (!widget.getPage().equals(this)) throw new IllegalArgumentException("Cannot assign widget belonging to another page to a WidgetGroup"); ((OgemaWidgetBase<?>) widget).addGroup(groupId); } return getWidgetService().registerWidgetGroup(this, groupId, widgets, app.wam); }
protected void init() { dependentWidgets = widget.getPage().registerWidgetGroup(widget.getId() + "__dependentWidgets", new ArrayList<OgemaWidget>()); // widget.triggerAction(dependentWidgets, TriggeringAction.POST_REQUEST, TriggeredAction.GET_REQUEST); widget.triggerAction(dependentWidgets, TriggeringAction.GET_REQUEST, TriggeredAction.GET_REQUEST); // XXX why? }