Example usage for com.vaadin.ui HorizontalSplitPanel setSplitPosition

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

Introduction

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

Prototype

public void setSplitPosition(float pos, boolean reverse) 

Source Link

Document

Moves the position of the splitter.

Usage

From source file:annis.gui.SearchUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    super.init(request);

    this.instanceConfig = getInstanceConfig(request);

    getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)");

    queryController = new QueryController(this);

    refresh = new Refresher();
    // deactivate refresher by default
    refresh.setRefreshInterval(-1);//w  ww .j  a v  a  2  s. c o m
    refresh.addListener(queryController);
    addExtension(refresh);

    // always get the resize events directly
    setImmediate(true);

    VerticalLayout mainLayout = new VerticalLayout();
    setContent(mainLayout);

    mainLayout.setSizeFull();
    mainLayout.setMargin(false);

    final ScreenshotMaker screenshot = new ScreenshotMaker(this);
    addExtension(screenshot);

    css = new CSSInject(this);

    HorizontalLayout layoutToolbar = new HorizontalLayout();
    layoutToolbar.setWidth("100%");
    layoutToolbar.setHeight("-1px");

    mainLayout.addComponent(layoutToolbar);
    layoutToolbar.addStyleName("toolbar");
    layoutToolbar.addStyleName("border-layout");

    Button btAboutAnnis = new Button("About ANNIS");
    btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btAboutAnnis.setIcon(new ThemeResource("info.gif"));

    btAboutAnnis.addClickListener(new AboutClickListener());

    btBugReport = new Button("Report Bug");
    btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btBugReport.setDisableOnClick(true);
    btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png"));
    btBugReport.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            screenshot.makeScreenshot();
            btBugReport.setCaption("bug report is initialized...");
        }
    });

    String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail");
    if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${")
            && new EmailValidator("").isValid(bugmail)) {
        this.bugEMailAddress = bugmail;
    }
    btBugReport.setVisible(this.bugEMailAddress != null);

    lblUserName = new Label("not logged in");
    lblUserName.setWidth("-1px");
    lblUserName.setHeight("-1px");
    lblUserName.addStyleName("right-aligned-text");

    btLoginLogout = new Button("Login", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isLoggedIn()) {
                // logout
                Helper.setUser(null);
                Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION);
                updateUserInformation();
            } else {
                showLoginWindow();
            }
        }
    });
    btLoginLogout.setSizeUndefined();
    btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png"));

    Button btOpenSource = new Button("Help us to make ANNIS better!");
    btOpenSource.setStyleName(BaseTheme.BUTTON_LINK);
    btOpenSource.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Window w = new HelpUsWindow();
            w.setCaption("Help us to make ANNIS better!");
            w.setModal(true);
            w.setResizable(true);
            w.setWidth("600px");
            w.setHeight("500px");
            addWindow(w);
            w.center();
        }
    });

    layoutToolbar.addComponent(btAboutAnnis);
    layoutToolbar.addComponent(btBugReport);
    layoutToolbar.addComponent(btOpenSource);
    layoutToolbar.addComponent(lblUserName);
    layoutToolbar.addComponent(btLoginLogout);

    layoutToolbar.setSpacing(true);
    layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER);
    layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setExpandRatio(btOpenSource, 1.0f);

    //HorizontalLayout hLayout = new HorizontalLayout();
    final HorizontalSplitPanel hSplit = new HorizontalSplitPanel();
    hSplit.setSizeFull();

    mainLayout.addComponent(hSplit);
    mainLayout.setExpandRatio(hSplit, 1.0f);

    AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this);

    controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries);
    controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE);
    controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE);
    hSplit.setFirstComponent(controlPanel);

    tutorial = new TutorialPanel();
    tutorial.setHeight("99%");

    mainTab = new TabSheet();
    mainTab.setSizeFull();
    mainTab.addTab(autoGenQueries, "example queries");
    mainTab.addTab(tutorial, "Tutorial");

    queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig);
    mainTab.addTab(queryBuilder, "Query Builder");

    hSplit.setSecondComponent(mainTab);
    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
    hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() {
        @Override
        public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) {
            if (event.isDoubleClick()) {
                if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) {
                    // make small
                    hSplit.setSplitPosition(0.0f, Unit.PIXELS);
                } else {
                    // reset to default width
                    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
                }
            }
        }
    });
    // hLayout.setExpandRatio(mainTab, 1.0f);

    addAction(new ShortcutListener("^Query builder") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(queryBuilder);
        }
    });

    addAction(new ShortcutListener("Tutor^eial") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(tutorial);
        }
    });

    getPage().addUriFragmentChangedListener(this);

    getSession().addRequestHandler(new RequestHandler() {
        @Override
        public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response)
                throws IOException {
            checkCitation(request);

            if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) {
                String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/");
                UUID uuid = UUID.fromString(uuidString);
                IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class);
                if (map == null) {
                    response.setStatus(404);
                } else {
                    IFrameResource res = map.get(uuid);
                    if (res != null) {
                        response.setStatus(200);
                        response.setContentType(res.getMimeType());
                        response.getOutputStream().write(res.getData());
                    }
                }
                return true;
            }

            return false;
        }
    });

    getSession().setAttribute(MediaController.class, new MediaControllerImpl());

    getSession().setAttribute(PDFController.class, new PDFControllerImpl());

    loadInstanceFonts();

    checkCitation(request);
    lastQueriedFragment = "";
    evaluateFragment(getPage().getUriFragment());

    updateUserInformation();
}

