use of com.vaadin.client.ComponentConnector in project cuba by cuba-platform.
the class CubaTabSheetCssLayoutConnector method onConnectorHierarchyChange.
// This method is copied from the superclass but its parts are swapped
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
for (ComponentConnector child : event.getOldChildren()) {
if (child.getParent() == this) {
// Skip current children
continue;
}
getWidget().remove(child.getWidget());
VCaption vCaption = childIdToCaption.get(child.getConnectorId());
if (vCaption != null) {
childIdToCaption.remove(child.getConnectorId());
getWidget().remove(vCaption);
}
}
int index = 0;
for (ComponentConnector child : getChildComponents()) {
VCaption childCaption = childIdToCaption.get(child.getConnectorId());
if (childCaption != null) {
getWidget().addOrMove(childCaption, index++);
}
getWidget().addOrMove(child.getWidget(), index++);
}
}
use of com.vaadin.client.ComponentConnector in project GridFastNavigation by TatuLund.
the class GridFastNavigationConnector method extend.
@Override
@SuppressWarnings("unchecked")
protected void extend(ServerConnector target) {
grid = (Grid<Object>) ((ComponentConnector) target).getWidget();
rpc = getRpcProxy(FastNavigationServerRPC.class);
editorManager = new EditorStateManager(grid, getState());
focusTracker = new FocusTracker(grid);
registerRpc(FastNavigationClientRPC.class, new FastNavigationClientRPC() {
@Override
public void setDisabledColumns(List<Integer> indices) {
editorManager.setDisabledColumns(indices);
}
@Override
public void unlockEditor(int lockId) {
editorManager.externalUnlock(lockId);
}
});
editorManager.addListener(new EditorListener() {
@Override
public void editorOpened(Grid<Object> grid, Editor<Object> editor, int row, int col, int lockId) {
editorManager.clearDisabledColumns();
if (getState().hasEditorOpenListener) {
rpc.editorOpened(row, col, lockId);
}
}
@Override
public void editorClosed(Grid<Object> grid, Editor<Object> editor, int row, int col, boolean cancel) {
editorManager.clearDisabledColumns();
if (getState().hasEditorCloseListener) {
rpc.editorClosed(row, col, cancel);
}
}
@Override
public void dataChanged(Grid<Object> grid, Editor<Object> editor, Widget widget, String newContent, int row, int col) {
if (getState().hasCellEditListener) {
rpc.cellUpdated(row, col, newContent);
}
if (getState().hasRowEditListener) {
rpc.rowUpdated(row);
}
}
@Override
public void clickOut(Grid<Object> grid) {
if (getState().hasClickOutListener) {
rpc.clickOut();
}
}
});
focusTracker.addListener(new FocusListener() {
@Override
public void focusMoved(int currentRow, int currentCol, int lastRow, int lastCol) {
editorManager.notifyIfDataChanged(lastRow, lastCol);
editorManager.saveOldContent(currentCol);
if (getState().hasFocusListener) {
rpc.focusUpdated(currentRow, currentCol);
}
}
});
updateCloseShortcuts();
updateOpenShortcuts();
updateFocusTracking();
}
use of com.vaadin.client.ComponentConnector in project cuba by cuba-platform.
the class CubaOrderedLayoutSlot method onClick.
@Override
public void onClick(ClickEvent event) {
Element target = Element.as(event.getNativeEvent().getEventTarget());
ComponentConnector componentConnector = Util.findConnectorFor(getWidget());
if (target == contextHelpIcon && componentConnector instanceof HasContextHelpConnector) {
HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector;
if (hasContextHelpIconListeners(componentConnector.getState())) {
connector.contextHelpIconClick(event);
}
}
}
use of com.vaadin.client.ComponentConnector in project cuba by cuba-platform.
the class CubaWidgetsTreeConnector method createNode.
@Override
protected VTree.TreeNode createNode(UIDL childUidl) {
if (childUidl.hasAttribute("widgetIndex")) {
int widgetIndex = childUidl.getIntAttribute("widgetIndex");
if (widgetIndex < nodeWidgets.size()) {
ComponentConnector componentConnector = getChildComponents().get(widgetIndex);
CubaWidgetsTreeWidget.WidgetTreeNode treeNode = getWidget().new WidgetTreeNode();
treeNode.setNodeWidget(componentConnector.getWidget());
return treeNode;
}
}
// all branches should return instance of same TreeNode class
return getWidget().new WidgetTreeNode();
}
Aggregations