Example usage for com.vaadin.ui HorizontalSplitPanel HorizontalSplitPanel

List of usage examples for com.vaadin.ui HorizontalSplitPanel HorizontalSplitPanel

Introduction

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

Prototype

public HorizontalSplitPanel() 

Source Link

Document

Creates an empty horizontal split panel.

Usage

From source file:org.opennms.features.vaadin.jmxconfiggenerator.ui.mbeans.MBeansView.java

License:Open Source License

private AbstractSplitPanel initMainPanel(Tree first, Component second) {
    AbstractSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();// w w w  .j a  v a  2  s .  c om
    splitPanel.setLocked(false);
    splitPanel.setSplitPosition(25, Unit.PERCENTAGE);

    splitPanel.setFirstComponent(first);
    splitPanel.setSecondComponent(second);
    splitPanel.setCaption(first.getCaption());
    return splitPanel;
}

From source file:org.opennms.features.vaadin.mibcompiler.MibCompilerApplication.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    if (eventProxy == null)
        throw new RuntimeException("eventProxy cannot be null.");
    if (eventConfDao == null)
        throw new RuntimeException("eventConfDao cannot be null.");
    if (dataCollectionDao == null)
        throw new RuntimeException("dataCollectionDao cannot be null.");

    final HorizontalSplitPanel mainPanel = new HorizontalSplitPanel();
    final MibConsolePanel mibConsole = new MibConsolePanel();
    final MibCompilerPanel mibPanel = new MibCompilerPanel(dataCollectionDao, eventConfDao, eventProxy,
            mibParser, mibConsole);/*from w  ww  .  j  a va  2 s.c o  m*/

    mainPanel.setSizeFull();
    mainPanel.setSplitPosition(25, Unit.PERCENTAGE);
    mainPanel.addComponent(mibPanel);
    mainPanel.addComponent(mibConsole);

    setContent(mainPanel);
}

From source file:org.ow2.sirocco.cloudmanager.MyUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {
    this.userName = request.getUserPrincipal().getName();
    this.identityContext.setUserName(this.userName);

    this.getPage().setTitle("Sirocco Dashboard");
    final VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();//w  w  w  .j  av a2s  . c  o  m
    this.setContent(layout);

    // Top header *********************
    HorizontalLayout header = new HorizontalLayout();
    header.setMargin(true);
    header.setWidth("100%");
    header.setHeight("70px");
    header.setStyleName("topHeader");

    // logo
    Image image = new Image(null, new ThemeResource("img/sirocco_small_logo.png"));
    header.addComponent(image);

    // spacer
    Label spacer = new Label();
    spacer.setWidth("100%");
    header.addComponent(spacer);
    header.setExpandRatio(spacer, 1.0f);

    HorizontalLayout rightButtons = new HorizontalLayout();
    rightButtons.setStyleName("topHeader");
    rightButtons.setSpacing(true);

    this.userName = request.getUserPrincipal().getName();
    User user = null;
    try {
        user = this.userManager.getUserByUsername(this.userName);
    } catch (CloudProviderException e) {
        e.printStackTrace();
    }

    Label label = new Label("Tenant:");
    label.setStyleName("topHeaderLabel");
    rightButtons.addComponent(label);
    final ComboBox tenantSelect = new ComboBox();
    tenantSelect.setTextInputAllowed(false);
    tenantSelect.setNullSelectionAllowed(false);
    for (Tenant tenant : user.getTenants()) {
        tenantSelect.addItem(tenant.getName());
    }
    tenantSelect.setValue(user.getTenants().iterator().next().getName());
    tenantSelect.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(final ValueChangeEvent event) {
            Notification.show("Switching to tenant " + tenantSelect.getValue());

        }
    });
    tenantSelect.setImmediate(true);
    rightButtons.addComponent(tenantSelect);

    this.tenantId = user.getTenants().iterator().next().getUuid();
    this.identityContext.setTenantId(this.tenantId);

    // logged user name

    label = new Label("Logged in as: " + this.userName);
    label.setStyleName("topHeaderLabel");
    rightButtons.addComponent(label);

    // sign out button
    Button button = new Button("Sign Out");
    // button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(final ClickEvent event) {
            MyUI.this.logout();
        }
    });
    rightButtons.addComponent(button);

    header.addComponent(rightButtons);
    layout.addComponent(header);

    // Split view
    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    splitPanel.setFirstComponent(this.createLeftMenu());

    this.inventoryContainer = new VerticalLayout();
    this.inventoryContainer.setSizeFull();

    this.inventoryContainer.addComponent(this.machineView);

    splitPanel.setSecondComponent(this.inventoryContainer);
    splitPanel.setSplitPosition(15);

    layout.addComponent(splitPanel);
    layout.setExpandRatio(splitPanel, 1.0f);

    this.listenToNotifications();

}

