@Override public void installViews(List<HasWidgets> placeholders) { setResponseFromElement(multiViewElements.get(0)); maxSelections = XMLUtils.getAttributeAsInt(multiViewElements.get(0), "maxSelections"); for (int i = 0; i < multiViewElements.size(); i++) { Element element = multiViewElements.get(i); SelectableChoicePresenter selectableChoice = createSelectableChoiceFromElement(element); addClickHandler(selectableChoice); HasWidgets currPlaceholder = placeholders.get(i); currPlaceholder.add(selectableChoice.getView()); choicesManager.addChoice(selectableChoice); } }
@Override public void installViews(List<HasWidgets> placeholders) { styles = styleSocket.getStyles(getModuleElement()); setFontSize(styles); setDimensions(styles); setMaxlengthBinding(styles, getModuleElement()); setWidthBinding(styles, getModuleElement()); installViewPanel(placeholders.get(0)); initReplacements(styles); parseInitialText(); fillGapWithInitial(); }
@Override public void installViews(List<HasWidgets> placeholders) { HasWidgets placeholder = placeholders.get(0); presenter.installViewInContainer(((HasWidgets) ((Widget) placeholder).getParent())); String uid = getElementAttributeValue(EmpiriaTagConstants.ATTR_UID); mathGapModel.setUid(uid); Map<String, String> styles = styleSocket.getStyles(getModuleElement()); mathGapModel.getMathStyles().putAll(styles); initParametersBasedOnMathStyles(); setListBoxEmptyOption(); options = createOptions(getModuleElement(), getModuleSocket()); gapContainer.addMathGap(this); }
@Override public void createSingleViewModule(Element element, HasWidgets parent, BodyGeneratorSocket bodyGeneratorSocket) { IModule module = registry.createModule(element); parenthood.addChild(module); registerModuleFeedbacks(module, element); if (module instanceof ISingleViewWithBodyModule) { parenthood.pushParent((ISingleViewWithBodyModule) module); ((ISingleViewWithBodyModule) module).initModule(element, moduleSocket, bodyGeneratorSocket, eventsBus); parenthood.popParent(); } else if (module instanceof ISingleViewSimpleModule) { ((ISingleViewSimpleModule) module).initModule(element, moduleSocket, eventsBus); } else if (module instanceof IInlineModule) { ((IInlineModule) module).initModule(element, moduleSocket, eventsBus); } if (((ISingleViewModule) module).getView() instanceof Widget) { parent.add(((ISingleViewModule) module).getView()); } singleViewModules.add(module); }
public void installMultiViewNonuniuqeModules() { for (Element currElement : nonuniqueModulesMap.getKeys()) { StackMap<IModule, HasWidgets> moduleMap = nonuniqueModulesMap.get(currElement); IModule module = moduleMap.getKeys().get(0); if (module instanceof IMultiViewModule) { IMultiViewModule multiViewModule = (IMultiViewModule) module; List<HasWidgets> placeholders = moduleMap.getValues(); multiViewModule.initModule(moduleSocket, eventsBus); multiViewModule.addElement(currElement); multiViewModule.installViews(placeholders); registerModuleFeedbacks(module, currElement); } } }
@Override public void processNode(Node node, HasWidgets parent) { if (ignoredTagNames != null && SECTION.equals(node.getNodeName()) && ignoredTagNames.contains(((com.google.gwt.xml.client.Element) node).getAttribute("name"))) { } else if (ignoredTagNames != null && SECTION.equals(node.getNodeName()) && ignoredTagNames.contains("untagged") && !detectTagNode(node)) { } else if (SECTION.equals(node.getNodeName())) { generateBody(node, parent); } else if (node.getNodeType() == Node.COMMENT_NODE) { } else if (moduleInstalatorSocket != null && moduleInstalatorSocket.isModuleSupported(node.getNodeName())) { Element element = (Element) node; if (moduleInstalatorSocket.isMultiViewModule(element)) { moduleInstalatorSocket.registerModuleView(element, parent); } else { moduleInstalatorSocket.createSingleViewModule(element, parent, this); } } }
public Application(final HasWidgets gwtFrame) { // Build the application scaffolding; Header, Footer, Accordion // and content presenter panel // Fill the entire browser window with the application injector.getApplicationPresenter().setInjector(injector); gwtFrame.add(injector.getApplicationPresenter().getView()); // Instance both the WF Listing, WF Definition, Graphviz and Simulator // presenters so that they can send/receive events between each other injector.getWorkflowsPresenter(); injector.getWfDefinitionPresenter(); injector.getGraphvizPresenter(); injector.getSimulatorPresenter(); // Start with the Workflow listings content injector.getEventBus().fireEvent(new SwitchToPresenterEvent("workflows.section")); }
protected void showContextMenuPopup(int left, int top) { if (customContextMenu instanceof HasWidgets) { if (!((HasWidgets) customContextMenu).iterator().hasNext()) { // there are no actions to show return; } } customContextMenuPopup = Tools.createCubaTableContextMenu(); customContextMenuPopup.setOwner(this); customContextMenuPopup.setWidget(customContextMenu); customContextMenuPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { customContextMenuPopup = null; } }); Tools.showPopup(customContextMenuPopup, left, top); }
@Override public void go(HasWidgets hasWidgets) { hasWidgets.add(getWordView().asWidget()); context.getPlatformBus().addHandler(OpenFileEvent.TYPE, new OpenFileEvent.OpenFileHandler(){ @Override public void onOpenFile(OpenFileEvent event) { FileModel model=event.getModel(); if(!model.isFolder()){ open(model.getId(), null); if(model.getOwner().equals(context.getUser().getUid())){ History.newItem(new PlacePath().toApp(App.Document) .toDocType(DocType.MyDoc) .toDocId(model.getId()).create().getToken(), false); }else{ History.newItem(new PlacePath().toApp(App.Document) .toDocType(DocType.SharedDoc) .toDocId(model.getId()) .create().getToken(), false); } } } }); }
@Override public Presenter getPresenter() { return new Presenter() { public void go(HasWidgets hasWidgets) { hasWidgets.add(widget); String id=GWTEnvironment.getHomeTemplateId(); RPCS.getFileManagerService().getHomeFile(id, new AbstractAsyncCallback<FileModel>() { public void onSuccess(FileModel result) { widget.setContent(result.getContent()); } @Override public void onFailure(Throwable caught) { TemplateResources templates=GWT.create(TemplateResources.class); widget.setContent(templates.home().getText()); } }); } @Override public PlatformContext getPlatformContext() { return null; } }; }
/** * Find the sibling {@link MaterialHelpBlock}. * * @param widget the {@link Widget} to search. * @return the found {@link MaterialHelpBlock} of null if not found. */ protected MaterialHelpBlock findHelpBlock(Widget widget) { if (widget != null) { if (widget instanceof MaterialHelpBlock) { return (MaterialHelpBlock) widget; } // Try and find the MaterialHelpBlock in the children of the given widget. if (widget instanceof HasWidgets) { for (Widget w : (HasWidgets) widget) { if (w instanceof MaterialHelpBlock) { return (MaterialHelpBlock) w; } } } // Try and find the MaterialHelpBlock in the parent of widget. return findHelpBlock(widget.getParent()); } return null; }
/** * Checks if this child holds the current active state. * If the child is or contains the active state it is applied. */ protected void checkActiveState(Widget child) { // Check if this widget has a valid href String href = child.getElement().getAttribute("href"); String url = Window.Location.getHref(); int pos = url.indexOf("#"); String location = pos >= 0 ? url.substring(pos, url.length()) : ""; if (!href.isEmpty() && location.startsWith(href)) { ListItem li = findListItemParent(child); if (li != null) { makeActive(li); } } else if (child instanceof HasWidgets) { // Recursive check for (Widget w : (HasWidgets) child) { checkActiveState(w); } } }
/** * Lookup all nested children in widget and tries to search children which implement Focusable * interface. * * @param widget widget to lookup * @return list of {@link com.google.gwt.user.client.ui.Focusable} widgets or empty list if none * was found * @see com.google.gwt.user.client.ui.Focusable */ public static List<FocusWidget> getFocusableChildren(Widget widget) { List<FocusWidget> focusable = new ArrayList<>(); if (widget instanceof FocusWidget) { focusable.add((FocusWidget) widget); } if (widget instanceof HasWidgets) { for (Widget w : ((HasWidgets) widget)) { focusable.addAll(getFocusableChildren(w)); } } return focusable; }
private void addKeyPressToAll(Widget inWidget) { if (keyPressHandler != null && inWidget instanceof HasWidgets) { HasWidgets container = (HasWidgets) inWidget; for (Widget w : container) { if (w instanceof InputField) { InputField f = (InputField) w; if (f.getFocusWidget() != null) { f.getFocusWidget().addKeyPressHandler(keyPressHandler); } } else if (w instanceof SimpleTargetPanel) { SimpleTargetPanel sp = (SimpleTargetPanel) w; if (sp.getInputField() != null && sp.getInputField().getFocusWidget() != null) { sp.getInputField().getFocusWidget().addKeyPressHandler(keyPressHandler); } } else { addKeyPressToAll(w); } } } }
private static void handleShowHide(Widget w, boolean doShow) { if (w == null) return; if (w instanceof VisibleListener) { if (doShow) { ((VisibleListener) w).onShow(); } else { ((VisibleListener) w).onHide(); } } if (w instanceof HasWidgets) { HasWidgets containers = (HasWidgets) w; for (Iterator<Widget> itr = containers.iterator(); itr.hasNext(); ) { handleShowHide(itr.next(), doShow); } } }
private void addKeyPressToAll(Widget inWidget) { if (inWidget instanceof HasWidgets) { HasWidgets container= (HasWidgets)inWidget; for (Widget w : container) { if (w instanceof InputField) { InputField f= (InputField)w; if (f.getFocusWidget()!=null) { f.getFocusWidget().addKeyPressHandler(keyPressHandler); } } else if (w instanceof SimpleTargetPanel) { SimpleTargetPanel sp= (SimpleTargetPanel)w; if (sp.getInputField()!=null && sp.getInputField().getFocusWidget()!=null) { sp.getInputField().getFocusWidget().addKeyPressHandler(keyPressHandler); } } else { addKeyPressToAll(w); } } } }
protected boolean setFocus(final HasWidgets container, Boolean found) { for (final Widget w : container) { if (w instanceof CloseButton) { continue; } else if (w instanceof Focusable) { ((Focusable) w).setFocus(true); found = true; } else if (w instanceof HasWidgets) { found = setFocus(((HasWidgets) w), found); } if (Boolean.TRUE.equals(found)) { break; } } return found; }
/** * Creates a breadcrumb associated with a perspective * a Place Request and a target panel. * @param associatedPerspective perspective associated with the breadcrumb * @param breadCrumbLabel label of the breadcrumb * @param associatedPlaceRequest place request associated with the breadcrumb * @param addTo target content panel of the place request * @param command command to be executed after the associated place request is accessed */ public void addBreadCrumb(final String associatedPerspective, final String breadCrumbLabel, final PlaceRequest associatedPlaceRequest, final HasWidgets addTo, final Command command) { List<BreadcrumbsPresenter> breadcrumbs = getBreadcrumbs(associatedPerspective); deactivateLastBreadcrumb(breadcrumbs); breadcrumbs.add(createBreadCrumb(associatedPerspective, breadCrumbLabel, associatedPlaceRequest, addTo, command)); breadcrumbsPerPerspective.put(associatedPerspective, breadcrumbs); if (currentPerspective == associatedPerspective) { updateView(); } }
private BreadcrumbsPresenter createBreadCrumb(final String perspective, final String label, final PlaceRequest placeRequest, final HasWidgets addTo, final Command command) { BreadcrumbsPresenter breadCrumb = breadcrumbsPresenters.get(); breadCrumb.setup(label, placeRequest, generateBreadCrumbSelectCommand(perspective, breadCrumb, placeRequest, addTo, command)); breadCrumb.activate(); return breadCrumb; }
Command generateBreadCrumbSelectCommand(final String perspective, final BreadcrumbsPresenter breadCrumb, final PlaceRequest placeRequest, final HasWidgets addTo, final Command command) { return () -> { removeDeepLevelBreadcrumbs(perspective, breadCrumb); breadCrumb.activate(); if (placeRequest != null) { goToBreadCrumb(placeRequest, addTo); } updateView(); if (command != null) { command.execute(); } }; }
@Test public void generateBreadCrumbSelectCommandTest() { DefaultPlaceRequest placeRequest = new DefaultPlaceRequest("screen"); final Command command = mock(Command.class); uberfireBreadcrumbs.addBreadCrumb("myperspective", "label", placeRequest); List<BreadcrumbsPresenter> breadcrumbs = uberfireBreadcrumbs.breadcrumbsPerPerspective.get("myperspective"); BreadcrumbsPresenter breadcrumb = breadcrumbs.get(0); uberfireBreadcrumbs.generateBreadCrumbSelectCommand("myperspective", breadcrumb, placeRequest, null, command).execute(); verify(placeManager).goTo(placeRequest); verify(placeManager, never()).goTo(eq(placeRequest), any(HasWidgets.class)); verify(command).execute(); }
@Test public void generateBreadCrumbSelectCommandWithTargetPanelTest() { DefaultPlaceRequest placeRequest = new DefaultPlaceRequest("screen"); final Command command = mock(Command.class); uberfireBreadcrumbs.addBreadCrumb("myperspective", "label", placeRequest); List<BreadcrumbsPresenter> breadcrumbs = uberfireBreadcrumbs.breadcrumbsPerPerspective.get("myperspective"); BreadcrumbsPresenter breadcrumb = breadcrumbs.get(0); uberfireBreadcrumbs.generateBreadCrumbSelectCommand("myperspective", breadcrumb, placeRequest, mock(HasWidgets.class), command).execute(); verify(placeManager).goTo(eq(placeRequest), any(HasWidgets.class)); verify(placeManager, never()).goTo(placeRequest); verify(command).execute(); }
private void removeWorkbenchPanelFromParent(final PanelDefinition toRemove, final WorkbenchPanelPresenter presenterToRemove) { HasWidgets customContainer = customPanels.remove(toRemove); if (customContainer != null) { customContainer.remove(presenterToRemove.getPanelView().asWidget()); } else { HTMLElement customHTMLElementContainer = customPanelsInsideHTMLElements.remove(toRemove); if (customHTMLElementContainer != null) { DOMUtil.removeFromParent(presenterToRemove.getPanelView().asWidget()); } else { final PanelDefinition parentDef = toRemove.getParent(); final WorkbenchPanelPresenter parentPresenter = mapPanelDefinitionToPresenter.get(parentDef); if (parentPresenter == null) { throw new IllegalArgumentException("The given panel's parent could not be found"); } parentPresenter.removePanel(presenterToRemove); } } }
private CustomPanelDefinition addCustomPanelOnContainer(final Object container, CustomPanelDefinitionImpl panelDef) { final WorkbenchPanelPresenter panelPresenter = beanFactory.newWorkbenchPanel(panelDef); Widget panelViewWidget = panelPresenter.getPanelView().asWidget(); panelViewWidget.addAttachHandler(new CustomPanelCleanupHandler(panelPresenter)); if (container instanceof HasWidgets) { HasWidgets widgetContainer = (HasWidgets) container; widgetContainer.add(panelViewWidget); customPanels.put(panelDef, widgetContainer); } else { HTMLElement htmlContainer = (HTMLElement) container; appendWidgetToElement(htmlContainer, panelViewWidget); customPanelsInsideHTMLElements.put(panelDef, htmlContainer); } mapPanelDefinitionToPresenter.put(panelDef, panelPresenter); onPanelFocus(panelDef); return panelDef; }
private static void getContainedHierarchyRecursively(final Widget startAt, int depth, IndentedLineAccumulator result) { if (startAt == null) { result.append(depth, "(null)"); return; } result.append(depth, widgetInfo(startAt)); if (startAt instanceof HasWidgets) { for (Widget child : ((HasWidgets) startAt)) { getContainedHierarchyRecursively(child, depth + 1, result); } } else if (startAt instanceof Composite) { getContainedHierarchyRecursively(extractWidget(((Composite) startAt)), depth + 1, result); } }
@Test public void testLaunchExistingActivityInCustomPanel() throws Exception { HasWidgets customContainer = mock(HasWidgets.class); when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true); placeManager.goTo(kansas, customContainer); verify(panelManager, never()) .addCustomPanel(customContainer, StaticWorkbenchPanelPresenter.class.getName()); verifyNoActivityLaunchSideEffects(kansas, kansasActivity); verify(selectWorkbenchPartEvent).fire(refEq(new SelectPlaceEvent(kansas))); }
@Test public void testClosingActivityInCustomPanel() throws Exception { HasWidgets any = any(HasWidgets.class); CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl( UnanchoredStaticWorkbenchPanelPresenter.class.getName(), any); when(panelManager.addCustomPanel(any, eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName()))) .thenReturn(customPanelDef); PlaceRequest emeraldCityPlace = new DefaultPlaceRequest("emerald_city"); createWorkbenchScreenActivity(emeraldCityPlace); HasWidgets customContainer = mock(HasWidgets.class); placeManager.goTo(emeraldCityPlace, customContainer); placeManager.closePlace(emeraldCityPlace); assertTrue(customPanelDef.getParts().isEmpty()); verify(panelManager).removeWorkbenchPanel(customPanelDef); }
@Test public void testClosingAllPlacesIncludesCustomPanels() throws Exception { HasWidgets any = any(HasWidgets.class); CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl( UnanchoredStaticWorkbenchPanelPresenter.class.getName(), any); when(panelManager.addCustomPanel(any, eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName()))) .thenReturn(customPanelDef); PlaceRequest emeraldCityPlace = new DefaultPlaceRequest("emerald_city"); createWorkbenchScreenActivity(emeraldCityPlace); HasWidgets customContainer = mock(HasWidgets.class); placeManager.goTo(emeraldCityPlace, customContainer); placeManager.closeAllPlaces(); assertTrue(customPanelDef.getParts().isEmpty()); verify(panelManager).removeWorkbenchPanel(customPanelDef); }
public static void addWidgetTo(Widget aWidet, HasWidgets aContainer) { if (aContainer != null) { aWidet.setVisible(true); aContainer.clear(); if (aContainer instanceof BorderPane) { ((BorderPane) aContainer).add(aWidet); } else if (aContainer instanceof MarginsPane) { MarginConstraints mc = new MarginConstraints(); mc.setTop(new Margin(0, Style.Unit.PX)); mc.setBottom(new Margin(0, Style.Unit.PX)); mc.setLeft(new Margin(0, Style.Unit.PX)); mc.setRight(new Margin(0, Style.Unit.PX)); ((MarginsPane) aContainer).add(aWidet, mc); } else if (aContainer instanceof SplitPane) { ((SplitPane) aContainer).setFirstWidget(aWidet); } else if (aContainer instanceof RootPanel) { aContainer.add(aWidet); } else { aContainer.add(aWidet); } } }
protected void performCommonTasks(PanelGVO component, UIObject panel, String uuid, String parent) { if (component != null && panel != null) { panel.setTitle(component.getTooltip()); UIObject[] children = renderChildComponents(component.getLayout().getComponents(), uuid, parent, component.getContext()); if (children != null) { for (int i = 0; i < children.length; i++) { if (children[i] != null) { if (children[i] instanceof Widget) { if (panel instanceof DockPanel) { ((DockPanel) panel).add((Widget) children[i], DockPanel.NORTH); } else if (panel instanceof HasWidgets) { ((HasWidgets) panel).add((Widget) children[i]); } RendererHelper.setStyleForElement(children[i].getElement(), component.getLayout().getComponents()[i].getStyleProperties()); } } } } } }
@Override public void onRowSelection(final RowSelectionEvent event) { if (hasOverflow()) { final Set<Row> selected = event.getSelectedRows(); for (final Row row : selected) { final DataContainerGVO dm = getRowValue(row.getRowIndex()); final SetValueGVO setValue = new SetValueGVO(); setValue.setDataContainer(dm); if (overflow instanceof HasWidgets){ SetValueExecute.processWidgets((HasWidgets)overflow,setValue); } } } handleRowSelection(event); }
private void processSetProperty(String appId, String windowId, String eventSessionId, SetPropertyGVO setProperty, BuiltInComponentGVO builtInComponentGVO, List<UIObject> uiObjects) { for (int i=0; i< uiObjects.size(); i++) { UIObject uiObject = uiObjects.get(i); if (uiObject != null) { processProperty(uiObject, appId, windowId, eventSessionId, builtInComponentGVO, setProperty); if ((uiObject instanceof HasWidgets) && (appliesToChild(uiObject, setProperty))) { HasWidgets hasWidgets = (HasWidgets) uiObject; processWidgets(hasWidgets, appId, windowId, eventSessionId, builtInComponentGVO, setProperty); } // Choice items are also stored with the same id or name of the parent choice in repository to make it accessble for getting values. // So When setting a property of a choice we need to skip the items comes just after the Choice. // For eg: When we set the visibility of Choice we have to do it for only Choice to for the items. if ((uiObject instanceof HasChoice) && (uiObject instanceof IndexedPanel)) { int choiceItemCount = ((IndexedPanel)uiObject).getWidgetCount(); i += choiceItemCount; } } } }
private void handleEnabled(UIObject uiObject, String propertyValue, String propertyType) { boolean value = Boolean.valueOf(propertyValue).booleanValue(); if (QAMLConstants.PROPERTY_DISABLED.equals(propertyType)) { value = !value; } if (uiObject instanceof HasEnabled) { HasEnabled hasEnabled = (HasEnabled)uiObject; hasEnabled.setEnabled(value); } else if (uiObject instanceof HasWidgets) { SetMaskHelper.setMaskEnable(uiObject.getElement().getAttribute(QAMLConstants.PROPERTY_ID), value, true); DOM.setElementPropertyBoolean(uiObject.getElement(), QAMLConstants.PROPERTY_DISABLED, !value); } else if (uiObject instanceof QSuggestBox) { QSuggestBox suggestField = (QSuggestBox)uiObject; suggestField.getTextBox().setEnabled(value); } else if (uiObject instanceof SpreadsheetCell) { SpreadsheetCell cell = (SpreadsheetCell) uiObject; cell.setEditable(value); } }
private static String getValue(FormPanel formPanel) { String value = null; if (formPanel instanceof HasWidgets) { HasWidgets hasWidgets = formPanel; Iterator<Widget> itr = hasWidgets.iterator(); while (itr.hasNext()) { Widget widget = itr.next(); if (widget instanceof Grid) { Grid gridPanel = (Grid) widget; FileUpload fileUpload = (FileUpload) gridPanel.getWidget(0, 0); value = DOM.getElementAttribute(fileUpload.getElement(), "fu-uuid"); handleSimpleValue(formPanel, value); } } } return value; }
private static DataContainerGVO getValue(Tiles tiles, final UIObject sender) { DataContainerGVO dtc = new DataContainerGVO(); dtc.setKind(DataContainerGVO.KIND_MAP); DataMap dataMap = new DataMap(); dtc.setDataMap(dataMap); String originalSenderId = RendererHelper.getComponentId(sender); if (originalSenderId != null) { String index = originalSenderId.substring(0, originalSenderId .lastIndexOf(QAMLConstants.TOKEN_INDEXING)); index = index.replace(QAMLConstants.TOKEN_INDEXING, ""); Integer i = Integer.parseInt(index); UIObject tileElement = tiles.getTileElements().get(i); if (tileElement instanceof HasWidgets) { HasWidgets hasWidgets = (HasWidgets) tileElement; processWidgets(hasWidgets, dataMap, sender); } } return dtc; }
private static void fillDataContainerMapForGroup(DataMap dataMap, String groupName, UIObject uiObject, final UIObject sender) throws RequiredFieldException { if (uiObject instanceof Widget) { Widget widget = (Widget) uiObject; if (widget instanceof HasWidgets && !(widget instanceof ValueSpinner) && !(widget instanceof FormPanel) && !(widget instanceof HasDataGridMethods)) { HasWidgets innerHasWidget = (HasWidgets) widget; processWidgets(innerHasWidget, dataMap, sender); } else { processNamedComponent(widget, dataMap, sender, groupName); } } }
private static void processWidgets(HasWidgets hasWidgets, DataMap dataMap, final UIObject sender) throws RequiredFieldException { for (Widget widget : hasWidgets) { processNamedComponent(widget, dataMap, sender, null); if (widget instanceof HasWidgets && !(widget instanceof ValueSpinner) && !(widget instanceof FormPanel) && !(widget instanceof HasDataGridMethods)) { // not clear what is this code was meant for. /* * DataContainerGVO dtc = new DataContainerGVO(); dtc.setKind(DataContainerGVO.KIND_MAP); * DataMap innerMap = new DataMap(); dtc.setDataMap(innerMap); * * if (RendererHelper.isNamedComponent(widget)) { String name = * RendererHelper.getNamedComponentName(widget); dtc.setParameterName(name); dataMap.put(name, * dtc); } */ HasWidgets innerHasWidget = (HasWidgets) widget; processWidgets(innerHasWidget, dataMap, sender); } } }
private UIObject getComponentByName(UIObject uiObject, String name) { if (RendererHelper.isNamedComponent(uiObject)) { String componentName = RendererHelper.getNamedComponentName(uiObject); if (componentName.equals(name)) { return uiObject; } } if (uiObject instanceof HasWidgets) { HasWidgets hasWidgets = (HasWidgets)uiObject; for (Widget widget : hasWidgets) { UIObject component = getComponentByName(widget, name); if (component != null) { return component; } } } return null; }
private void initCell(QTileList widget, UIObject cellWidget, Object cellValue, String owner, String parent, String context, AbstractActivity activity) { if (cellWidget == null) { return; } // Register events for components within the tile String viewKey = activity.getClientFactory().generateViewKey(parent, context); Map<UIObject,ComponentGVO> cellComponents = activity.getClientFactory().getComponents(viewKey, owner); registerCellEvents(cellComponents, widget, parent, context, activity); // Set value to the tile if (cellWidget instanceof HasWidgets) { ActivityHelper.setValue((HasWidgets)cellWidget, cellValue, null, null, null, cellComponents); } else if (cellWidget instanceof HasData) { ActivityHelper.setValue((HasData)cellWidget, cellValue, null, null, null); } }
protected UIObject renderLayout(PanelGVO panelGVO, AbsoluteLayoutGVO layoutGVO, String owner, String uuid, String parent, String context, AbstractActivity activity) { HasWidgets panel = createPanel(); ElementGVO[] elements = layoutGVO.getElements(); if ((elements != null) && (elements.length > 0)) { ScrollPanel scrollPanel = createScrollPanel(); panel.add(scrollPanel); QLayoutAbsolute layout = new QLayoutAbsolute(); for (ElementGVO elementGVO : elements) { UIObject child = renderChildComponent(elementGVO.getComponent(), owner, uuid, parent, context, activity); if (child instanceof Widget) { int posX = elementGVO.getX(); int posY = elementGVO.getY(); layout.add((Widget)child, posX, posY); } } scrollPanel.setWidget(layout); scrollPanel.refresh(); } return (UIObject)panel; }