Example usage for com.google.gwt.event.logical.shared BeforeSelectionHandler BeforeSelectionHandler

List of usage examples for com.google.gwt.event.logical.shared BeforeSelectionHandler BeforeSelectionHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared BeforeSelectionHandler BeforeSelectionHandler.

Prototype

BeforeSelectionHandler

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.stdlayout.MainTabPanel.java

License:Apache License

public MainTabPanel(ArrayList<IsWidget> buttons) {
    super();/*www .  ja v a  2 s . c om*/
    this.buttons = buttons;
    VerticalPanel vp = (VerticalPanel) getWidget();
    dockPanel = new DockPanel();
    dockPanel.setStyleName("alcina-MainMenu");
    dockPanel.setWidth("100%");
    mainMenuContainer = new FlowPanel();
    mainMenuContainer.setStyleName("alcina-MainMenuContainer");
    mainMenuContainer.add(dockPanel);
    tabBarProt = (TabBar) vp.getWidget(0);
    vp.remove(tabBarProt);
    if (isWrapCenterContainer()) {
        centerContainer = new SpanPanel();
        centerContainer.add(tabBarProt);
        dockPanel.add(centerContainer, DockPanel.CENTER);
    } else {
        dockPanel.add(tabBarProt, DockPanel.CENTER);
    }
    bp = createButtonsPanel();
    refreshButtonPanelVis();
    dockPanel.add(bp, DockPanel.EAST);
    dockPanel.setCellHorizontalAlignment(bp, DockPanel.ALIGN_RIGHT);
    vp.insert(mainMenuContainer, 0);
    customizeDock();
    vp.insert(toolbarHolder, 1);
    vp.getWidget(1).setWidth("100%");
    noTabContentHolder.setVisible(false);
    noTabContentHolder.setStyleName("content alcina-ContentFrame alcina-MainContent");
    vp.add(noTabContentHolder);
    vp.setWidth("100%");
    addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            int tabIndex = event.getItem();
            getDeckPanel().setVisible(tabIndex >= 0);
            if (tabIndex != -1) {
                noTabContentHolder.clear();
            }
            noTabContentHolder.setVisible(tabIndex == -1);
        }
    });
}

From source file:cc.alcina.framework.gwt.client.widget.LazyPanel.java

License:Apache License

public static void addBeforeSelectionHandler(final CustomisableTabPanel panel) {
    panel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            Integer tabIndex = event.getItem();
            Widget widget = panel.getWidget(tabIndex);
            if (widget instanceof LazyPanel) {
                ((LazyPanel) widget).ensureWidget();
            }/*from  w  w w . j  a v  a  2 s  .com*/
        }
    });
}

From source file:cc.alcina.framework.gwt.client.widget.LazyPanel.java

License:Apache License

/**
 * Adds a tab listener to ensure that any {@link LazyPanel} instances are
 * loaded when a tab panel selects the lazy panel's tab.
 * /*from w ww. j  a  v  a  2  s .  co m*/
 * @param panel
 *            to add listener to
 */
public static void addBeforeSelectionHandler(final TabPanel panel) {
    panel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            Integer tabIndex = event.getItem();
            Widget widget = panel.getWidget(tabIndex);
            if (widget instanceof LazyPanel) {
                ((LazyPanel) widget).ensureWidget();
            }
        }
    });
}

From source file:com.bramosystems.oss.player.showcase.client.ControlPane.java

License:Apache License

public ControlPane() {
    animator = new Animation() {

        @Override//from w  w  w  . j  a  v  a2s . com
        protected void onUpdate(double progress) {
            onAnimatorUpdate(progress);
        }
    };

    playlistPane = PlaylistPane.singleton;
    playerLog = new PlayerLogPane();

    tp = new TabPanel();
    tp.add(playlistPane, "Playlist");
    tp.add(playerLog, "Player Log");
    tp.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

        @Override
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            if ((event.getItem() == selectedTab) || !fullState) {
                toggle();
            }
            selectedTab = event.getItem();
        }
    });
    initWidget(tp);
}

From source file:com.ephesoft.gxt.admin.client.view.fuzzymapping.FuzzyDBMappingGridView.java

License:Open Source License