From source file:org.ripla.web.controllers.RiplaBody.java

License:Open Source License

/**
 * Arranges the body window's views (i.e. <code>header</code>,
 * <code>footer</code>, <code>toolbar</code>, <code>menubar</code>,
 * <code>sidebar</code>, <code>content</code>).<br />
 * Subclasses may override for a different arrangement of the views.
 */// ww w  . j av a  2s  .c  o m
protected void initializeLayout() {
    Page.getCurrent().setTitle(application.getAppName());
    if (skin.hasHeader()) {
        final Component lHeader = skin.getHeader(application.getAppName());
        layout.addComponent(lHeader);
        layout.setExpandRatio(lHeader, 0);
    }

    if (skin.hasToolBar()) {
        final Component lToolbar = createToolbar(skin.getToolbarSeparator());
        layout.addComponent(lToolbar);
    }

    if (skin.hasMenuBar()) {
        final Component lMenubar = createMenubar(skin.getMenuBarMedium(), skin.getMenuBar(),
                skin.getSubMenuIcon());
        layout.addComponent(lMenubar);
    }

    final HorizontalSplitPanel lPanel = new HorizontalSplitPanel();
    layout.addComponent(lPanel);
    layout.setExpandRatio(lPanel, 1);
    lPanel.setSplitPosition(10, Unit.PERCENTAGE);
    // lPanel.setHeight(SIZE_UNDEFINED, Unit.PIXELS);
    lPanel.setStyleName("ripla-split"); //$NON-NLS-1$

    sidebar = new VerticalLayout();
    sidebar.setStyleName("ripla-sidebar");
    sidebar.setSizeFull();
    lPanel.setFirstComponent(sidebar);

    content = new VerticalLayout();
    content.setStyleName("ripla-content");
    lPanel.setSecondComponent(content);
    content.setMargin(true);
    lPanel.setSizeFull();

    layout.setSizeFull();
}

From source file:org.s23m.cell.editor.semanticdomain.Editor.java

License:Mozilla Public License

@Override
public void init() {
    EditorController.getInstance().setEditor(this);
    mainWindow = new Window("Gmodel");
    //mainWindow.addComponent(pusher);
    setMainWindow(mainWindow);/*from   ww  w  .j a  v  a  2 s  . c  o  m*/
    setTheme(THEME_NAME);

    initializeGmodelKernel();

    final HorizontalSplitPanel splitter = new HorizontalSplitPanel();
    splitter.setSplitPosition(DEFAULT_L_WIDTH, Sizeable.UNITS_PIXELS);
    mainWindow.setContent(splitter);

    containmentTreePanel = new ContainmentTreePanel(this);
    multitabPanel = new MultitabPanel(this);
    //((VerticalLayout)multitabPanel.getConsole().getParent()).addComponent(pusher);
    splitter.addComponent(containmentTreePanel);
    splitter.addComponent(multitabPanel);
}

From source file:org.sensorhub.ui.AdminUI.java

License:Mozilla Public License