From source file:com.esspl.datagen.ui.ExplorerView.java

License:Open Source License

public ExplorerView(final DataGenApplication dataApp, DatabaseSessionManager databaseSessionManager) {
    log.debug("ExplorerView - constructor start");
    dataGenApplication = dataApp;//  w w w  .j  ava2s  .c om

    setCaption("Tables");
    setSizeFull();
    final HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    sp.setLocked(true);

    TableSelectorView tableSelectorView = new TableSelectorView(databaseSessionManager, dataGenApplication);
    tableSelectorView.setDetailsListener(new DetailsListener() {

        @Override
        public void showDetails(Component component) {
            component.setSizeFull();
            sp.setSecondComponent(component);
        }
    });

    sp.setFirstComponent(tableSelectorView);
    sp.setSplitPosition(210, UNITS_PIXELS);
    setCompositionRoot(sp);
}

From source file:com.freebox.engeneering.application.web.common.ApplicationLayout.java

License:Apache License

/**
  * Initializes view layout when system enters 'initView' action state.
  */*from  w  w w.  ja v  a2 s. c o  m*/
  * @param event -  state event.
  */
public void initView(@SuppressWarnings("rawtypes") StateEvent event) {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.setStyleName("main-view");

    final HorizontalSplitPanel leftSplitPanel = new HorizontalSplitPanel();
    leftSplitPanel.setSplitPosition(20, Sizeable.Unit.PERCENTAGE);

    final ComponentContainer leftSideBar = createPlaceholder(StateLayout.LEFT_SIDE_BAR);
    leftSideBar.setSizeFull();
    content.addComponent(leftSideBar, 0);

    final VerticalLayout verticalLayoutContent = new VerticalLayout();
    verticalLayoutContent.setStyleName("freebox-view");
    verticalLayoutContent.addComponent(createPlaceholder(StateLayout.HEADER));
    verticalLayoutContent.setSpacing(true);
    final ComponentContainer layoutContent = createPlaceholder(StateLayout.CONTENT);
    layoutContent.setSizeFull();
    verticalLayoutContent.addComponent(layoutContent);
    verticalLayoutContent.setSizeFull();
    //verticalLayoutContent.addComponent(createPlaceholder(StateLayout.FOOTER));

    verticalLayoutContent.setExpandRatio(layoutContent, 8f);

    content.addComponent(verticalLayoutContent, 1);
    content.setExpandRatio(leftSideBar, 1.0f);
    content.setExpandRatio(verticalLayoutContent, 9f);

    setView(content);
}