private void addSelectionChangeHandler() {
    connectionCombo.addBeforeSelectionHandler(new BeforeSelectionHandler<ConnectionsDTO>() {

        @Override//  www. j a  va2s  .  com
        public void onBeforeSelection(final BeforeSelectionEvent<ConnectionsDTO> event) {
            final ConnectionsDTO connection = event.getItem();
            if (presenter.getCurrentConnection() == connection) {
                event.cancel();
            } else {
                if (indexFieldMappingGrid.getStore().size() > 0) {
                    event.cancel();
                    ConfirmationDialog dialog = DialogUtil.showConfirmationDialog(
                            LocaleDictionary.getConstantValue(BatchClassConstants.CONFIRMATION),
                            LocaleDictionary.getMessageValue(
                                    BatchClassMessages.SURE_YOU_WANT_TO_RESET_FUZZY_DB_MAPPINGS));
                    dialog.setDialogListener(new DialogAdapter() {

                        @Override
                        public void onOkClick() {
                            presenter.deleteAllMappings();
                            clearComboStores(true, true, false, false, false);
                            setConnection(connection);
                        }

                        @Override
                        public void onCloseClick() {
                            event.cancel();
                        }

                        @Override
                        public void onCancelClick() {
                            event.cancel();
                        }
                    });
                }
            }
        }
    });
    connectionCombo.addSelectionHandler(new SelectionHandler<ConnectionsDTO>() {

        @Override
        public void onSelection(final SelectionEvent<ConnectionsDTO> event) {
            final ConnectionsDTO connection = event.getSelectedItem();
            connectionCombo.setValue(connection, true, true);
        }
    });
    connectionCombo.addValueChangeHandler(new ValueChangeHandler<ConnectionsDTO>() {

        @Override
        public void onValueChange(ValueChangeEvent<ConnectionsDTO> event) {
            // TODO Auto-generated method stub
            final ConnectionsDTO connection = event.getValue();
            presenter.setConnection(connection);
            presenter.setTables(connection);
        }
    });

    tableNameCombo.addBeforeSelectionHandler(new BeforeSelectionHandler<String>() {

        @Override
        public void onBeforeSelection(final BeforeSelectionEvent<String> event) {
            final String value = event.getItem();
            final String previouslySelectedTableName = tableNameCombo.getValue();
            if (!StringUtil.isNullOrEmpty(previouslySelectedTableName)
                    && !previouslySelectedTableName.equals(value)) {
                if (indexFieldMappingGrid.getStore().size() > 0) {
                    event.cancel();
                    ConfirmationDialog dialog = DialogUtil.showConfirmationDialog(
                            LocaleDictionary.getConstantValue(BatchClassConstants.CONFIRMATION),
                            LocaleDictionary.getMessageValue(
                                    BatchClassMessages.SURE_YOU_WANT_TO_RESET_FUZZY_DB_MAPPINGS));
                    dialog.setDialogListener(new DialogAdapter() {

                        @Override
                        public void onOkClick() {
                            presenter.deleteAllMappings();
                            clearComboStores(true, false, false, false, false);
                            setSelectedTable(value);
                        }

                        @Override
                        public void onCloseClick() {
                            event.cancel();
                        }

                        @Override
                        public void onCancelClick() {
                            event.cancel();
                        }
                    });
                }
            }
        }
    });

    tableNameCombo.addSelectionHandler(new SelectionHandler<String>() {

        @Override
        public void onSelection(SelectionEvent<String> event) {
            String value = event.getSelectedItem();
            setSelectedTable(value);
        }
    });
    tableNameCombo.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            final ListStore<String> store = tableNameCombo.getStore();
            if (store != null) {
                final String value = event.getValue();
                final int totalItems = store.size();
                for (int index = 0; index < totalItems; index++) {
                    final String item = store.get(index);
                    if (null != item && item.equalsIgnoreCase(value)) {
                        getColumns(item);
                        tableNameCombo.setValue(item);
                        break;
                    }
                }
            }
        }
    });

    columnNameCombo.addSelectionHandler(new SelectionHandler<String>() {

        @Override
        public void onSelection(SelectionEvent<String> event) {
            columnNameCombo.setValue(event.getSelectedItem(), true, true);
            // columnNameCombo.focus();
            columnNameCombo.finishEditing();
        }
    });

    rowIDCombo.addSelectionHandler(new SelectionHandler<String>() {

        @Override
        public void onSelection(SelectionEvent<String> event) {
            String value = event.getSelectedItem();
            rowIDCombo.setValue(value, true, true);
        }
    });
}