@Override
protected void init(VaadinRequest request) {
    String configClass = null;//from   www. ja  va 2  s. com
    moduleConfigLists.clear();

    // retrieve module config
    try {
        Properties initParams = request.getService().getDeploymentConfiguration().getInitParameters();
        String moduleID = initParams.getProperty(AdminUIModule.SERVLET_PARAM_MODULE_ID);
        uiConfig = (AdminUIConfig) SensorHub.getInstance().getModuleRegistry().getModuleById(moduleID)
                .getConfiguration();
    } catch (Exception e) {
        throw new RuntimeException("Cannot get UI module configuration", e);
    }

    try {
        // load default form builders
        customForms.put(HttpServerConfig.class.getCanonicalName(), HttpServerConfigForm.class);
        customForms.put(StreamStorageConfig.class.getCanonicalName(), GenericStorageConfigForm.class);
        customForms.put(CommConfig.class.getCanonicalName(), CommConfigForm.class);
        customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSServiceConfig", SOSConfigForm.class);
        customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSProviderConfig", SOSConfigForm.class);

        // load custom form builders defined in config
        for (CustomUIConfig customForm : uiConfig.customForms) {
            configClass = customForm.configClass;
            Class<?> clazz = Class.forName(customForm.uiClass);
            customForms.put(configClass, (Class<IModuleConfigForm>) clazz);
            log.debug("Loaded custom form for " + configClass);
        }
    } catch (Exception e) {
        log.error("Error while instantiating form builder for config class " + configClass, e);
    }

    try {
        // load default panel builders
        customPanels.put(SensorConfig.class.getCanonicalName(), SensorAdminPanel.class);
        customPanels.put(StorageConfig.class.getCanonicalName(), StorageAdminPanel.class);

        // load custom panel builders defined in config
        for (CustomUIConfig customPanel : uiConfig.customPanels) {
            configClass = customPanel.configClass;
            Class<?> clazz = Class.forName(customPanel.uiClass);
            customPanels.put(configClass, (Class<IModuleAdminPanel<?>>) clazz);
            log.debug("Loaded custom panel for " + configClass);
        }
    } catch (Exception e) {
        log.error("Error while instantiating panel builder for config class " + configClass, e);
    }

    // register new field converter for interger numbers
    @SuppressWarnings("serial")
    ConverterFactory converterFactory = new DefaultConverterFactory() {
        @Override
        protected <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> findConverter(
                Class<PRESENTATION> presentationType, Class<MODEL> modelType) {
            // Handle String <-> Integer/Short/Long
            if (presentationType == String.class
                    && (modelType == Long.class || modelType == Integer.class || modelType == Short.class)) {
                return (Converter<PRESENTATION, MODEL>) new StringToIntegerConverter() {
                    @Override
                    protected NumberFormat getFormat(Locale locale) {
                        NumberFormat format = super.getFormat(Locale.US);
                        format.setGroupingUsed(false);
                        return format;
                    }
                };
            }
            // Let default factory handle the rest
            return super.findConverter(presentationType, modelType);
        }
    };
    VaadinSession.getCurrent().setConverterFactory(converterFactory);

    // init main panels
    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setMinSplitPosition(300.0f, Unit.PIXELS);
    splitPanel.setMaxSplitPosition(30.0f, Unit.PERCENTAGE);
    splitPanel.setSplitPosition(350.0f, Unit.PIXELS);
    setContent(splitPanel);

    // build left pane
    VerticalLayout leftPane = new VerticalLayout();
    leftPane.setSizeFull();

    // header image and title
    Component header = buildHeader();
    leftPane.addComponent(header);
    leftPane.setExpandRatio(header, 0);

    // toolbar
    Component toolbar = buildToolbar();
    leftPane.addComponent(toolbar);
    leftPane.setExpandRatio(toolbar, 0);

    // accordion with several sections
    Accordion stack = new Accordion();
    stack.setSizeFull();
    VerticalLayout layout;
    Tab tab;

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Sensors");
    tab.setIcon(ACC_TAB_ICON);
    buildModuleList(layout, SensorConfig.class);

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Storage");
    tab.setIcon(ACC_TAB_ICON);
    buildModuleList(layout, StorageConfig.class);

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Processing");
    tab.setIcon(ACC_TAB_ICON);
    buildModuleList(layout, ProcessConfig.class);

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Services");
    tab.setIcon(ACC_TAB_ICON);
    buildModuleList(layout, ServiceConfig.class);

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Clients");
    tab.setIcon(ACC_TAB_ICON);
    buildModuleList(layout, ClientConfig.class);

    layout = new VerticalLayout();
    tab = stack.addTab(layout, "Network");
    tab.setIcon(ACC_TAB_ICON);
    buildNetworkConfig(layout);

    leftPane.addComponent(stack);
    leftPane.setExpandRatio(stack, 1);
    splitPanel.addComponent(leftPane);

    // init config area
    configArea = new VerticalLayout();
    configArea.setMargin(true);
    splitPanel.addComponent(configArea);
}

From source file:org.universAAL.ucc.windows.LicenceWindow.java

