Search in sources :

Example 6 with ComponentConnector

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++);
    }
}
Also used : ComponentConnector(com.vaadin.client.ComponentConnector) VCaption(com.vaadin.client.VCaption)

Example 7 with ComponentConnector

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();
}
Also used : ComponentConnector(com.vaadin.client.ComponentConnector) Widget(com.google.gwt.user.client.ui.Widget) FastNavigationServerRPC(org.vaadin.patrik.shared.FastNavigationServerRPC) FastNavigationClientRPC(org.vaadin.patrik.shared.FastNavigationClientRPC) EditorListener(org.vaadin.patrik.client.EditorStateManager.EditorListener) FocusListener(org.vaadin.patrik.client.FocusTracker.FocusListener)

Example 8 with ComponentConnector

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);
        }
    }
}
Also used : HasContextHelpConnector(com.vaadin.client.ui.HasContextHelpConnector) ComponentConnector(com.vaadin.client.ComponentConnector) Element(com.google.gwt.dom.client.Element)

Example 9 with ComponentConnector

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();
}
Also used : ComponentConnector(com.vaadin.client.ComponentConnector)

Aggregations

ComponentConnector (com.vaadin.client.ComponentConnector)9 ServerConnector (com.vaadin.client.ServerConnector)3 Element (com.google.gwt.dom.client.Element)2 HasContextHelpConnector (com.vaadin.client.ui.HasContextHelpConnector)2 Widget (com.google.gwt.user.client.ui.Widget)1 VCaption (com.vaadin.client.VCaption)1 AbstractFieldConnector (com.vaadin.client.ui.AbstractFieldConnector)1 ImageIcon (com.vaadin.client.ui.ImageIcon)1 AbstractFieldState (com.vaadin.shared.AbstractFieldState)1 EditorListener (org.vaadin.patrik.client.EditorStateManager.EditorListener)1 FocusListener (org.vaadin.patrik.client.FocusTracker.FocusListener)1 FastNavigationClientRPC (org.vaadin.patrik.shared.FastNavigationClientRPC)1 FastNavigationServerRPC (org.vaadin.patrik.shared.FastNavigationServerRPC)1