Example usage for com.vaadin.ui TabSheet setVisible

List of usage examples for com.vaadin.ui TabSheet setVisible

Introduction

In this page you can find the example usage for com.vaadin.ui TabSheet setVisible.

Prototype

@Override
    public void setVisible(boolean visible) 

Source Link

Usage

From source file:org.apache.ace.webui.vaadin.EditWindow.java

License:Apache License

/**
 * @param object/* ww  w . j a va2s  .c o  m*/
 * @param factories
 */
protected void initDialog(final NamedObject object, List<UIExtensionFactory> factories) {
    VerticalLayout fields = new VerticalLayout();
    fields.setSpacing(true);
    fields.addComponent(m_name);
    fields.addComponent(m_description);

    TabSheet tabs = new TabSheet();
    tabs.setHeight("350px");
    tabs.setWidth("100%");
    tabs.setVisible(!factories.isEmpty());

    Map<String, Object> context = new HashMap<>();
    context.put("object", object);
    populateContext(context);

    for (UIExtensionFactory factory : factories) {
        try {
            tabs.addTab(factory.create(context));
        } catch (Throwable ex) {
            // We ignore extension factories that throw exceptions
            // TODO: log this or something
            ex.printStackTrace();
        }
    }

    Button okButton = new Button("Ok", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                onOk((String) m_name.getValue(), (String) m_description.getValue());
                close();
            } catch (Exception e) {
                handleError(e);
            }
        }
    });
    // Allow enter to be used to close this dialog with enter directly...
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addStyleName("primary");

    Button cancelButton = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    cancelButton.setClickShortcut(KeyCode.ESCAPE);

    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.addComponent(okButton);
    buttonBar.addComponent(cancelButton);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(tabs);
    layout.addComponent(buttonBar);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    m_name.focus();
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.StackRenderer.java

License:Open Source License

@Override
public void setVisible(MUIElement changedElement, boolean visible) {
    TabSheet tabPane = (TabSheet) changedElement.getWidget();
    tabPane.setVisible(visible);
}