use of com.haulmont.cuba.web.widgets.client.jqueryfileupload.CubaFileUploadWidget in project cuba by cuba-platform.
the class CubaPopupButtonConnector method handleMouseOver.
protected void handleMouseOver(@SuppressWarnings("unused") Event.NativePreviewEvent event, Element target) {
if (!getState().customLayout && getWidget().popupHasChild(target)) {
Widget widget = WidgetUtil.findWidget(target, null);
if ((widget instanceof VButton || widget instanceof VUpload || widget instanceof CubaFileUploadWidget)) {
VButton button;
if (widget instanceof VButton) {
button = (VButton) widget;
} else if (widget instanceof CubaFileUploadWidget) {
button = ((CubaFileUploadWidget) widget).getSubmitButton();
} else {
button = ((VUpload) widget).submitButton;
}
if (!button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
getWidget().childWidgetFocused(button);
button.setFocus(true);
}
}
}
}
use of com.haulmont.cuba.web.widgets.client.jqueryfileupload.CubaFileUploadWidget in project cuba by cuba-platform.
the class CubaPopupButtonWidget method onPopupOpened.
@Override
protected void onPopupOpened() {
super.onPopupOpened();
if (customLayout) {
return;
}
// find button, assign .v-selected style
for (Widget popupChild : getPopup()) {
if (popupChild instanceof FlowPanel) {
FlowPanel content = (FlowPanel) popupChild;
for (Widget contentChild : content) {
if (contentChild instanceof VButton) {
VButton button = (VButton) contentChild;
if (button.isEnabled() && !button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
button.addStyleName(SELECTED_ITEM_STYLE);
button.setFocus(true);
break;
}
}
}
}
}
// add focus handler
for (Widget popupChild : getPopup()) {
if (popupChild instanceof FlowPanel) {
FlowPanel content = (FlowPanel) popupChild;
for (Widget contentChild : content) {
VButton button = null;
if (contentChild instanceof CubaFileUploadWidget) {
button = ((CubaFileUploadWidget) contentChild).getSubmitButton();
} else if (contentChild instanceof VUpload) {
button = ((VUpload) contentChild).submitButton;
} else if (contentChild instanceof VButton) {
button = (VButton) contentChild;
}
if (button != null) {
VButton finalButton = button;
button.addFocusHandler(event -> childWidgetFocused(finalButton));
// sink mouse over
DOM.sinkEvents(button.getElement(), Event.ONMOUSEOVER | DOM.getEventsSunk(button.getElement()));
}
}
}
}
}
use of com.haulmont.cuba.web.widgets.client.jqueryfileupload.CubaFileUploadWidget in project cuba by cuba-platform.
the class CubaPopupButtonConnector method handleKeyDown.
protected void handleKeyDown(Event.NativePreviewEvent event, Element target) {
if (!getState().customLayout && getWidget().popupHasChild(target)) {
Widget widget = WidgetUtil.findWidget(target, null);
if (widget instanceof VButton || widget instanceof VUpload || widget instanceof CubaFileUploadWidget) {
Widget widgetParent = widget.getParent();
if (widgetParent.getParent() instanceof VUpload) {
VUpload upload = (VUpload) widgetParent.getParent();
widgetParent = upload.getParent();
} else if (widgetParent.getParent() instanceof CubaFileUploadWidget) {
CubaFileUploadWidget upload = (CubaFileUploadWidget) widgetParent.getParent();
widgetParent = upload.getParent();
}
FlowPanel layout = (FlowPanel) widgetParent;
Widget focusWidget = null;
int widgetIndex = layout.getWidgetIndex(widget);
int keyCode = event.getNativeEvent().getKeyCode();
if (keyCode == KeyCodes.KEY_DOWN) {
focusWidget = Tools.findNextWidget(layout, widgetIndex);
} else if (keyCode == KeyCodes.KEY_UP) {
focusWidget = Tools.findPrevWidget(layout, widgetIndex);
}
if (focusWidget instanceof VButton || focusWidget instanceof CubaFileUploadWidget || focusWidget instanceof VUpload) {
VButton button;
if (focusWidget instanceof VButton) {
button = (VButton) focusWidget;
} else if (focusWidget instanceof CubaFileUploadWidget) {
button = ((CubaFileUploadWidget) focusWidget).getSubmitButton();
} else {
button = ((VUpload) focusWidget).submitButton;
}
getWidget().childWidgetFocused(button);
button.setFocus(true);
}
}
}
}
Aggregations