From source file:com.garyclayburg.vconsole.VConsole.java

License:Open Source License

protected void init(VaadinRequest vaadinRequest) {
    final Refresher refresher = new Refresher();
    refresher.addListener(new Refresher.RefreshListener() {
        @Override/*  w w w.j a v a  2 s.  c o  m*/
        public void refresh(Refresher refresher) {
            //                log.debug("refreshing UI...");
        }
    });
    addExtension(refresher);

    addStyleName("dashboard-view");
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    searchStatus = new Label("0 users matching: ");
    TextField searchField = new TextField();
    searchField.setInputPrompt("first or last name");
    searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);
    searchField.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            String searchText = event.getText();
            log.debug("search: {}", searchText);
            QUser qUser = new QUser("user");
            long startSearch = System.nanoTime();
            if (searchText.length() > 2) {
                Iterable<User> searchedUsers = autoUserRepo.findAll(qUser.firstname
                        .containsIgnoreCase(searchText).or(qUser.lastname.containsIgnoreCase(searchText)));
                long endSearch = System.nanoTime();
                log.info("Finshed searching for \"{}\" in {} secs", searchText,
                        ((endSearch - startSearch) / 1000000000.0));
                searchStatus.setValue("? users matching: " + searchText);
                updateUserList(searchedUsers, searchText);
            } else if (searchText.equals("*")) {
                Iterable<User> searchedUsers = autoUserRepo.findAll();
                long endSearch = System.nanoTime();
                log.info("Searched for \"{}\" in {} secs", searchText,
                        ((endSearch - startSearch) / 1000000000.0));
                searchStatus.setValue("? users matching: " + searchText);
                updateUserList(searchedUsers, searchText);

            } else {
                log.debug("not enough chars");
                searchStatus.setValue("* for all users...");
            }
        }
    });

    createExceptionWindow("no errors yet...");

    final User finalFirstUser = firstUser;
    policyChangeController.addChangeListener(new PolicyChangeListener() {
        @Override
        public void policyChanged() {
            log.info("policy is changing");
            BeanContainer beanContainer = (BeanContainer) userTable.getContainerDataSource();
            List itemIds = beanContainer.getItemIds();
            boolean refreshedSelected = false;
            for (Object itemId : itemIds) {
                String id = (String) itemId;
                BeanItem item = beanContainer.getItem(itemId);
                log.debug("refreshing user id: " + id);
                User user = (User) item.getBean();
                log.debug("refreshing user: " + user.getFirstname());
                if (userTable.isSelected(itemId)) {
                    refreshUserValues(user);
                    refreshedSelected = true;
                }
            }
            log.debug("forcing table update");
            updateRightClickItems();
            log.debug("forcing table update complete");
            if (!refreshedSelected && finalFirstUser != null) {
                refreshUserValues(finalFirstUser);
            }
            int numErrors = populatePolicyExceptionList(); // this will catch runtime errors not caught during groovy compile
            if (numErrors == 0) {
                showPolicyUpdated();
            }
        }

        @Override
        public void policyException(Throwable e) {
            populatePolicyExceptionList(); //cannot compile operator supplied groovy?
        }
    });
    attributeTable = new Table();
    attributeTable.setSizeFull();
    attributeTable.setSelectable(true);
    attributeTable.setMultiSelect(false);
    attributeTable.setImmediate(true);

    attributesBeanContainer = new BeanContainer<>(GeneratedAttributesBean.class);
    attributesBeanContainer.setBeanIdProperty("attributeName");

    attributeTable.setContainerDataSource(attributesBeanContainer);

    BeanContainer<String, User> userBeanContainer = new BeanContainer<>(User.class);
    userBeanContainer.setBeanIdProperty("id");
    userTable = createUserTable(userBeanContainer);
    userTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            User selectedUser = (User) ((BeanItem) event.getItem()).getBean();
            refreshUserValues(selectedUser);
            populatePolicyExceptionList(); // maybe this user clicked on causes runtime exception in groovy?
        }
    });
    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    splitPanel.setSplitPosition(150, Unit.PIXELS);
    splitPanel.setFirstComponent(userTable);
    splitPanel.setSecondComponent(attributeTable);

    //        MenuBar menuBar = createMenu();

    //        layout.addComponent(menuBar);

    HorizontalLayout top = createTop();
    populatePolicyExceptionList(); //initial check for groovy errors
    layout.addComponent(top);

    layout.addComponent(searchField);
    layout.addComponent(searchStatus);
    layout.addComponent(splitPanel);
    populateItems(firstUser, attributesBeanContainer);

}