From source file:com.ephesoft.gxt.admin.client.view.mapping.DatabaseExportMappingEditView.java

License:Open Source License

private void addSelectionChangeHandler() {
    connectionCombo.addBeforeSelectionHandler(new BeforeSelectionHandler<ConnectionsDTO>() {

        @Override/*  w w  w . j  av a 2  s .co  m*/
        public void onBeforeSelection(final BeforeSelectionEvent<ConnectionsDTO> event) {
            final ConnectionsDTO connection = event.getItem();
            ConnectionsDTO currentConnection = presenter.getCurrentConnection();
            if (currentConnection != null) {
                if (currentConnection == connection) {
                    event.cancel();
                }
            }
        }
    });
    connectionCombo.addSelectionHandler(new SelectionHandler<ConnectionsDTO>() {

        @Override
        public void onSelection(final SelectionEvent<ConnectionsDTO> event) {
            final ConnectionsDTO connection = event.getSelectedItem();
            presenter.setConnection(connection);
            presenter.setTables(connection);
            presenter.setBatchClassDirty();
        }
    });
}

From source file:com.ephesoft.gxt.admin.client.widget.BatchClassNavigationTree.java

License:Open Source License

private void addBeforeSelectionHandler() {
    this.getSelectionModel()
            .addBeforeSelectionHandler(new BeforeSelectionHandler<BatchClassNavigationNode<?>>() {

                @Override//from w  ww  .j a  va2s. c  o  m
                public void onBeforeSelection(BeforeSelectionEvent<BatchClassNavigationNode<?>> event) {
                    BatchClassNavigationNode<?> currentNode = getCurrentNode();
                    if (null != currentNode) {
                        if (currentNode.getBindedPresenter() != null) {
                            if (!currentNode.getBindedPresenter().isValid()) {
                                event.cancel();
                            }
                        }
                    }
                }
            });
}

From source file:com.ephesoft.gxt.admin.client.widget.RegexComboBox.java

License:Open Source License

public RegexComboBox() {
    super();/*from   ww  w . j  a  v  a  2  s  .  c om*/
    this.add(LocaleDictionary.getConstantValue(BatchClassConstants.REGEX_BUILDER));
    this.add(LocaleDictionary.getConstantValue(BatchClassConstants.REGEX_POOL));
    this.addSelectionHandler();
    setToolTip();
    this.setTriggerAction(TriggerAction.ALL);
    previousPattern = BatchClassConstants.EMPTY_STRING;

    this.addBeforeSelectionHandler(new BeforeSelectionHandler<String>() {

        @Override
        public void onBeforeSelection(BeforeSelectionEvent<String> event) {

            String text = getText();
            if (!StringUtil.isNullOrEmpty(text)) {
                previousPattern = text;
            } else {
                previousPattern = BatchClassConstants.EMPTY_STRING;
            }

        }

    });
}

From source file:com.ephesoft.gxt.core.client.ui.widget.Grid.java

License:Open Source License

private void addBeforeCellSelectionChangeEvent(final CellSelectionModel<T> cellSelectionModel) {
    cellSelectionModel.addBeforeSelectionHandler(new BeforeSelectionHandler<T>() {

        @Override/*from   w ww  .ja va2  s.c o  m*/
        public void onBeforeSelection(BeforeSelectionEvent<T> event) {
            onBeforeCellSelectionChange(event, currentSelectedModel);
        }
    });
}

From source file:com.ephesoft.gxt.systemconfig.client.widget.SystemConfigNavigationTree.java

License:Open Source License

private void addBeforeSelectionHandler() {
    this.getSelectionModel()
            .addBeforeSelectionHandler(new BeforeSelectionHandler<SystemConfigNavigationNode<?>>() {

                @Override//from w w w. j  ava  2 s  .c  o m
                public void onBeforeSelection(BeforeSelectionEvent<SystemConfigNavigationNode<?>> event) {
                    SystemConfigNavigationNode<?> currentNode = SystemConfigNavigationTree.this
                            .getCurrentNode();
                    if (null != currentNode) {
                        if (currentNode.getBindedPresenter() != null) {
                            if (!currentNode.getBindedPresenter().isValid()) {
                                event.cancel();
                            }
                        }
                    }
                }
            });
}