com.vaadin.client.ServerConnector Java Examples

The following examples show how to use com.vaadin.client.ServerConnector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SidebarMenuExtensionConnector.java    From GridExtensionPack with Apache License 2.0 6 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
	grid = getGrid();
	registerRpc(SidebarMenuExtensionClientRpc.class, new SidebarMenuExtensionClientRpc() {

		@Override
		public void openSidebarMenu() {
			getGrid().setSidebarOpen(true);
		}

		@Override
		public void closeSidebarMenu() {
			getGrid().setSidebarOpen(false);
		}
	});
}
 
Example #2
Source File: CacheStrategyExtensionConnector.java    From GridExtensionPack with Apache License 2.0 6 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
	grid = getGrid();

	// Probably a better way to change cache strategy, but the datasource
	// isn't available yet.
	registration = grid.addDataAvailableHandler(new DataAvailableHandler() {

		@Override
		public void onDataAvailable(DataAvailableEvent event) {
			// Make sure we won't get another event for this.
			if (registration != null) {
				registration.removeHandler();
				registration = null;
				setCacheStrategy();
			}
		}
	});
}
 
Example #3
Source File: AutoCompleteTextFieldConnector.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void extend(final ServerConnector target) {
    textFieldWidget = (VTextField) ((ComponentConnector) target).getWidget();
    textFieldWidget.setImmediate(true);
    textFieldWidget.textChangeEventMode = "EAGER";
    panel.setWidget(select);
    panel.setStyleName("suggestion-popup");
    panel.setOwner(textFieldWidget);

    textFieldWidget.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(final KeyUpEvent event) {
            if (panel.isAttached()) {
                handlePanelEventDelegation(event);
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                rpc.executeQuery(textFieldWidget.getValue(), textFieldWidget.getCursorPos());
            } else {
                doAskForSuggestion();
            }
        }
    });
}
 
Example #4
Source File: HtmlAttributesExtensionConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected void withElement(String querySelector, Consumer<Element> action) {
    ServerConnector parent = getParent();

    if (parent instanceof AbstractComponentConnector) {
        Widget widget = ((AbstractComponentConnector) parent).getWidget();
        if (widget != null) {
            Element element = widget.getElement();
            if (DEFAULT_SELECTOR.equals(querySelector)) {
                action.accept(element);
            } else {
                NodeList<Element> subElements = findSubElements(element, querySelector);
                for (int i = 0; i < subElements.getLength(); i++) {
                    action.accept(subElements.getItem(i));
                }
            }
        }
    }
}
 
Example #5
Source File: ContextMenuConnector.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    Logger.getLogger("ContextMenuConnector").info("extend");

    // Widget widget = ((AbstractComponentConnector) target).getWidget();

    // widget.addDomHandler(new ContextMenuHandler() {
    //
    // @Override
    // public void onContextMenu(ContextMenuEvent event) {
    // event.stopPropagation();
    // event.preventDefault();
    //
    // showMenu(event.getNativeEvent().getClientX(), event
    // .getNativeEvent().getClientY());
    // }
    // }, ContextMenuEvent.getType());

    // widget.addDomHandler(new KeyDownHandler() {
    // @Override
    // public void onKeyDown(KeyDownEvent event) {
    // // FIXME: check if menu is shown or handleNavigation will do it?
    //
    // boolean handled = contextMenuWidget.handleNavigation(event
    // .getNativeEvent().getKeyCode(), event.getNativeEvent()
    // .getCtrlKey(), event.getNativeEvent().getShiftKey());
    //
    // if (handled) {
    // event.stopPropagation();
    // event.preventDefault();
    // }
    // }
    // }, KeyDownEvent.getType());
}
 