From source file:com.m4gik.views.MainView.java

/**
 * @param split/*from   w  w  w.  java  2 s  .com*/
 */
private void addPanelRight(final HorizontalSplitPanel split) {
    right.setSizeFull();
    split.setSecondComponent(right);
    split.setLocked(true);

    right.addTab(buildWelcomeScreen(), "Welcome");
    right.addTab(buildMusic(playerLayout), "Music Player");
    right.addTab(buildLicenseScreen(), "License");
    right.addListener(new Listener() {

        private static final long serialVersionUID = 3585077764011982717L;

        @Override
        public void componentEvent(Event event) {
            if (right.getSelectedTab() == music) {
                split.setSplitPosition(20, Sizeable.Unit.PERCENTAGE);
                split.setLocked(false);
            } else {
                split.setSplitPosition(1, Sizeable.Unit.PIXELS);
                split.setLocked(true);
            }
        }
    });
}

From source file:com.m4gik.views.MainView.java

/**
 * @param root// www.  j  av  a  2s .c  o m
 */
private void addSplitPanel(VerticalLayout root) {
    final HorizontalSplitPanel split = new HorizontalSplitPanel();
    split.setStyleName(Runo.SPLITPANEL_REDUCED);
    split.setSplitPosition(1, Sizeable.Unit.PIXELS);
    split.setLocked(true);
    root.addComponent(split);
    root.setExpandRatio(split, 1);

    addPanelLeft(split);
    addPanelRight(split);
}

From source file:com.mcparland.john.AdjustableLayout.java

License:Apache License

/**
 * Create the editor panel.//  w  w  w  . j  av a2  s. c om
 * 
 * @return the editor panel.
 */
private Component createEditorPanel() {
    SafeHtml safeHtml = SafeHtmlUtils.fromSafeConstant("<b>Help</b> <br />" + LIPSUM);
    HorizontalSplitPanel editorPanel = new HorizontalSplitPanel();
    RichTextArea editor = new RichTextArea();
    editor.setSizeFull();
    editor.setValue(LIPSUM);
    editorPanel.setFirstComponent(editor);
    editorPanel.setSecondComponent(new Label(safeHtml.asString(), ContentMode.HTML));
    editorPanel.setSplitPosition(80, Unit.PERCENTAGE);
    return editorPanel;
}

From source file:com.mycompany.filmupo.Graficos.java

/**
 * Metodo de inicializacion de la clase/*from ww w  .j ava  2 s. c  o  m*/
 *
 * @param vaadinRequest VaadinRequest
 */
