List of usage examples for com.google.gwt.user.client.ui Widget getParent
public Widget getParent()
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.VGrabFilter.java
License:Apache License
protected boolean canBeGrabbedRecursive(Widget root, Widget widget) { if (widget == root) { return true; }/*from w w w . j a v a 2 s. c o m*/ ComponentConnector connector; if (!isCaptionForAccordion(widget)) { connector = Util.findConnectorFor(widget); } else { connector = findConnectorForAccordionCaption(widget); } if (connector != null && state.nonGrabbable.contains(connector)) { return false; } Widget parent = widget.getParent(); if (parent == null || parent == root) { return true; } return canBeGrabbedRecursive(root, parent); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.VGrabFilter.java
License:Apache License
protected ComponentConnector findConnectorForAccordionCaption(Widget widget) { VAccordion.StackItem parent = (VAccordion.StackItem) widget.getParent(); return Util.findConnectorFor(parent.getChildWidget()); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.VGrabFilter.java
License:Apache License
protected boolean isCaptionForAccordion(Widget widget) { if (widget == null) { return false; }//from ww w .j a v a2s .co m if (!(widget instanceof VCaption)) { return false; } Widget parent = widget.getParent(); return parent instanceof VAccordion.StackItem; }
From source file:com.moesol.gwt.maps.client.DivPanel.java
License:Open Source License
private void placeIcon(Widget widget, int dx, int dy, int z) { Panel lp = getNonDimTileLayerPanel(); if (widget.getParent() == null || widget.getParent() != lp) { lp.add(widget);// w ww. ja va 2 s.c om } DivWorker.BoxBounds b = m_divWorker.computePercentBounds(dx, dy, 1, 1); widget.getElement().getStyle().setPosition(Position.ABSOLUTE); widget.getElement().getStyle().setLeft(b.left, Unit.PCT); widget.getElement().getStyle().setTop(b.top, Unit.PCT); widget.getElement().getStyle().setZIndex(z); }
From source file:com.novartis.pcs.ontology.webapp.client.view.ApproveRejectComposite.java
License:Apache License
protected void addWidgets() { VerticalPanel vertPanel = new VerticalPanel(); HorizontalPanel filterPanel = new HorizontalPanel(); Label filterLabel = new Label("Keyword Filter:"); Button closeButton = new Button("Close"); SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true) { @Override//w ww .j a v a 2 s.com public void setPageStart(int index) { HasRows display = getDisplay(); if (display != null) { Range range = display.getVisibleRange(); int pageSize = range.getLength(); if (isRangeLimited() && display.isRowCountExact()) { index = Math.min(index, display.getRowCount() - 1); } index = Math.max(0, index); if (index != range.getStart()) { display.setVisibleRange(index, pageSize); } } } }; closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Widget parent = ApproveRejectComposite.this.getParent(); while (parent != null) { if (parent instanceof PopupPanel) { PopupPanel popup = (PopupPanel) parent; popup.hide(); break; } parent = parent.getParent(); } } }); filterLabel.addStyleName("dialog-label"); filterPanel.addStyleName("dialog-hpanel"); filterPanel.addStyleName("spaced-vert"); filterPanel.add(filterLabel); filterPanel.add(filterTextBox); filterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); pager.setDisplay(table); pager.addStyleName("centered-hortz"); /* if(curator != null && curator.isAuthorised(entity)) { Label tip = new Label("Use Shift key to select/unselect consecutive rows"); tip.addStyleName("dialog-message"); tip.addStyleName("info-icon-left"); vertPanel.add(tip); } else { Label label = new Label("Insufficient privileges to approve/reject items"); label.addStyleName("dialog-message"); label.addStyleName("info-icon-left"); vertPanel.add(label); } */ if (curator != null) { vertPanel.add(errorLabel); } vertPanel.add(filterPanel); vertPanel.add(table); vertPanel.add(pager); if (curator != null && curator.isAuthorised(entity)) { Label comments = new Label("Comments:"); HorizontalPanel buttonsHPanel = new HorizontalPanel(); buttonsHPanel.add(approveButton); buttonsHPanel.add(rejectButton); buttonsHPanel.add(closeButton); comments.addStyleName("dialog-label"); buttonsHPanel.addStyleName("dialog-buttons"); buttonsHPanel.addStyleName("centered-hortz"); vertPanel.add(comments); vertPanel.add(commentsField); commentsField.getElement().getParentElement().addClassName("text-area-right-padded"); vertPanel.add(buttonsHPanel); } else { vertPanel.add(closeButton); vertPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); } initWidget(vertPanel); }
From source file:com.qualogy.qafe.gwt.client.component.MenuItemComponent.java
License:Apache License
public MenuItemComponent(final String menuItemName, final String uuid, final String windowId) { setSpacing(2);//from w ww. j a va2s .com Hyperlink hyperlink = new Hyperlink(menuItemName, "history"); hyperlink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (event.getSource() instanceof Widget) { Widget sender = (Widget) event.getSource(); ClientApplicationContext.getInstance().removeWindow(windowId, null, uuid); MainFactoryActions.getUIByUUID(uuid, windowId); // try to close the disclosurePanel Widget parent = sender.getParent(); boolean found = false; while (parent != null && !found) { if (parent instanceof DisclosurePanel) { DisclosurePanel disclosurePanel = (DisclosurePanel) (parent); disclosurePanel.setOpen(false); found = true; } else { parent = parent.getParent(); } } if (sender.getParent() != null && sender.getParent().getParent() != null) { if (sender.getParent().getParent() instanceof DisclosurePanel) { DisclosurePanel disclosurePanel = (DisclosurePanel) (sender.getParent().getParent()); disclosurePanel.setOpen(false); } } } } }); add(hyperlink); setStyleName(DEFAULT_STYLE); }
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.ClearExecute.java
License:Apache License
private static void processClearForInputComponents(UIObject uiObject, BuiltInFunctionGVO builtInFunction) { if (uiObject instanceof TextBoxBase) { TextBoxBase textBoxBase = (TextBoxBase) uiObject; textBoxBase.setText(""); }/*from w w w . j a v a 2s. c om*/ if (uiObject instanceof QDatePicker) { QDatePicker qDatePicker = (QDatePicker) uiObject; qDatePicker.getTextBox().setText(""); } if (uiObject instanceof HasDataGridMethods) { ((HasDataGridMethods) uiObject).insertData(null, false, builtInFunction.getSenderId(), builtInFunction.getListenerType()); ((HasDataGridMethods) uiObject).redraw(); } if (uiObject instanceof ListBox) { ListBox listBox = (ListBox) uiObject; boolean hasEmptyItem = DropDownRenderer.hasEmptyItem(listBox); int indexOfValue = hasEmptyItem ? 0 : -1; listBox.setSelectedIndex(indexOfValue); if (builtInFunction instanceof ClearGVO) { int offset = hasEmptyItem ? 1 : 0; while (listBox.getItemCount() > offset) { listBox.removeItem(listBox.getItemCount() - 1); } } } if (uiObject instanceof CheckBox) { CheckBox checkbox = (CheckBox) uiObject; checkbox.setValue(false); if (uiObject instanceof QRadioButton) { ((QRadioButton) uiObject).reset(); } } if (uiObject instanceof FileUpload) { FileUpload fileUpload = (FileUpload) uiObject; Widget fup = fileUpload.getParent(); // fup will be the layout component if (fup != null) { Widget fupp = fup.getParent(); if (fupp instanceof FormPanel) { ((FormPanel) fupp).reset(); } } } if (uiObject instanceof QSuggestBox) { QSuggestBox suggestTextField = (QSuggestBox) uiObject; suggestTextField.getTextBox().setText(""); } }
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.FocusExecute.java
License:Apache License
private void makeParentsVisible(Widget w) { if (w.getParent() != null) { Widget parent = w.getParent();//from w ww . j a v a 2 s . c o m makeParentsVisible(parent); if (parent instanceof DeckPanel) { DeckPanel dp = (DeckPanel) parent; dp.showWidget(dp.getWidgetIndex(w)); ((TabPanel) dp.getParent().getParent()).selectTab(dp.getWidgetIndex(w)); } } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.ClearHandler.java
License:Apache License
private void processClearForInputComponents(UIObject uiObject, BuiltInFunctionGVO builtInFunction) { if (uiObject instanceof TextBoxBase) { TextBoxBase textBoxBase = (TextBoxBase) uiObject; textBoxBase.setText(""); }//from w ww. j a v a2s . co m if (uiObject instanceof QDatePicker) { QDatePicker qDatePicker = (QDatePicker) uiObject; qDatePicker.getTextBox().setText(""); } if (uiObject instanceof HasDataGridMethods) { ((HasDataGridMethods) uiObject).insertData(null, false, builtInFunction.getSenderId(), builtInFunction.getListenerType()); ((HasDataGridMethods) uiObject).redraw(); } if (uiObject instanceof ListBox) { ListBox listBox = (ListBox) uiObject; boolean hasEmptyItem = DropDownRenderer.hasEmptyItem(listBox); int indexOfValue = hasEmptyItem ? 0 : -1; listBox.setSelectedIndex(indexOfValue); if (builtInFunction instanceof ClearGVO) { int offset = hasEmptyItem ? 1 : 0; while (listBox.getItemCount() > offset) { listBox.removeItem(listBox.getItemCount() - 1); } } } if (uiObject instanceof CheckBox) { CheckBox checkbox = (CheckBox) uiObject; checkbox.setValue(false); if (uiObject instanceof QRadioButton) { ((QRadioButton) uiObject).reset(); } } if (uiObject instanceof FileUpload) { FileUpload fileUpload = (FileUpload) uiObject; Widget fup = fileUpload.getParent(); // fup will be the layout component if (fup != null) { Widget fupp = fup.getParent(); if (fupp instanceof FormPanel) { ((FormPanel) fupp).reset(); } } } if (uiObject instanceof QSuggestBox) { QSuggestBox suggestTextField = (QSuggestBox) uiObject; suggestTextField.getTextBox().setText(""); } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.FocusHandler.java
License:Apache License
private void makeParentVisible(Widget widget) { if (widget == null) { return;/*from w ww. j a va2s . co m*/ } Widget parent = widget.getParent(); if (parent == null) { return; } makeParentVisible(parent); if (parent instanceof DeckPanel) { DeckPanel deckPanel = (DeckPanel) parent; int widgetIndex = deckPanel.getWidgetIndex(widget); deckPanel.showWidget(widgetIndex); TabPanel tabPanel = (TabPanel) deckPanel.getParent().getParent(); tabPanel.selectTab(widgetIndex); } }