本文整理汇总了Java中com.vaadin.client.ComponentConnector类的典型用法代码示例。如果您正苦于以下问题:Java ComponentConnector类的具体用法?Java ComponentConnector怎么用?Java ComponentConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentConnector类属于com.vaadin.client包,在下文中一共展示了ComponentConnector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extend
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
protected void extend(ServerConnector serverConnector) {
serverConnector.addStateChangeHandler(new StateChangeEvent.StateChangeHandler() {
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
updateResetButtonVisibility();
}
});
}
});
textField = (VTextField) ((ComponentConnector) serverConnector).getWidget();
textField.addStyleName(CLASSNAME + "-textfield");
resetButtonElement = DOM.createDiv();
resetButtonElement.addClassName(CLASSNAME + "-resetbutton");
textField.addAttachHandler(this);
textField.addKeyUpHandler(this);
}
示例2: extend
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
protected void extend(ServerConnector target) {
final VButton button = (VButton) ((ComponentConnector) target).getWidget();
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (getState().copyTargetSelector != null) {
boolean success = copyToClipboard(getState().copyTargetSelector.startsWith(".")
? getState().copyTargetSelector
: "." + getState().copyTargetSelector);
getRpcProxy(CubaCopyButtonExtensionServerRpc.class).copied(success);
}
}
});
}
示例3: render
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void render(RendererCellReference rendererCellReference, final ComponentConnector componentConnector,
final SimplePanel panel) {
if (componentConnector != null) {
// render chart widgets deferred so measurements are correct. Do not render
// normal component widgets deferred as it causes some flicker when rerendering the grid
if (componentConnector.getClass().getName().equals("com.vaadin.addon.charts.shared.ChartConnector")) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
panel.setWidget(componentConnector.getWidget());
}
});
} else {
panel.setWidget(componentConnector.getWidget());
}
} else {
panel.clear();
}
}
示例4: extend
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
protected void extend(ServerConnector serverConnector) {
serverConnector
.addStateChangeHandler(new StateChangeEvent.StateChangeHandler() {
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
Scheduler.get().scheduleDeferred(
new Scheduler.ScheduledCommand() {
@Override
public void execute() {
updateResetButtonVisibility();
}
});
}
});
textField = (VTextField) ((ComponentConnector) serverConnector)
.getWidget();
textField.addStyleName(CLASSNAME + "-textfield");
resetButtonElement = DOM.createDiv();
resetButtonElement.addClassName(CLASSNAME + "-resetbutton");
textField.addAttachHandler(this);
textField.addKeyUpHandler(this);
}
示例5: extend
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@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();
}
}
});
}
示例6: render
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void render(RendererCellReference rendererCellReference, final ComponentConnector componentConnector,
final SimplePanel panel)
{
if (componentConnector != null) {
// render chart widgets deferred so measurements are correct. Do not render
// normal component widgets deferred as it causes some flicker when rerendering the grid
if (componentConnector.getClass().getName().equals("com.vaadin.addon.charts.shared.ChartConnector")) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
panel.setWidget(componentConnector.getWidget());
}
});
} else {
panel.setWidget(componentConnector.getWidget());
}
} else {
panel.clear();
}
}
示例7: attachScrollingEvents
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
protected void attachScrollingEvents(ComponentConnector connector) {
Widget widget = connector.getWidget();
if(widget instanceof LazyScrollNotifier) {
LazyScrollNotifier not = (LazyScrollNotifier) widget;
scrollingElement = not.getLazyScrollingElement();
not.addLazyScrollListener(this);
} else if (widget instanceof VWindow) {
final VWindow window = (VWindow)widget;
scrollingElement = window.contentPanel.getElement();
handlerRegistration = ((VWindow)widget).contentPanel.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
onLazyScroll(window.contentPanel.getElement());
}
});
} else {
LOGGER.severe("Failed to connect to scrolling events of " + connector.getClass().getName());
}
}
示例8: resolveScrollingParent
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
protected ComponentConnector resolveScrollingParent() {
if(getState().scrollingParent != null) {
return (ComponentConnector)getState().scrollingParent;
}
ServerConnector connector = getParent();
if(connector == null) {
LOGGER.severe("LazyVerticalLayout not in connector hierarchy.");
return null;
}
while(connector != null) {
if(connector instanceof MayScrollChildren) {
return (ComponentConnector)connector;
}
connector = connector.getParent();
}
LOGGER.severe("Failed to resolve scrolling parent for LazyVerticalLayout");
return null;
}
示例9: onConnectorHierarchyChange
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void onConnectorHierarchyChange(
ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) {
Map<Long, Widget> infoWindowContents = new HashMap<>();
List<ComponentConnector> children = getChildComponents();
for (ComponentConnector connector : children) {
for (String style : connector.getState().styles) {
if (style.startsWith("content-for-infowindow-")) {
String identifier = style
.replace("content-for-infowindow-", "");
Long id = Long.parseLong(identifier);
infoWindowContents.put(id, connector.getWidget());
getWidget().setInfoWindowContents(infoWindowContents);
}
}
}
}
示例10: extend
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
protected void extend(ServerConnector target) {
target.addStateChangeHandler(new StateChangeEvent.StateChangeHandler() {
private static final long serialVersionUID = -8439729365677484553L;
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
updateResetButtonVisibility();
}
});
}
});
textField = (VTextField) ((ComponentConnector) target).getWidget();
textField.addStyleName(CLASSNAME + "-textfield");
resetButtonElement = DOM.createDiv();
resetButtonElement.addClassName(CLASSNAME + "-resetbutton");
textField.addAttachHandler(this);
textField.addKeyUpHandler(this);
}
示例11: updateWidgets
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
private void updateWidgets() {
if (getParent() == null) {
// Component is removed, skip stuff to save user from JS exceptions
// and some milliseconds of lost life
return;
}
Widget current = ((ComponentConnector) getState().getCurrentComponent())
.getWidget();
getWidget().setCurrentWidget(current);
Widget previous = null;
if (getState().getPreviousComponent() != null) {
previous = ((ComponentConnector) getState().getPreviousComponent())
.getWidget();
}
Widget next = null;
if (getState().getNextComponent() != null) {
next = ((ComponentConnector) getState().getNextComponent())
.getWidget();
}
getWidget().setPreviousWidget(previous);
getWidget().setNextWidget(next);
}
示例12: onStateChanged
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
getWidget().setCaption(getState().caption);
if (getState().getLeftComponent() != null) {
Widget leftWidget = ((ComponentConnector) getState()
.getLeftComponent()).getWidget();
getWidget().setLeftWidget(leftWidget);
}
if (getState().getRightComponent() != null) {
Widget rightWidget = ((ComponentConnector) getState()
.getRightComponent()).getWidget();
getWidget().setRightWidget(rightWidget);
}
}
示例13: onConnectorHierarchyChange
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void onConnectorHierarchyChange(
ConnectorHierarchyChangeEvent event) {
if (getParent() == null) {
// Component is removed, skip stuff to save user from JS exceptions
// and some milliseconds of lost life
return;
}
List<ComponentConnector> oldChildren = event.getOldChildren();
List<ComponentConnector> children = getChildComponents();
for (int i = 0; i < children.size(); ++i) {
ComponentConnector connector = children.get(i);
Widget widget = connector.getWidget();
getWidget().addOrMove(widget, i);
oldChildren.remove(connector);
}
for (ComponentConnector oldChild : event.getOldChildren()) {
if (oldChild.getParent() != this) {
getWidget().remove(oldChild.getWidget());
}
}
}
示例14: updateCaption
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void updateCaption(ComponentConnector connector) {
URLReference urlReference = connector.getState().resources
.get(ComponentConstants.ICON_RESOURCE);
Icon icon = null;
if (urlReference != null) {
icon = getConnection().getIcon(urlReference.getURL());
}
Widget child = connector.getWidget();
String style = "v-caption";
if (ComponentStateUtil.hasStyles(connector.getState())) {
for (String customStyle : connector.getState().styles) {
style += " " + "v-caption-" + customStyle;
}
}
if (connector instanceof AbstractFieldConnector) {
AbstractFieldConnector field = (AbstractFieldConnector) connector;
if (field.isRequiredIndicatorVisible()) {
style += " v-caption-required";
}
}
getWidget().updateCaption(child, connector.getState().caption, icon,
connector.getState().width, style);
}
示例15: onConnectorHierarchyChange
import com.vaadin.client.ComponentConnector; //导入依赖的package包/类
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
if (getParent() == null) {
// Component is removed, skip stuff to save user from JS exceptions
// and some milliseconds of lost life
return;
}
List<ComponentConnector> children = getChildComponents();
HorizontalButtonGroupWidget widget = (HorizontalButtonGroupWidget) getWidget();
widget.clear();
for (ComponentConnector connector : children) {
// TODO #13688
((HorizontalButtonGroupWidget) getWidget()).add(connector
.getWidget());
}
}