use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class CubaScrollTableConnector method init.
@Override
protected void init() {
super.init();
getWidget()._delegate.cellClickListener = new TableCellClickListener() {
@Override
public void onClick(String columnKey, int rowKey) {
getRpcProxy(CubaTableServerRpc.class).onClick(columnKey, String.valueOf(rowKey));
}
};
tooltipHandlerRegistration = Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
if (event.getTypeInt() != Event.ONMOUSEMOVE || !Element.is(event.getNativeEvent().getEventTarget())) {
return;
}
Element element = Element.as(event.getNativeEvent().getEventTarget());
if ("div".equalsIgnoreCase(element.getTagName())) {
String className = element.getClassName();
if (className != null && (className.contains("v-table-caption-container") || className.contains("v-table-footer-container"))) {
DomEvent.fireNativeEvent(event.getNativeEvent(), getWidget());
}
}
}
});
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class TableWidgetDelegate method showPresentationEditorPopup.
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);
}
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class TableWidgetDelegate method setFocus.
public void setFocus(String itemKey, String columnKey) {
HasWidgets row = tableWidget.getRenderedRowByKey(itemKey);
int columnIndex = Arrays.asList(tableWidget.getVisibleColOrder()).indexOf(columnKey);
for (Widget childWidget : row) {
Element element = ((Widget) row).getElement();
if (element.getChild(columnIndex).getFirstChild() == childWidget.getElement().getParentNode()) {
this.focusWidget(childWidget);
break;
}
}
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class TableWidgetDelegate method showCustomPopup.
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);
}
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class TableWidgetDelegate method showContextMenuPopup.
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);
}
Aggregations