/** * @return - true if event was initiated by passed collapsible (useful in case of nested collapsibles, * because event is bubbling up to parent collapsibles). */ public boolean isInitiatedBy(JQMCollapsible collapsible) { if (collapsible == null) return false; return collapsible.getElement().equals(initiatedBy); }
private TabLink findTabLink(Element e) { for (TabLink tabLink : tabLinkList) if (tabLink.getAnchor().getElement().equals(e)) return tabLink; return null; }
/** * Remove a single row and all its widgets from the table * * @param rowIndex which row to add to (0 based, excluding thead) */ public void deleteRow(int rowIndex){ Element rowElem=rowElements.get(rowIndex); NodeList<Node> tds= rowElem.getChildNodes(); for(int i=0;i<tds.getLength();i++){ Element td=tds.getItem(i).cast(); for(Widget widget:wrapperMap.keySet()){ if(wrapperMap.get(widget).equals(td)){ remove(widget); break; } } } this.tbody.removeChild(rowElem); rowElements.remove(rowIndex); }
protected T getModelByRowElement(Element rowElement) { for(RowComponent<T> row : rows) { if(row.isRendered() && row.getWidget().getElement().equals(rowElement)) { return row.getData(); } } return null; }
protected int getRowIndexByElement(Element rowElement) { for(RowComponent<T> row : rows) { if(row.isRendered() && row.getWidget().getElement().equals(rowElement)) { return row.getIndex(); } } return -1; }
protected int getRowIndexByElement(Element rowElement) { for(RowComponent<T> row : rows) { if(row.isRendered() && row.getWidget().getElement().equals(rowElement)) { return row.getIndex(); } } return -1; }
protected T getModelByRowElement(Element rowElement) { for(RowComponent<T> row : rows) { if(row.isRendered() && row.getWidget().getElement().equals(rowElement)) { return row.getData(); } } return null; }
@PatchMethod static int findDividerIndex(StackPanel panel, Element child) { WidgetCollection children = GwtReflectionUtils.getPrivateFieldValue(panel, "children"); for (int i = 0; i < children.size(); i++) { if (children.get(i).getElement().equals(child)) { return i; } } return -1; }
@PatchMethod static int findDividerIndex(StackPanel panel, Element child) { WidgetCollection children = GwtReflectionUtils.getPrivateFieldValue(panel, "children"); for (int i = 0; i < children.size(); i++) { if (children.get(i).getElement().equals(child)) { return i; } } return -1; }
/** * Searches for the td element strting from the clicked element to upper levels of the DOM tree. * * @param clickElement is an element that is clicked. * @return a found element or <code>null</code> if the clicked element is not the td tag and not nested * into any td. */ protected Element getCellElement(Element clickElement) { while (clickElement != null && !"td".equalsIgnoreCase(clickElement.getTagName())) clickElement = DOM.getParent(clickElement); if (clickElement == null) return null; Element tr = DOM.getParent(clickElement); Element tbody = DOM.getParent(tr); Element table = DOM.getParent(tbody); if (getElement().equals(table)) return clickElement; else return getCellElement(table); }
public void showContextMenuPopup(int left, int top) { if (this.customContextMenu instanceof HasWidgets) { if (!((HasWidgets) this.customContextMenu).iterator().hasNext()) { // there are no actions to show return; } } // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.customContextMenuPopup = Tools.createCubaTableContextMenu(); this.customContextMenuPopup.setOwner(table); this.customContextMenuPopup.setWidget(this.customContextMenu); this.customContextMenuPopup.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || customContextMenuPopup.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } customContextMenuPopup = null; }); Tools.showPopup(this.customContextMenuPopup, left, top); }
public void showCustomPopup() { if (this.customPopupWidget != null) { if (this.customPopupWidget instanceof HasWidgets) { if (!((HasWidgets) this.customPopupWidget).iterator().hasNext()) { // there are no component to show return; } } // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.customPopupOverlay = Tools.createCubaTablePopup(this.customPopupAutoClose); this.customPopupOverlay.setOwner(table); this.customPopupOverlay.setWidget(this.customPopupWidget); this.customPopupOverlay.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || customPopupOverlay.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } customPopupOverlay = null; }); Tools.showPopup(this.customPopupOverlay, this.lastClickClientX, this.lastClickClientY); } }
@Override public void dragStart() { if (!GWT.isScript()) { if (DOMUtil.getClientHeight(boundaryPanel.getElement()) == 0) { if (boundaryPanel.getElement().equals(RootPanel.getBodyElement())) { DOMUtil.reportFatalAndThrowRuntimeException("boundary panel (= the BODY element) has zero height;" + " dragging cannot occur inside an AbsolutePanel that has a height of zero pixels;" + " you can often remedy this quite easily by adding the following line of" + " CSS to your application's stylesheet:" + " BODY, HTML { height: 100%; }"); } } } resetCache(); if (dragHandlers != null) { dragHandlers.fireDragStart(dragStartEvent); dragStartEvent = null; } context.draggable.addStyleName(DragClientBundle.INSTANCE.css().dragging()); assert dragStartEvent == null; }
public void showPresentationEditorPopup(Event event, Widget presentationsEditIcon) { if (event.getEventTarget().cast() == presentationsEditIcon.getElement() && tableWidget.isEnabled()) { this.presentationsEditorPopup = new VOverlay(); this.presentationsEditorPopup.setStyleName("c-table-prefs-editor"); this.presentationsEditorPopup.setOwner(table); this.presentationsEditorPopup.setWidget(this.presentationsMenu); // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.presentationsEditorPopup.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || presentationsEditorPopup.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } presentationsEditorPopup = null; }); this.presentationsEditorPopup.setAutoHideEnabled(true); this.presentationsEditorPopup.showRelativeTo(presentationsEditIcon); } }