Example usage for com.vaadin.ui HorizontalSplitPanel setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.jumpmind.metl.ui.views.ManageView.java

License:Open Source License

@SuppressWarnings("serial")
@PostConstruct/* www  .j  ava 2 s  .  c o m*/
protected void init() {
    viewButton = new Button("View Log");
    viewButton.setEnabled(false);
    viewButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            viewLog(table.getValue());
        }
    });

    VerticalLayout mainTab = new VerticalLayout();
    mainTab.setSizeFull();
    HorizontalLayout header = new HorizontalLayout();
    header.addComponent(viewButton);
    header.setComponentAlignment(viewButton, Alignment.BOTTOM_RIGHT);

    statusSelect = new ComboBox("Status");
    statusSelect.setNewItemsAllowed(false);
    statusSelect.setNullSelectionAllowed(false);
    statusSelect.addItem(ANY);
    statusSelect.setValue(ANY);
    for (ExecutionStatus status : ExecutionStatus.values()) {
        statusSelect.addItem(status.toString());
    }
    ;
    statusSelect.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            refreshUI(getBackgroundData());
        }
    });
    header.addComponent(statusSelect);
    header.setComponentAlignment(statusSelect, Alignment.BOTTOM_RIGHT);

    HorizontalLayout limitLayout = new HorizontalLayout();
    limitLayout.setSpacing(true);
    Label limitLabel = new Label("Limit:");
    limitLayout.addComponent(limitLabel);
    limitLayout.setComponentAlignment(limitLabel, Alignment.MIDDLE_CENTER);
    TextField limitField = new TextField(null, String.valueOf(DEFAULT_LIMIT));
    limitField.setWidth("5em");
    limitField.setImmediate(true);
    limitField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    limitField.setTextChangeTimeout(200);
    limitField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            try {
                limit = Integer.parseInt(event.getText());
            } catch (Exception e) {
            }
            refreshUI(getBackgroundData());
        }
    });
    limitLayout.addComponent(limitField);
    limitLayout.setComponentAlignment(limitField, Alignment.BOTTOM_RIGHT);
    header.addComponent(limitLayout);
    header.setComponentAlignment(limitLayout, Alignment.BOTTOM_RIGHT);
    header.setExpandRatio(limitLayout, 1.0f);

    TextField filterField = new TextField();
    filterField.setInputPrompt("Filter");
    filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.setImmediate(true);
    filterField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filterField.setTextChangeTimeout(200);
    filterField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            executionContainer.removeAllContainerFilters();
            if (!StringUtils.isBlank(event.getText())) {
                executionContainer.addContainerFilter(new MultiPropertyFilter(event.getText(), new String[] {
                        "agentName", "hostName", "flowName", "status", "startTime", "endTime" }));
            }
        }
    });
    header.addComponent(filterField);
    header.setComponentAlignment(filterField, Alignment.BOTTOM_RIGHT);

    header.setSpacing(true);
    header.setMargin(true);
    header.setWidth("100%");
    mainTab.addComponent(header);

    table = new Table();
    table.setContainerDataSource(executionContainer);
    table.setSelectable(true);
    table.setMultiSelect(false);
    table.setSizeFull();
    table.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                viewLog(event.getItemId());
            }
        }
    });
    table.setVisibleColumns(
            new Object[] { "agentName", "deploymentName", "hostName", "status", "startTime", "endTime" });
    table.setColumnHeaders(new String[] { "Agent", "Deployment", "Host", "Status", "Start", "End" });
    table.setSortContainerPropertyId("startTime");
    table.setSortAscending(false);
    table.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            viewButton.setEnabled(table.getValue() != null);
        }
    });
    mainTab.addComponent(table);
    mainTab.setExpandRatio(table, 1.0f);

    tabs = new TabbedPanel();
    tabs.setMainTab("Executions", Icons.EXECUTION, mainTab);

    HorizontalSplitPanel split = new HorizontalSplitPanel();
    split.setSizeFull();
    split.setSplitPosition(AppConstants.DEFAULT_LEFT_SPLIT, Unit.PIXELS, false);

    manageNavigator = new ManageNavigator(FolderType.AGENT, context);
    manageNavigator.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refreshUI(getBackgroundData());
        }
    });
    split.setFirstComponent(manageNavigator);

    VerticalLayout container = new VerticalLayout();
    container.setSizeFull();
    container.addComponent(tabs);
    split.setSecondComponent(container);

    addComponent(split);
    setSizeFull();
    context.getBackgroundRefresherService().register(this);
}