@Override
protected void init(VaadinRequest vaadinRequest) {
    try {

        HorizontalLayout v2h2 = new HorizontalLayout();
        v2h2.setMargin(true);

        final VerticalLayout v2h1 = new VerticalLayout();
        v2h1.setMargin(true);

        final VerticalSplitPanel v2 = new VerticalSplitPanel();
        v2.addComponent(v2h2);
        v2.addComponent(v2h1);
        v2.setSplitPosition(22, Unit.PERCENTAGE);
        v2.setLocked(true);

        VerticalLayout v1 = new VerticalLayout();
        v1.setMargin(true);

        HorizontalSplitPanel layout = new HorizontalSplitPanel();
        layout.addComponent(v1);
        layout.addComponent(v2);
        layout.setSplitPosition(28, Unit.PERCENTAGE);

        setContent(layout);

        //Creamos los 3 links de navegacion de la aplicacion y loa aadimos al layout declarado al principio del codigo
        Link pri = new Link("Principal", new ExternalResource("/Principal"));
        Link est = new Link("Graficos", new ExternalResource("/Graficos"));
        Link adm = new Link("Administracin", new ExternalResource("/Admin"));
        v2h2.addComponent(pri);
        v2h2.addComponent(new Label(" / "));
        v2h2.addComponent(est);
        v2h2.addComponent(new Label(" / "));
        v2h2.addComponent(adm);

        final DAO dao = new DAO();
        dao.abrirConexion();

        final List<Pelicula> listaPeliculas = dao.consultarPeliculas();
        final List<Director> listaDirectores = dao.consultarDirectores();
        final List<Actor> listaActores = dao.consultarActores();

        //Creamos un unico arbol que contiene el acceso a las 4 graficas que hemos creado:
        //  - Peliculas segun su duracion
        //  - Peliculas segun su genero
        //  - Numero de peliculas segun actor
        //  - Numero de peliculas segun director
        Tree tree = new Tree("");
        String a = "Estadisticas";
        tree.addItem(a);
        String aa = "Peliculas segn su duracin";
        tree.addItem(aa);
        tree.setParent(aa, a);
        tree.setChildrenAllowed(aa, false);
        String ab = "Peliculas segn su gnero";
        tree.addItem(ab);
        tree.setParent(ab, a);
        tree.setChildrenAllowed(ab, false);
        String ac = "Numero de peliculas segn actor";
        tree.addItem(ac);
        tree.setParent(ac, a);
        tree.setChildrenAllowed(ac, false);
        String ad = "Numero de peliculas segn director";
        tree.addItem(ad);
        tree.setParent(ad, a);
        tree.setChildrenAllowed(ad, false);

        tree.setSelectable(true);
        tree.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                v2h1.removeAllComponents();
                //Grafica de las peliculas segun su duracion
                if (event.getProperty().getValue().toString().contains("duracin")) {
                    Chart chart = new Chart(ChartType.PIE);
                    Configuration conf = chart.getConfiguration();
                    conf.setTitle("Peliculas");
                    conf.setSubTitle("Segn su duracin en minutos");

                    PlotOptionsPie options = new PlotOptionsPie();
                    options.setInnerSize(0);
                    options.setSize("75%");
                    options.setCenter("50%", "50%");
                    conf.setPlotOptions(options);

                    DataSeries series = new DataSeries();
                    for (Pelicula p : listaPeliculas) {
                        series.add(new DataSeriesItem(p.getTitulo(), p.getDuracion()));
                    }
                    conf.addSeries(series);
                    v2h1.addComponent(chart);
                    //Grafica de las peliculas segun su genero
                } else if (event.getProperty().getValue().toString().contains("gnero")) {
                    Chart chart = new Chart(ChartType.COLUMN);
                    chart.setWidth("400px");
                    chart.setHeight("300px");
                    Configuration conf = chart.getConfiguration();
                    conf.setTitle("Peliculas");
                    conf.setSubTitle("Agrupadas segn su gnero");

                    PlotOptionsLine plotOptions = new PlotOptionsLine();
                    plotOptions.setMarker(new Marker(false));
                    conf.setPlotOptions(plotOptions);

                    ListSeries series = new ListSeries("Numero de peliculas");
                    int i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0;
                    try {
                        dao.abrirConexion();
                        i1 = dao.numGeneros("Accin");
                        i2 = dao.numGeneros("Ciencia Ficcin");
                        i3 = dao.numGeneros("Drama");
                        i4 = dao.numGeneros("Romance");
                        i5 = dao.numGeneros("Novela de Suspense");
                    } catch (IllegalAccessException ex) {
                        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (SQLException ex) {
                        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InstantiationException ex) {
                        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    series.addData(i1);
                    series.addData(i2);
                    series.addData(i3);
                    series.addData(i4);
                    series.addData(i5);

                    conf.addSeries(series);

                    XAxis xaxis = new XAxis();
                    xaxis.setTitle("Gnero");
                    xaxis.setCategories("Accin", "Ciencia Ficcin", "Drama", "Romance",
                            "Novela de suspense");
                    conf.addxAxis(xaxis);

                    YAxis yayis = new YAxis();
                    yayis.setTitle("Nmero de peliculas");
                    conf.addyAxis(yayis);

                    v2h1.addComponent(chart);

                    //Grafica de las peliculas segun actor
                } else if (event.getProperty().getValue().toString().contains("actor")) {
                    Chart chart = new Chart(ChartType.PIE);
                    Configuration conf = chart.getConfiguration();
                    conf.setTitle("Actores");
                    conf.setSubTitle("Nmero de peliculas que tienen");

                    PlotOptionsPie options = new PlotOptionsPie();
                    options.setInnerSize(0);
                    options.setSize("75%");
                    options.setCenter("50%", "50%");
                    conf.setPlotOptions(options);

                    DataSeries series = new DataSeries();
                    for (Actor a : listaActores) {
                        int i = 0;
                        try {
                            dao.abrirConexion();
                            i = dao.numPeliculasA(a.getIdActor());
                        } catch (InstantiationException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IllegalAccessException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (SQLException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        series.add(new DataSeriesItem(a.getNombreCompleto(), i));
                    }
                    conf.addSeries(series);

                    v2h1.addComponent(chart);

                    //Grafica del numero de peliculas segun director
                } else if (event.getProperty().getValue().toString().contains("director")) {
                    Chart chart = new Chart(ChartType.PIE);
                    Configuration conf = chart.getConfiguration();
                    conf.setTitle("Directores");
                    conf.setSubTitle("Nmero de peliculas que tienen");

                    PlotOptionsPie options = new PlotOptionsPie();
                    options.setInnerSize(0);
                    options.setSize("75%");
                    options.setCenter("50%", "50%");
                    conf.setPlotOptions(options);

                    DataSeries series = new DataSeries();
                    for (Director d : listaDirectores) {
                        int i = 0;
                        try {
                            dao.abrirConexion();
                            i = dao.numPeliculasD(d.getIdDirector());
                        } catch (InstantiationException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IllegalAccessException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (SQLException ex) {
                            Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        series.add(new DataSeriesItem(d.getNombreCompleto(), i));
                    }
                    conf.addSeries(series);

                    v2h1.addComponent(chart);
                }
            }
        });

        v1.addComponent(tree);

        dao.cerrarConexion();
    } catch (SQLException ex) {
        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.rdonasco.datamanager.view.DataManagerView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSplitPosition(300f, UNITS_PIXELS);

    getListView().getTable().setDataManager(dataManager);
    refreshData();/*  ww  w  .j  a v  a2  s  .  c  om*/
    getListView().setSizeFull();
    splitPanel.setFirstComponent(getListView());

    getDataForm().setSizeFull();
    getDataForm().setDataManager(dataManager);
    getDataForm().setView(this);
    splitPanel.setSecondComponent(getDataForm());

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

    setMargin(false);

    // setup listeners
    getListView().getTable().addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            displaySelectedRecordInTheForm();
        }
    });
}

From source file:com.tapas.evidence.fe.main.MainPresenter.java

License:Apache License

@Override
public void bind() {
    final VerticalLayout mainLayout = this.view.getMainLayout();
    final HorizontalSplitPanel layoutPanel = this.view.getSplitLayout();
    mainLayout.setExpandRatio(layoutPanel, 1.0f);
    layoutPanel.setSplitPosition(25, HorizontalSplitPanel.UNITS_PERCENTAGE);

    componentLocation();//from w  w w .  j a  v a2 s  . c  om
}