public LicenceWindow(UccUI app, ArrayList<License> licenses, AALService aal, UAPP installApp)
        throws IOException {
    res = ResourceBundle.getBundle(base);
    setCaption(res.getString("license.capt"));
    this.app = app;
    this.installingApplication = installApp;
    modus = Arrays.asList(new String[] { res.getString("agree.radio"), res.getString("dontAgree.radio") });
    vl = new VerticalLayout();
    vl.setSizeFull();//from  ww w .  j  a  v a 2s .  c om
    vl.setSpacing(true);
    vl.setMargin(true);
    hp = new HorizontalSplitPanel();
    hp.setSplitPosition(150, Sizeable.UNITS_PIXELS);
    hp.setStyleName(Reindeer.SPLITPANEL_SMALL);
    hp.setLocked(true);

    hp.setSizeFull();
    tree = new Tree();
    tree.setImmediate(true);
    tree.setNullSelectionAllowed(true);
    tree.setNewItemsAllowed(false);
    for (License l : licenses) {
        tree.addItem(l.getAppName());
        tree.setChildrenAllowed(l.getAppName(), true);
        tree.expandItemsRecursively(l.getAppName());
        for (File f : l.getLicense()) {
            tree.addItem(f.getName());
            tree.setParent(f.getName(), l.getAppName());
            tree.setChildrenAllowed(f.getName(), false);
        }
    }
    if (licenses.size() > 0) {
        tree.select(licenses.get(0).getLicense().get(0).getName());
    }
    Panel panel = new Panel();
    panel.setHeight("400px");
    VerticalLayout layout = (VerticalLayout) panel.getContent();
    layout.setSpacing(true);
    layout.setMargin(true);
    for (License l : licenses) {
        if (l.getSlaList().size() > 0) {
            for (File slaFile : l.getSlaList()) {
                FileReader fr = new FileReader(slaFile);
                // SLA makes problems
                BufferedReader reader = new BufferedReader(fr);
                String line = null;
                while ((line = reader.readLine()) != null) {
                    panel.addComponent(new Label(line));
                }
            }
        } else if (l.getLicense().size() > 0) {
            for (File lFile : l.getLicense()) {
                FileReader fr = new FileReader(lFile);
                BufferedReader reader = new BufferedReader(fr);
                String line = null;
                while ((line = reader.readLine()) != null) {
                    panel.addComponent(new Label(line));
                }
            }
        }
    }
    hp.setFirstComponent(tree);
    vl.addComponent(panel);
    setContent(hp);
    op = new OptionGroup("", modus);
    op.setNullSelectionAllowed(false);
    op.select(res.getString("dontAgree.radio"));
    op.setImmediate(true);
    vl.addComponent(op);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    cancel = new Button(res.getString("cancel.button"));
    go = new Button(res.getString("finish.button"));
    go.setEnabled(false);
    hl.addComponent(cancel);
    hl.addComponent(go);
    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT);
    setWidth("700px");
    setHeight("600px");
    setModal(true);
    center();
    hp.setSecondComponent(vl);
    setClosable(false);
    lic = new LicenseController(app, this, licenses, aal, installingApplication);
    tree.addListener(lic);
    op.addListener(lic);
}