Example #6
Source File: WrappingGridConnector.java    From GridExtensionPack with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void extend(ServerConnector target) {
	grid = (Grid<?>) ((ComponentConnector) target).getWidget();

	wrappingEnabled = false;
	WrappingClientRPC rpc = new WrappingClientRPC() {
		@Override
		public void setWrapping(boolean enable, int defaultRowHeight) {
			if (wrappingEnabled != enable) {
				wrappingEnabled = enable;
				DEFAULT_HEIGHT = defaultRowHeight;
				if (enable) {
					// Figure out default header height
					applyStyle.execute(0);
				} else {
					disableWrapping();
				}
			}
		}
	};

	registerRpc(WrappingClientRPC.class, rpc);

	resizeHandler = grid.addColumnResizeHandler(new ColumnResizeHandler() {
		@Override
		public void onColumnResize(ColumnResizeEvent event) {
			Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {
				@Override
				public void execute() {
					AnimationScheduler.get().requestAnimationFrame(applyStyle);						
				}
			});
		}
	});
}
 
Example #7
Source File: CubaCollapsibleMenuLayoutExtensionConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    ComponentConnector connector = ((ComponentConnector) target);
    LayoutManager layoutManager = connector.getLayoutManager();

    Scheduler.get().scheduleFinally(() -> layoutManager.addElementResizeListener(
            connector.getWidget().getElement(),
            e -> layoutManager.setNeedsMeasureRecursively(connector)));
}
 
Example #8
Source File: CubaTableDragSourceExtensionConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    super.extend(target);

    TableWidget tableWidget = getTableWidget();
    if (tableWidget != null) {
        tableWidget.addAfterBodyUpdateListener(afterBodyUpdateHandler);
    }
}
 
Example #9
Source File: CubaCopyButtonExtensionConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    VButton button = (VButton) ((ComponentConnector) target).getWidget();

    button.addClickHandler(event -> {
        if (getState().copyTargetSelector != null) {
            boolean success = copyToClipboard(getState().copyTargetSelector.startsWith(".")
                    ? getState().copyTargetSelector
                    : "." + getState().copyTargetSelector);
            getRpcProxy(CubaCopyButtonExtensionServerRpc.class).copied(success);
        }
    });
}
 
Example #10
Source File: CubaHistoryControlConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    this.target = target;
    this.historyApi = new HistoryGwtApi() {
        @Override
        protected void onHistoryBackPerformed() {
            handleHistoryBackAction();
        }

        @Override
        protected boolean isEnabled() {
            return isAttached();
        }
    };
}
 
Example #11
Source File: CubaMultiSelectionModelConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    super.extend(target);

    if (!Tools.isUseSimpleMultiselectForTouchDevice()) {
        if (clickHandler != null) {
            clickHandler.removeHandler();
            clickHandler = null;
        }

        Grid<JsonObject> grid = getGrid();
        BodyClickHandler handler = createBodyClickHandler(grid);
        clickHandler = grid.addBodyClickHandler(handler);
    }
}
 
Example #12
Source File: SuggesterConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
	connector = (AceEditorConnector) target;
	widget = connector.getWidget();
	widget.setKeyboardHandler(this);
}
 
Example #13
Source File: HtmlAttributesExtensionConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    ((AbstractComponentConnector) target).getWidget();
}
 
Example #14
Source File: CubaTimerConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
}
 
Example #15
Source File: CubaImageObjectFitPolyfillExtensionConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
}
 
Example #16
Source File: CubaFileDownloaderConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
}
 
Example #17
Source File: TableSelectionModelConnector.java    From GridExtensionPack with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
	super.extend(target);

	setSelectionMode();
}
 
Example #18
Source File: CubaSingleSelectionModelConnector.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void extend(ServerConnector target) {
    super.extend(target);
}
 
Example #19
Source File: ContextMenuConnector.java    From cuba with Apache License 2.0 2 votes vote down vote up
@Override
protected void extend(ServerConnector target) {

}
 
Example #20
Source File: ContextMenuConnector.java    From context-menu with Apache License 2.0 2 votes vote down vote up
@Override
protected void extend(ServerConnector target) {

}