From source file:org.opencms.ui.apps.CmsFileExplorer.java

License:Open Source License

/**
 * @see org.opencms.ui.apps.I_CmsWorkplaceApp#initUI(org.opencms.ui.apps.I_CmsAppUIContext)
 *///from   w  w w  . ja  v  a2s.co  m
public void initUI(I_CmsAppUIContext context) {

    m_appContext = context;
    m_appContext.setMenuDialogContext(
            new CmsExplorerDialogContext(ContextType.appToolbar, m_fileTable, this, null));
    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    sp.setFirstComponent(m_fileTree);
    CmsFileExplorerSettings settings;
    try {
        settings = OpenCms.getWorkplaceAppManager().getAppSettings(A_CmsUI.getCmsObject(),
                CmsFileExplorerSettings.class);

        m_fileTable.setTableState(settings);
    } catch (Exception e) {
        LOG.error("Error while reading file explorer settings from user.", e);
    }
    sp.setSecondComponent(m_fileTable);

    sp.setSplitPosition(LAYOUT_SPLIT_POSITION, Unit.PIXELS);

    context.setAppContent(sp);
    context.showInfoArea(true);
    HorizontalLayout inf = new HorizontalLayout();
    inf.setSizeFull();
    inf.setSpacing(true);
    inf.setMargin(true);
    m_siteSelector.setWidth("379px");
    inf.addComponent(m_siteSelector);
    CssLayout crumbWrapper = new CssLayout();
    crumbWrapper.setSizeFull();
    crumbWrapper.setPrimaryStyleName(OpenCmsTheme.CRUMB_WRAPPER);
    crumbWrapper.addComponent(m_crumbs);

    m_infoPath.setWidth("100%");
    crumbWrapper.addComponent(m_infoPath);
    inf.addComponent(crumbWrapper);
    inf.setExpandRatio(crumbWrapper, 1);

    m_searchField.setWidth("200px");
    inf.addComponent(m_searchField);
    context.setAppInfo(inf);

    initToolbarButtons(context);
    m_fileTable.updateColumnWidths(A_CmsUI.get().getPage().getBrowserWindowWidth() - LAYOUT_SPLIT_POSITION);
}

From source file:org.opencms.ui.apps.search.CmsSourceSearchApp.java

License:Open Source License

/**
 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getComponentForState(java.lang.String)
 *///w  w  w  .j  av a  2  s  . c  o m
@Override
protected Component getComponentForState(String state) {

    m_rootLayout.setMainHeightFull(true);
    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    m_searchForm = new CmsSourceSearchForm(this);
    sp.setFirstComponent(m_searchForm);
    m_resultTable = new CmsFileTable(null);
    m_resultTable.applyWorkplaceAppSettings();
    m_resultTable.setContextProvider(new I_CmsContextProvider() {

        /**
         * @see org.opencms.ui.apps.I_CmsContextProvider#getDialogContext()
         */
        public I_CmsDialogContext getDialogContext() {

            CmsFileTableDialogContext context = new CmsFileTableDialogContext(
                    CmsProjectManagerConfiguration.APP_ID, ContextType.fileTable, m_resultTable,
                    m_resultTable.getSelectedResources());
            storeCurrentFileSelection(m_resultTable.getSelectedResources());
            context.setEditableProperties(CmsFileExplorer.INLINE_EDIT_PROPERTIES);
            return context;
        }
    });
    m_resultTable.setSizeFull();
    m_resultTableFilter = new TextField();
    m_resultTableFilter.setIcon(FontOpenCms.FILTER);
    m_resultTableFilter.setInputPrompt(
            Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
    m_resultTableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    m_resultTableFilter.setWidth("200px");
    m_resultTableFilter.addTextChangeListener(new TextChangeListener() {

        private static final long serialVersionUID = 1L;

        public void textChange(TextChangeEvent event) {

            m_resultTable.filterTable(event.getText());

        }
    });
    m_infoLayout.addComponent(m_resultTableFilter);

    sp.setSecondComponent(m_resultTable);
    sp.setSplitPosition(CmsFileExplorer.LAYOUT_SPLIT_POSITION, Unit.PIXELS);

    if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(state)) {
        CmsSearchReplaceSettings settings = getSettingsFromState(state);
        if (settings != null) {
            m_currentState = state;
            m_searchForm.initFormValues(settings);
            search(settings, false);
        }
    }
    return sp;
}