From source file:org.vaadin.addons.filterbuilder.FilterBuilderUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("FilterBuilder demo");

    HorizontalSplitPanel content = new HorizontalSplitPanel();
    content.setSizeFull();//from ww  w.java2s  . c  o m

    // Left pane
    leftPane = new VerticalLayout();
    {
        leftPane.setSizeFull();
        leftPane.setMargin(true);
        leftPane.setSpacing(true);

        filterField = new TextField();
        filterField.setInputPrompt("Write your filter here");
        filterField.setIcon(FontAwesome.SEARCH);
        filterField.addStyleName("filter-field inline-icon");
        filterField.setWidth(100, Unit.PERCENTAGE);
        filterField.setTextChangeEventMode(TextField.TextChangeEventMode.LAZY);
        filterField.setTextChangeTimeout(1000);
        filterField.addTextChangeListener(this);
        leftPane.addComponent(filterField);

        filterLabel = new Label();
        filterLabel.setWidth(100, Unit.PERCENTAGE);

        try {
            dataSource = new BeanItemContainer<>(TestCaseBean.class, TestCaseBean.loadMockData());
            dataSource.removeContainerProperty("address");
            dataSource.addNestedContainerProperty("address.country");
            dataSource.addNestedContainerProperty("address.city");
            dataSource.addNestedContainerProperty("address.street");
            dataSource.addNestedContainerProperty("address.address");
        } catch (Exception e) {
            logger.error("Could not load mock data");
        }
        table = new Table(null, dataSource);
        table.setSizeFull();
        table.setVisibleColumns("id", "firstName", "lastName", "jobTitle", "dob", "salary", "address.country",
                "address.city", "address.street", "address.address", "unemployed");
        table.setSelectable(true);
        leftPane.addComponent(table);
        leftPane.setExpandRatio(table, 1);

    }
    content.setFirstComponent(leftPane);

    // Right pane
    rightPane = new TabSheet();
    {
        rightPane.setSizeFull();

        VerticalLayout lastUsedFiltersPane = new VerticalLayout();
        lastUsedFiltersPane.setSizeFull();
        lastUsedFiltersPane.setMargin(true);
        lastUsedFiltersPane.setSpacing(true);
        lastUsedFilters = new IndexedContainer();
        lastUsedFilters.addContainerProperty("filter", String.class, null);
        lastUsedFiltersTable = new Table();
        lastUsedFiltersTable.setSizeFull();
        lastUsedFiltersTable.setContainerDataSource(lastUsedFilters);
        lastUsedFiltersTable.setSortEnabled(false);
        lastUsedFiltersTable.setSelectable(true);
        lastUsedFiltersTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        lastUsedFiltersTable.addItemClickListener(this);

        final Button removeFilterButton = new Button("Remove", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                if (lastUsedFiltersTable.getValue() != null) {
                    lastUsedFilters.removeItem(lastUsedFiltersTable.getValue());
                    lastUsedFiltersTable.setValue(null);
                }
            }
        });
        removeFilterButton.setEnabled(false);
        lastUsedFiltersTable.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                removeFilterButton.setEnabled(lastUsedFiltersTable.getValue() != null);
            }
        });
        lastUsedFiltersPane.addComponents(lastUsedFiltersTable, removeFilterButton);
        lastUsedFiltersPane.setExpandRatio(lastUsedFiltersTable, 1);
        rightPane.addTab(lastUsedFiltersPane).setCaption("Last used filters");

        VerticalLayout dateFormatsPane = new VerticalLayout();
        dateFormatsPane.setMargin(true);
        dateFormats = new IndexedContainer();
        dateFormats.addContainerProperty("format", String.class, null);
        for (SimpleDateFormat dateFormat : FilterBuilder.DATE_FORMATS) {
            final Item item = dateFormats.addItem(dateFormat.toPattern());
            item.getItemProperty("format").setValue(dateFormat.toPattern());
        }
        dateFormatsTable = new Table();
        dateFormatsTable.setWidth(100, Unit.PERCENTAGE);
        dateFormatsTable.setContainerDataSource(dateFormats);
        dateFormatsTable.setSortEnabled(false);
        dateFormatsTable.setSelectable(true);
        dateFormatsTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        dateFormatsPane.addComponent(dateFormatsTable);
        rightPane.addTab(dateFormatsPane).setCaption("Known date formats");
    }
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    content.setSecondComponent(rightPane);
    content.setSplitPosition(80, Unit.PERCENTAGE);

    setContent(content);
    logger.debug("UI initialized");
}

From source file:org.vaadin.artur.declarative.DeclarativeEditor.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    main = new HorizontalSplitPanel();
    editor = new TextArea();
    editor.setSizeFull();/*from   w w w .  j  ava 2  s.c o m*/
    getPage().addUriFragmentChangedListener(new UriFragmentChangedListener() {

        @Override
        public void uriFragmentChanged(UriFragmentChangedEvent event) {
            loadFile(getPage().getUriFragment());
            editorChanged(editor.getValue());
        }
    });
    loadFile(getPage().getUriFragment());
    editor.addTextChangeListener(new TextChangeListener() {

        @Override
        public void textChange(TextChangeEvent event) {
            editorChanged(event.getText());
        }
    });

    Panel editorPanel = new Panel(editor);
    editorPanel.setSizeFull();
    treeHolder = new VerticalLayout();
    treeHolder.setSizeFull();

    main.addComponents(editorPanel, treeHolder);
    main.setSizeFull();

    setContent(main);
    updateTree(editor.getValue());
}

From source file:org.vaadin.example.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);/*from  w w  w . j  a v a2s. co m*/

    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSplitPosition(30);
    window.setContent(horizontalSplitPanel);

    VerticalLayout verticalLayout = new VerticalLayout();

    final PojoOne pojoOne = new PojoOne();
    pojoOne.setName("My pojo one");
    Button button = new Button("Edit pojo one");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            editPojo(pojoOne);
        }
    });
    verticalLayout.addComponent(button);

    final PojoTwo pojoTwo = new PojoTwo();
    button = new Button("Edit pojo two");
    pojoTwo.setName("My second pojo");

    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            editPojo(pojoTwo);
        }
    });
    verticalLayout.addComponent(button);

    horizontalSplitPanel.setFirstComponent(verticalLayout);

    form.setLayout(layout);
    form.setFormFieldFactory(preCreatedFieldsHelper);
    form.setVisible(false);
    horizontalSplitPanel.setSecondComponent(form);

}