Package com.vaadin.ui.TabSheet

Examples of com.vaadin.ui.TabSheet.Tab


     * @deprecated Use {@link #getTab(Component)} and {@link Tab#getCaption()}
     *             instead.
     */
    @Deprecated
    public String getTabCaption(Component c) {
        Tab info = tabs.get(c);
        if (info == null) {
            return "";
        } else {
            return info.getCaption();
        }
    }
View Full Code Here


     * @deprecated Use {@link #getTab(Component)} and
     *             {@link Tab#setCaption(String)} instead.
     */
    @Deprecated
    public void setTabCaption(Component c, String caption) {
        Tab info = tabs.get(c);
        if (info != null) {
            info.setCaption(caption);
            requestRepaint();
        }
    }
View Full Code Here

     * @deprecated Use {@link #getTab(Component)} and {@link Tab#getIcon()}
     *             instead.
     */
    @Deprecated
    public Resource getTabIcon(Component c) {
        Tab info = tabs.get(c);
        if (info == null) {
            return null;
        } else {
            return info.getIcon();
        }
    }
View Full Code Here

     * @deprecated Use {@link #getTab(Component)} and
     *             {@link Tab#setIcon(Resource)} instead.
     */
    @Deprecated
    public void setTabIcon(Component c, Resource icon) {
        Tab info = tabs.get(c);
        if (info != null) {
            info.setIcon(icon);
            requestRepaint();
        }
    }
View Full Code Here

    private boolean updateSelection() {
        Component originalSelection = selected;
        for (final Iterator<Component> i = getComponentIterator(); i.hasNext();) {
            final Component component = i.next();

            Tab tab = tabs.get(component);

            /*
             * If we have no selection, if the current selection is invisible or
             * if the current selection is disabled (but the whole component is
             * not) we select this tab instead
             */
            Tab selectedTabInfo = null;
            if (selected != null) {
                selectedTabInfo = tabs.get(selected);
            }
            if (selected == null || selectedTabInfo == null
                    || !selectedTabInfo.isVisible()
                    || !selectedTabInfo.isEnabled()) {

                // The current selection is not valid so we need to change
                // it
                if (tab.isEnabled() && tab.isVisible()) {
                    selected = component;
View Full Code Here

        if (selected == oldComponent) {
            // keep selection w/o selectedTabChange event
            selected = newComponent;
        }

        Tab newTab = tabs.get(newComponent);
        Tab oldTab = tabs.get(oldComponent);

        // Gets the captions
        String oldCaption = null;
        Resource oldIcon = null;
        String newCaption = null;
        Resource newIcon = null;

        if (oldTab != null) {
            oldCaption = oldTab.getCaption();
            oldIcon = oldTab.getIcon();
        }

        if (newTab != null) {
            newCaption = newTab.getCaption();
            newIcon = newTab.getIcon();
        } else {
            newCaption = newComponent.getCaption();
            newIcon = newComponent.getIcon();
        }

        // Gets the locations
        int oldLocation = -1;
        int newLocation = -1;
        int location = 0;
        for (final Iterator<Component> i = components.iterator(); i.hasNext();) {
            final Component component = i.next();

            if (component == oldComponent) {
                oldLocation = location;
            }
            if (component == newComponent) {
                newLocation = location;
            }

            location++;
        }

        if (oldLocation == -1) {
            addComponent(newComponent);
        } else if (newLocation == -1) {
            removeComponent(oldComponent);
            keyMapper.remove(oldComponent);
            newTab = addTab(newComponent);
            components.remove(newComponent);
            components.add(oldLocation, newComponent);
            newTab.setCaption(oldCaption);
            newTab.setIcon(oldIcon);
        } else {
            if (oldLocation > newLocation) {
                components.remove(oldComponent);
                components.add(newLocation, oldComponent);
                components.remove(newComponent);
                components.add(oldLocation, newComponent);
            } else {
                components.remove(newComponent);
                components.add(oldLocation, newComponent);
                components.remove(oldComponent);
                components.add(newLocation, oldComponent);
            }

            if (newTab != null) {
                // This should always be true
                newTab.setCaption(oldCaption);
                newTab.setIcon(oldIcon);
            }
            if (oldTab != null) {
                // This should always be true
                oldTab.setCaption(newCaption);
                oldTab.setIcon(newIcon);
            }

            requestRepaint();
        }
View Full Code Here

      if (cp != null) {
        setSelectedTab((Tab)cp.getData());
        return false;
      }
    }
    Tab tab = addTab(panel.getUI(), panel.getTitle());
    tab.setClosable(panel.isCloseable());
    panel.setData(tab);
    setSelectedTab(tab);
    list.add(panel);
    return true;
  }
View Full Code Here

    navigate((BaseVaadinView) presenter.getView());
  }

  @SuppressWarnings("serial")
  private void navigate(final String caption, final TabSheet tabSheet, final BaseVaadinView view) {
    final Tab saved = tabSheet.addTab(view, caption, null);
    saved.setClosable(true);
    saved.setIcon(view.getIcon());
    tabSheet.setSelectedTab(view);
    beanManager.fireEvent(view, new AnnotationLiteral<BeforeNavigateToView>() {
    });
  }
View Full Code Here

            title.setValue(caption);

            title.addTextChangeListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    Tab tab = editors.getTab(SortableLayout.this.getParent());
                    String t = event.getText();
                    if (t == null || t.equals("")) {
                        t = " ";
                    }
                    tab.setCaption(t);
                }
            });
            layout.addComponent(title);

            dropHandler = new ReorderLayoutDropHandler(layout);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TabSheet.Tab

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.