From source file:org.opennms.features.vaadin.app.TopologyWidgetTestApplication.java

License:Open Source License

@Override
public void init() {
    //This timer is a hack at the moment to disable and enable menuItems
    m_timer.scheduleAtFixedRate(new TimerTask() {

        @Override/* w w w .j  a v a  2  s .  c  o  m*/
        public void run() {
            List<MenuItem> items = m_menuBar.getItems();
            for (MenuItem item : items) {
                if (item.getText().equals("Device")) {
                    List<MenuItem> children = item.getChildren();
                    for (MenuItem child : children) {
                        if (m_graphContainer.getSelectedVertexIds().size() > 0) {
                            if (!child.isEnabled()) {
                                child.setEnabled(true);
                            }
                        } else {
                            if (child.isEnabled()) {
                                child.setEnabled(false);
                            }

                        }
                    }

                }
            }
        }
    }, 1000, 1000);

    m_commandManager.addCommand(new Command("Redo Layout") {
        ;

        @Override
        public void doCommand(Object target) {
            m_graphContainer.redoLayout();
        }

        @Override
        public boolean appliesToTarget(Object target) {
            //Applies to background as a whole
            return target == null;
        }
    }, true);

    m_commandManager.addCommand(new Command("Open") {

        @Override
        public void doCommand(Object target) {
            m_graphContainer.load("graph.xml");
        }

    }, false, "File");

    m_commandManager.addCommand(new Command("Save") {

        @Override
        public void doCommand(Object target) {
            m_graphContainer.save("graph.xml");
        }

    }, false, "File");

    m_commandManager.addCommand(new Command("Add Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                addRandomVertex();
            } else {
                connectNewVertexTo(vertexId.toString(), SERVER_ICON);
            }
            m_graphContainer.redoLayout();
        }

    }, true, "File");

    m_commandManager.addCommand(new Command("Lock") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            if (m_graphContainer.getVertexContainer().containsId(itemId)) {
                Item v = m_graphContainer.getVertexContainer().getItem(itemId);
                return !(Boolean) v.getItemProperty("locked").getValue();
            }
            return false;
        }

        @Override
        public void doCommand(Object vertexId) {
            Item v = m_graphContainer.getVertexContainer().getItem(vertexId);
            v.getItemProperty("locked").setValue(true);
        }

    }, true);

    m_commandManager.addCommand(new Command("Unlock") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            if (m_graphContainer.getVertexContainer().containsId(itemId)) {
                Item v = m_graphContainer.getVertexContainer().getItem(itemId);
                return (Boolean) v.getItemProperty("locked").getValue();
            }
            return false;
        }

        @Override
        public void doCommand(Object vertexId) {
            Item v = m_graphContainer.getVertexContainer().getItem(vertexId);
            v.getItemProperty("locked").setValue(false);
        }

    }, true);
    m_commandManager.addCommand(new Command("Add Switch Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                addRandomVertex();
            } else {
                connectNewVertexTo(vertexId.toString(), SWITCH_ICON);
            }
            m_graphContainer.redoLayout();
        }

    }, true);

    m_commandManager.addCommand(new Command("Remove Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                System.err.println("need to handle selection!!!");
            } else {
                m_graphContainer.removeVertex(vertexId.toString());
                m_graphContainer.redoLayout();
            }
        }

    }, true, "File");

    m_commandManager.addCommand(new Command("Connect") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return m_graphContainer.getSelectedVertexIds().size() == 2;
        }

        @Override
        public void doCommand(Object unused) {
            List<Object> endPoints = new ArrayList<Object>(m_graphContainer.getSelectedVertexIds());

            m_graphContainer.connectVertices(m_graphContainer.getNextEdgeId(), (String) endPoints.get(0),
                    (String) endPoints.get(1));
        }

    }, true, "File");
    m_commandManager.addCommand(new Command("Create Group") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return m_graphContainer.getSelectedVertexIds().size() > 0;
        }

        @Override
        public void doCommand(Object vertexId) {
            String groupId = m_graphContainer.getNextGroupId();
            m_graphContainer.addGroup(groupId, GROUP_ICON);
            m_graphContainer.getVertexContainer().setParent(groupId, ROOT_GROUP_ID);

            for (Object itemId : m_graphContainer.getSelectedVertexIds()) {
                m_graphContainer.getVertexContainer().setParent(itemId, groupId);
            }
        }

    }, true, "Edit");

    m_commandManager.addCommand(new Command("Manual Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new ManualLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Balloon Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new BalloonLayoutAlgorithm(CENTER_VERTEX_ID));
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Circle Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new CircleLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("DAG Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new DAGLayoutAlgorithm(CENTER_VERTEX_ID));
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Radial Tree Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new RadialTreeLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");
    m_commandManager.addCommand(new Command("Tree Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new TreeLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Simple Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new SimpleLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Spring Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new SpringLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("KK Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("ISOM Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new ISOMLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("FR Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Other Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new AlternativeLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Reset") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {

            resetView();
        }

    }, false, null);

    m_commandManager.addCommand(new Command("History") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            showHistoryList(m_commandManager.getHistoryList());
        }

    }, false, null);

    m_commandManager.addCommand(new Command("Show Map") {

        @Override
        public void doCommand(Object target) {
            getMainWindow().showNotification("This has not been implemented yet");

        }

    }, false, "View");

    m_commandManager.addCommand(new Command("Get Info") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getEdgeContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object target) {
            getMainWindow().showNotification("This has not been implemented yet");
        }

    }, true, "Device");

    AbsoluteLayout layout = new AbsoluteLayout();
    layout.setSizeFull();

    m_window = new Window("Topology Widget Test");
    m_window.setContent(layout);
    setMainWindow(m_window);

    m_graphContainer.addGroup(ROOT_GROUP_ID, GROUP_ICON);
    m_graphContainer.addVertex(CENTER_VERTEX_ID, 50, 50, SERVER_ICON);
    m_graphContainer.getVertexContainer().setParent(CENTER_VERTEX_ID, ROOT_GROUP_ID);
    m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm());

    m_topologyComponent = new TopologyComponent(m_graphContainer);
    m_commandManager.addActionHandlers(m_topologyComponent);
    m_topologyComponent.setSizeFull();

    final Property scale = m_graphContainer.getProperty("scale");
    final Slider slider = new Slider(1, 4);
    slider.setResolution(2);
    slider.setHeight("300px");
    slider.setOrientation(Slider.ORIENTATION_VERTICAL);

    slider.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            scale.setValue((Double) slider.getValue());
        }
    });

    slider.setImmediate(true);

    m_tree = createTree();
    Label semanticZoomLabel = new Label();
    final Property zoomLevel = m_graphContainer.getProperty("semanticZoomLevel");
    semanticZoomLabel.setPropertyDataSource(zoomLevel);

    Button zoomInBtn = new Button("Zoom In");
    zoomInBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) zoomLevel.getValue();
            szl++;
            zoomLevel.setValue(szl);
            m_graphContainer.redoLayout();
        }
    });

    Button zoomOutBtn = new Button("Zoom Out");
    zoomOutBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) zoomLevel.getValue();
            szl--;
            zoomLevel.setValue(szl);
            m_graphContainer.redoLayout();
        }
    });

    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setWidth("100%");
    vLayout.setHeight("100%");
    vLayout.addComponent(m_tree);

    AbsoluteLayout mapLayout = new AbsoluteLayout();

    mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;");
    mapLayout.addComponent(slider, "top: 20px; left: 20px; z-index:1000;");
    mapLayout.addComponent(semanticZoomLabel, "bottom: 10px; right: 10px; z-index: 2000;");
    mapLayout.setSizeFull();

    HorizontalSplitPanel treeMapSplitPanel = new HorizontalSplitPanel();
    treeMapSplitPanel.setFirstComponent(vLayout);
    treeMapSplitPanel.setSecondComponent(mapLayout);
    treeMapSplitPanel.setSplitPosition(100, Sizeable.UNITS_PIXELS);
    treeMapSplitPanel.setSizeFull();

    VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel();
    bottomLayoutBar.setFirstComponent(treeMapSplitPanel);

    VerticalLayout zoomLayout = new VerticalLayout();
    zoomLayout.addComponent(zoomInBtn);
    zoomLayout.addComponent(zoomOutBtn);

    bottomLayoutBar.setSecondComponent(zoomLayout);
    bottomLayoutBar.setSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
    bottomLayoutBar.setSizeFull();

    m_menuBar = m_commandManager.getMenuBar();
    m_menuBar.setWidth("100%");
    layout.addComponent(m_menuBar, "top: 0px; left: 0px; right:0px;");
    layout.addComponent(bottomLayoutBar, "top: 23px; left: 0px; right:0px; bottom:0px;");

}

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  w  w  .j a v  a2 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();/* www .  j a v  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.
 *//*from   ww  w .  j a v  a  2  s  .  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.vaadin.addons.filterbuilder.FilterBuilderUI.java

License:Apache License

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

    HorizontalSplitPanel content = new HorizontalSplitPanel();
    content.setSizeFull();

    // Left pane/*  www .j a  v a  2  s .c o  m*/
    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.spring.samples.sidebar.SideBarUI.java

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {
    getPage().setTitle("Vaadin4Spring Side Bar Sample");
    final HorizontalSplitPanel rootLayout = new HorizontalSplitPanel();
    rootLayout.setStyleName(Reindeer.SPLITPANEL_SMALL);
    rootLayout.setSizeFull();
    setContent(rootLayout);//from   w  w  w  .j a va 2s.  c o m

    final Navigator navigator = new Navigator(this, new ViewDisplay() {
        @Override
        public void showView(View view) {
            System.out.println("Showing view " + view);
            rootLayout.setSecondComponent((com.vaadin.ui.Component) view);
        }
    });
    navigator.setErrorView(new ErrorView());
    navigator.addProvider(viewProvider);
    setNavigator(navigator);

    rootLayout.setFirstComponent(sideBar);
    rootLayout.setSplitPosition(150, Unit.PIXELS);
}

From source file:pt.yellowduck.ramboia.RamboiaApplication.java

License:Open Source License

private void buildMainLayout() {

    VerticalSplitPanel vSplit = new VerticalSplitPanel();
    vSplit.setSplitPosition(15, Sizeable.UNITS_PERCENTAGE);
    vSplit.setSizeFull();//from   ww w. ja v a2  s. c  o  m

    HorizontalSplitPanel hSplit_top = new HorizontalSplitPanel();
    hSplit_top.setSizeFull();
    hSplit_top.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE);
    hSplit_top.setFirstComponent(viewPlayer);
    hSplit_top.setSecondComponent(viewUpload);
    hSplit_top.setLocked(true);

    vSplit.setFirstComponent(hSplit_top);

    HorizontalSplitPanel hSplit_bottom = new HorizontalSplitPanel();
    hSplit_bottom.setSizeFull();
    hSplit_bottom.setSplitPosition(75, Sizeable.UNITS_PERCENTAGE);
    hSplit_bottom.setFirstComponent(viewLibrary);
    hSplit_bottom.setSecondComponent(viewPlaylist);
    hSplit_bottom.setLocked(true);

    vSplit.setSecondComponent(hSplit_bottom);

    mainWindow.setContent(vSplit);
}