Example usage for com.vaadin.ui Panel setSizeUndefined

List of usage examples for com.vaadin.ui Panel setSizeUndefined

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:fi.jasoft.draganddrop.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    Panel showcase = new Panel();
    showcase.setSizeUndefined();

    navigator = new Navigator(this, showcase);

    for (DemoView view : views) {
        navigator.addView(view.getViewPath(), view);
    }/*from  www  .java 2 s  . c  om*/

    // default
    openView(views.get(0));

    MenuBar demos = new MenuBar();
    demos.setStyleName(ValoTheme.MENUBAR_BORDERLESS);

    for (final DemoView view : views) {
        demos.addItem(view.getViewCaption(), new Command() {

            @Override
            public void menuSelected(MenuItem selectedItem) {
                openView(view);
            }
        });
    }

    VerticalLayout root = new VerticalLayout(demos, showcase);
    root.setSizeFull();
    root.setExpandRatio(showcase, 1);
    root.setComponentAlignment(showcase, Alignment.MIDDLE_CENTER);
    setContent(root);

    HorizontalLayout sourceWrapperLayout = new HorizontalLayout();
    Label caption = new Label("Source code for example");
    caption.setStyleName("source-caption");
    sourceWrapperLayout.addComponent(caption);

    Panel sourceWrapper = new Panel(codeLabel);
    sourceWrapper.setStyleName(ValoTheme.PANEL_BORDERLESS);
    sourceWrapper.setHeight(getPage().getBrowserWindowHeight() + "px");
    sourceWrapperLayout.addComponent(sourceWrapper);
    sourceWrapperLayout.setExpandRatio(sourceWrapper, 1);

    Toolbox sourceBox = new Toolbox();
    sourceBox.setOrientation(ORIENTATION.RIGHT_CENTER);
    sourceBox.setContent(sourceWrapperLayout);
    sourceBox.setOverflowSize(30);
    root.addComponent(sourceBox);
}

From source file:gui.views.LoginView.java

public void setUp() {

    // Ein Neuer Kommentar fr Git.
    this.setSizeFull();
    final TextField userlogin = new TextField();
    userlogin.setCaption("Username");

    final PasswordField password = new PasswordField();
    password.setCaption("Passwort");

    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(userlogin);//w  ww.  jav  a  2s  .  co m
    layout.addComponent(password);

    Panel panel = new Panel("BitteLogin-Daten eingeben");

    this.addComponent(panel);

    this.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);

    panel.setContent(layout);

    Button buttonLogin = new Button("Login", FontAwesome.SEARCH);
    layout.addComponent(buttonLogin);
    layout.setComponentAlignment(buttonLogin, Alignment.MIDDLE_CENTER);

    panel.setSizeUndefined();

    buttonLogin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            String user = userlogin.getValue();
            String pw = password.getValue();

            LoginControl.controllogin(user, pw);

        }

    });

}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java

License:Open Source License

public AdminAuthView() {

    setSizeFull();/*www  .j  ava2 s  .  c  om*/

    VerticalLayout header = new VerticalLayout();
    header.setSizeFull();

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

    addComponents(header, content);
    setExpandRatio(header, 1);
    setExpandRatio(content, 6);

    welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>");
    welcomeText.setContentMode(ContentMode.HTML);
    welcomeText.setSizeUndefined();
    header.addComponent(welcomeText);
    header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER);

    Panel controlPanel = new Panel("Administrator control panel");
    controlPanel.setSizeUndefined();

    Panel addCoordPanel = new Panel("Create a new coordinator");
    addCoordPanel.setSizeUndefined();

    Panel messagesPanel = new Panel("Administrator messages");
    messagesPanel.setWidth("580px");

    Table adminMessagesTable = new Table();

    adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource());

    adminMessagesTable.setColumnWidth("inputEvent", 180);
    adminMessagesTable.setSizeFull();

    VerticalLayout controlLayout = new VerticalLayout(controlPanel);
    controlLayout.setSizeFull();
    controlLayout.setMargin(false);
    controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER);

    VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel);
    coordOperationsLayout.setSizeFull();
    coordOperationsLayout.setMargin(false);
    coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER);

    /******************************************/
    coordOperationsLayout.setVisible(true); // main layout in the middle
    addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator"
    /******************************************/

    HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel);
    VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable);

    messagesExternalLayout.setSizeFull();
    messagesExternalLayout.setMargin(false);
    messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER);

    messagesInternalLayout.setMargin(false);
    messagesInternalLayout.setSizeFull();
    messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER);

    messagesPanel.setContent(messagesInternalLayout);

    TextField idCoordAdd = new TextField();
    TextField loginCoord = new TextField();
    PasswordField pwdCoord = new PasswordField();

    Label idCaptionAdd = new Label("ID");
    Label loginCaption = new Label("Login");
    Label pwdCaption = new Label("Password");

    idCaptionAdd.setSizeUndefined();
    idCoordAdd.setSizeUndefined();

    loginCaption.setSizeUndefined();
    loginCoord.setSizeUndefined();

    pwdCaption.setSizeUndefined();
    pwdCoord.setSizeUndefined();

    Button validateNewCoord = new Button("Validate");
    validateNewCoord.setClickShortcut(KeyCode.ENTER);
    validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY);

    GridLayout addCoordinatorLayout = new GridLayout(2, 4);
    addCoordinatorLayout.setSpacing(true);
    addCoordinatorLayout.setMargin(true);
    addCoordinatorLayout.setSizeFull();

    addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption,
            pwdCoord);

    addCoordinatorLayout.addComponent(validateNewCoord, 1, 3);

    addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT);

    addCoordPanel.setContent(addCoordinatorLayout);

    content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);

    content.setExpandRatio(controlLayout, 20);
    content.setExpandRatio(coordOperationsLayout, 10);
    content.setExpandRatio(messagesExternalLayout, 28);

    Button addCoordinator = new Button("Add coordinator");
    Button deleteCoordinator = new Button("Delete coordinator");

    addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE);

    VerticalLayout buttons = new VerticalLayout();

    buttons.setMargin(true);
    buttons.setSpacing(true);
    buttons.setSizeFull();

    buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    controlPanel.setContent(buttons);

    buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn);

    /******* DELETE COORDINATOR PANEL BEGIN *********/
    Label idCaptionDel = new Label("ID");
    TextField idCoordDel = new TextField();

    Panel delCoordPanel = new Panel("Delete a coordinator");

    coordOperationsLayout.addComponent(delCoordPanel);
    delCoordPanel.setVisible(false);

    coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER);
    delCoordPanel.setSizeUndefined();

    GridLayout delCoordinatorLayout = new GridLayout(2, 2);
    delCoordinatorLayout.setSpacing(true);
    delCoordinatorLayout.setMargin(true);
    delCoordinatorLayout.setSizeFull();

    Button deleteCoordBtn = new Button("Delete");
    deleteCoordBtn.setClickShortcut(KeyCode.ENTER);
    deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY);

    delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel);

    delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1);

    delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT);
    delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT);

    delCoordPanel.setContent(delCoordinatorLayout);
    /******* DELETE COORDINATOR PANEL END *********/

    /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/

    addCoordinator.addClickListener(event -> {
        if (!addCoordPanel.isVisible()) {
            delCoordPanel.setVisible(false);
            addCoordPanel.setVisible(true);
            idCoordAdd.focus();
        } else
            addCoordPanel.setVisible(false);
    });

    deleteCoordinator.addClickListener(event -> {
        if (!delCoordPanel.isVisible()) {
            addCoordPanel.setVisible(false);
            delCoordPanel.setVisible(true);
            idCoordDel.focus();
        } else
            delCoordPanel.setVisible(false);
    });

    /************************************************* MAIN BUTTONS LOGIC END *************************************************/

    /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/
    validateNewCoord.addClickListener(event -> {

        String currentURL = Page.getCurrent().getLocation().toString();
        int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName);
        String iCrashURL = currentURL.substring(0, strIndexCreator);
        String googleShebang = "#!";
        String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang;

        try {
            sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())),
                    new DtLogin(new PtString(loginCoord.getValue())),
                    new DtPassword(new PtString(pwdCoord.getValue())));

            // open new browser tab with the newly created coordinator console...
            // "_blank" instructs the browser to open a new tab instead of a new window...
            // unhappily not all browsers interpret it correctly,
            // some versions of some browsers might still open a new window instead (notably Firefox)!
            Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank");

        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordAdd.setValue("");
        loginCoord.setValue("");
        pwdCoord.setValue("");

        idCoordAdd.focus();
    });
    /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/
    /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/
    deleteCoordBtn.addClickListener(event -> {
        IcrashSystem sys = IcrashSystem.getInstance();

        try {
            sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue())));
        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordDel.setValue("");
        idCoordDel.focus();
    });
    /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/
}

From source file:org.bubblecloud.ilves.ui.anonymous.login.LoginFlowlet.java

License:Apache License

@SuppressWarnings("serial")
@Override/*from  w  w  w . j  a  va2s . c om*/
public void initialize() {

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    final Company company = getSite().getSiteContext().getObject(Company.class);
    if (company.isOpenIdLogin()) {
        final VerticalLayout mainPanel = new VerticalLayout();
        mainPanel.setCaption(getSite().localize("header-open-id-login"));
        layout.addComponent(mainPanel);
        final HorizontalLayout openIdLayout = new HorizontalLayout();
        mainPanel.addComponent(openIdLayout);
        openIdLayout.setMargin(new MarginInfo(false, false, true, false));
        openIdLayout.setSpacing(true);
        final String returnViewName = "openidlogin";
        final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap();
        for (final String url : urlIconMap.keySet()) {
            openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName));
        }
    }

    try {
        final CustomLayout loginFormLayout = new CustomLayout(
                JadeUtil.parse("/VAADIN/themes/ilves/layouts/login.jade"));
        Responsive.makeResponsive(loginFormLayout);
        loginFormLayout.setCaption(getSite().localize("header-email-and-password-login"));
        layout.addComponent(loginFormLayout);
    } catch (final IOException e) {
        throw new SiteException("Error loading login form.", e);
    }

    if (company.isSelfRegistration()) {
        final Button registerButton = new Button(getSite().localize("button-register") + " >>");
        registerButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(RegisterFlowlet.class);
            }
        });
        layout.addComponent(registerButton);
    }

    if (company.isEmailPasswordReset()) {
        final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>");
        forgotPasswordButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(ForgotPasswordFlowlet.class);
            }
        });
        layout.addComponent(forgotPasswordButton);
    }

    final Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(layout);

    setViewContent(panel);

}

From source file:org.bubblecloud.ilves.ui.anonymous.login.RegisterFlowlet.java

License:Apache License

@Override
public void initialize() {
    originalPasswordProperty = new ObjectProperty<String>(null, String.class);
    verifiedPasswordProperty = new ObjectProperty<String>(null, String.class);

    final List<FieldDescriptor> fieldDescriptors = new ArrayList<FieldDescriptor>();

    final PasswordValidator passwordValidator = new PasswordValidator(getSite(), originalPasswordProperty,
            "password2");

    //fieldDescriptors.addAll(SiteFields.getFieldDescriptors(Customer.class));

    for (final FieldDescriptor fieldDescriptor : SiteFields.getFieldDescriptors(Customer.class)) {
        if (fieldDescriptor.getId().equals("adminGroup")) {
            continue;
        }//w  ww .j  a v  a 2s.  com
        if (fieldDescriptor.getId().equals("memberGroup")) {
            continue;
        }
        if (fieldDescriptor.getId().equals("created")) {
            continue;
        }
        if (fieldDescriptor.getId().equals("modified")) {
            continue;
        }
        fieldDescriptors.add(fieldDescriptor);
    }

    //fieldDescriptors.remove(fieldDescriptors.size() - 1);
    //fieldDescriptors.remove(fieldDescriptors.size() - 1);
    fieldDescriptors
            .add(new FieldDescriptor("password1", getSite().localize("input-password"), PasswordField.class,
                    null, 150, null, String.class, null, false, true, true).addValidator(passwordValidator));
    fieldDescriptors.add(new FieldDescriptor("password2", getSite().localize("input-password-verification"),
            PasswordField.class, null, 150, null, String.class, null, false, true, true)
                    .addValidator(new PasswordVerificationValidator(getSite(), originalPasswordProperty)));

    editor = new ValidatingEditor(fieldDescriptors);
    passwordValidator.setEditor(editor);

    final Button registerButton = new Button(getSite().localize("button-register"));
    registerButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    registerButton.addClickListener(new ClickListener() {
        /** The default serial version ID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            editor.commit();
            customer.setCreated(new Date());
            customer.setModified(customer.getCreated());
            final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
            final Company company = getSite().getSiteContext().getObject(Company.class);

            final PostalAddress invoicingAddress = new PostalAddress();
            invoicingAddress.setAddressLineOne("?");
            invoicingAddress.setAddressLineTwo("?");
            invoicingAddress.setAddressLineThree("?");
            invoicingAddress.setCity("?");
            invoicingAddress.setPostalCode("?");
            invoicingAddress.setCountry("?");
            final PostalAddress deliveryAddress = new PostalAddress();
            deliveryAddress.setAddressLineOne("?");
            deliveryAddress.setAddressLineTwo("?");
            deliveryAddress.setAddressLineThree("?");
            deliveryAddress.setCity("?");
            deliveryAddress.setPostalCode("?");
            deliveryAddress.setCountry("?");
            customer.setInvoicingAddress(invoicingAddress);
            customer.setDeliveryAddress(deliveryAddress);

            if (UserDao.getUser(entityManager, company, customer.getEmailAddress()) != null) {
                Notification.show(getSite().localize("message-user-email-address-registered"),
                        Notification.Type.WARNING_MESSAGE);
                return;
            }

            final HttpServletRequest request = ((VaadinServletRequest) VaadinService.getCurrentRequest())
                    .getHttpServletRequest();

            try {
                final byte[] passwordAndSaltBytes = (customer.getEmailAddress() + ":"
                        + ((String) originalPasswordProperty.getValue())).getBytes("UTF-8");
                final MessageDigest md = MessageDigest.getInstance("SHA-256");
                final byte[] passwordAndSaltDigest = md.digest(passwordAndSaltBytes);

                customer.setOwner(company);
                final User user = new User(company, customer.getFirstName(), customer.getLastName(),
                        customer.getEmailAddress(), customer.getPhoneNumber(),
                        StringUtil.toHexString(passwordAndSaltDigest));

                SecurityService.addUser(getSite().getSiteContext(), user,
                        UserDao.getGroup(entityManager, company, "user"));

                if (SiteModuleManager.isModuleInitialized(CustomerModule.class)) {
                    SecurityService.addCustomer(getSite().getSiteContext(), customer, user);
                }

                final String url = company.getUrl() + "#!validate/" + user.getUserId();

                final Thread emailThread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        EmailUtil.send(PropertiesUtil.getProperty("site", "smtp-host"), user.getEmailAddress(),
                                company.getSupportEmailAddress(), "Email Validation",
                                "Please validate your email by browsing to this URL: " + url);
                    }
                });
                emailThread.start();

                LOGGER.info("User registered " + user.getEmailAddress() + " (IP: " + request.getRemoteHost()
                        + ":" + request.getRemotePort() + ")");
                Notification.show(getSite().localize("message-registration-success"),
                        Notification.Type.HUMANIZED_MESSAGE);

                getFlow().back();
            } catch (final Exception e) {
                LOGGER.error("Error adding user. (IP: " + request.getRemoteHost() + ":"
                        + request.getRemotePort() + ")", e);
                Notification.show(getSite().localize("message-registration-error"),
                        Notification.Type.WARNING_MESSAGE);
            }
            reset();
        }
    });

    editor.addListener(new ValidatingEditorStateListener() {
        @Override
        public void editorStateChanged(final ValidatingEditor source) {
            if (source.isValid()) {
                registerButton.setEnabled(true);
            } else {
                registerButton.setEnabled(false);
            }
        }
    });

    reset();

    final VerticalLayout panel = new VerticalLayout();
    panel.addComponent(editor);
    panel.addComponent(registerButton);
    panel.setSpacing(true);

    final HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setMargin(true);
    mainLayout.addComponent(panel);

    final Panel mainPanel = new Panel();
    mainPanel.setSizeUndefined();
    mainPanel.setContent(mainLayout);

    setViewContent(mainPanel);
}

From source file:org.characterbuilder.pages.LoginPage.java

private void addPost(String header, String content, Timestamp timestamp) {
    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(new Label("<h3>" + header + "</h3>", Label.CONTENT_XHTML));
    vl.addComponent(new Label("<p><b>Posted:</b> " + timestamp.toString().substring(0, 16) + "</p>",
            Label.CONTENT_XHTML));

    vl.addComponent(new Label(content, Label.CONTENT_PREFORMATTED));

    Panel p = new Panel(vl);
    p.setSizeUndefined();
    newslayLayout.addComponent(p);//  w w w . j  av a2  s . com
}

From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*w w  w. j a va2 s . co  m*/
public void init() {
    setTheme("topo_default");

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

    m_window = new Window("OpenNMS Topology");
    m_window.setContent(m_rootLayout);
    setMainWindow(m_window);

    m_uriFragUtil = new UriFragmentUtility();
    m_window.addComponent(m_uriFragUtil);
    m_uriFragUtil.addListener(this);

    m_layout = new AbsoluteLayout();
    m_layout.setSizeFull();
    m_rootLayout.addComponent(m_layout);

    if (m_showHeader) {
        HEADER_HEIGHT = 100;
        Panel header = new Panel("header");
        header.setCaption(null);
        header.setSizeUndefined();
        header.addStyleName("onmsheader");
        m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;");

        try {
            CustomLayout customLayout = new CustomLayout(getHeaderLayout());
            header.setContent(customLayout);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        HEADER_HEIGHT = 0;
    }

    Refresher refresher = new Refresher();
    refresher.setRefreshInterval(5000);
    getMainWindow().addComponent(refresher);

    m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm());

    final Property scale = m_graphContainer.getScaleProperty();

    m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, m_selectionManager,
            this);
    m_topologyComponent.setSizeFull();
    m_topologyComponent.addMenuItemStateListener(this);
    m_topologyComponent.addVertexUpdateListener(this);

    final Slider slider = new Slider(0, 1);

    slider.setPropertyDataSource(scale);
    slider.setResolution(1);
    slider.setHeight("300px");
    slider.setOrientation(Slider.ORIENTATION_VERTICAL);

    slider.setImmediate(true);

    final Button zoomInBtn = new Button();
    zoomInBtn.setIcon(new ThemeResource("images/plus.png"));
    zoomInBtn.setDescription("Expand Semantic Zoom Level");
    zoomInBtn.setStyleName("semantic-zoom-button");
    zoomInBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) m_graphContainer.getSemanticZoomLevel();
            szl++;
            m_graphContainer.setSemanticZoomLevel(szl);
            setSemanticZoomLevel(szl);
            saveHistory();
        }
    });

    Button zoomOutBtn = new Button();
    zoomOutBtn.setIcon(new ThemeResource("images/minus.png"));
    zoomOutBtn.setDescription("Collapse Semantic Zoom Level");
    zoomOutBtn.setStyleName("semantic-zoom-button");
    zoomOutBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) m_graphContainer.getSemanticZoomLevel();
            if (szl > 0) {
                szl--;
                m_graphContainer.setSemanticZoomLevel(szl);
                setSemanticZoomLevel(szl);
                saveHistory();
            }

        }
    });

    final Button panBtn = new Button();
    panBtn.setIcon(new ThemeResource("images/cursor_drag_arrow.png"));
    panBtn.setDescription("Pan Tool");
    panBtn.setStyleName("toolbar-button down");

    final Button selectBtn = new Button();
    selectBtn.setIcon(new ThemeResource("images/selection.png"));
    selectBtn.setDescription("Selection Tool");
    selectBtn.setStyleName("toolbar-button");
    selectBtn.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            selectBtn.setStyleName("toolbar-button down");
            panBtn.setStyleName("toolbar-button");
            m_topologyComponent.setActiveTool("select");
        }
    });

    panBtn.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            panBtn.setStyleName("toolbar-button down");
            selectBtn.setStyleName("toolbar-button");
            m_topologyComponent.setActiveTool("pan");
        }
    });

    VerticalLayout toolbar = new VerticalLayout();
    toolbar.setWidth("31px");
    toolbar.addComponent(panBtn);
    toolbar.addComponent(selectBtn);

    HorizontalLayout semanticLayout = new HorizontalLayout();
    semanticLayout.addComponent(zoomInBtn);
    semanticLayout.addComponent(m_zoomLevelLabel);
    semanticLayout.addComponent(zoomOutBtn);
    semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER);

    AbsoluteLayout mapLayout = new AbsoluteLayout();

    mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;");
    mapLayout.addComponent(slider, "top: 5px; left: 20px; z-index:1000;");
    mapLayout.addComponent(toolbar, "top: 324px; left: 12px;");
    mapLayout.addComponent(semanticLayout, "top: 380px; left: 2px;");
    mapLayout.setSizeFull();

    m_treeMapSplitPanel = new HorizontalSplitPanel();
    m_treeMapSplitPanel.setFirstComponent(createWestLayout());
    m_treeMapSplitPanel.setSecondComponent(mapLayout);
    m_treeMapSplitPanel.setSplitPosition(222, Sizeable.UNITS_PIXELS);
    m_treeMapSplitPanel.setSizeFull();

    m_commandManager.addCommandUpdateListener(this);

    menuBarUpdated(m_commandManager);
    if (m_widgetManager.widgetCount() != 0) {
        updateWidgetView(m_widgetManager);
    } else {
        m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition());
    }

    if (m_treeWidgetManager.widgetCount() != 0) {
        updateAccordionView(m_treeWidgetManager);
    }
}

From source file:ru.codeinside.adm.ui.employee.CertificateBlock.java

License:Mozilla Public License

public CertificateBlock(UserItem userItem) {
    this.x509 = userItem.getX509();
    Component root = new HorizontalLayout();
    if (x509 != null) {
        X509Certificate x509Certificate = X509.decode(x509);
        if (x509Certificate != null) {
            HorizontalLayout h = new HorizontalLayout();
            h.setSpacing(true);//from  w w w.  j  ava  2 s.c  om
            h.setMargin(true);
            h.setSizeUndefined();

            NameParts subjectParts = X509.getSubjectParts(x509Certificate);

            Label certLabel = new Label(subjectParts.getShortName());
            h.addComponent(certLabel);
            h.setComponentAlignment(certLabel, Alignment.MIDDLE_CENTER);

            Button remove = new Button("? ?  ?");
            remove.setStyleName(Reindeer.BUTTON_SMALL);
            h.addComponent(remove);
            h.setComponentAlignment(remove, Alignment.MIDDLE_CENTER);

            remove.addListener((Button.ClickListener) new CertificateCleaner(remove, certLabel));

            Panel panel = new Panel();
            panel.setCaption("? ?:");
            panel.setContent(h);
            panel.setSizeUndefined();
            root = panel;
        } else {
            certificateWasRemoved = true;
        }
    }
    setCompositionRoot(root);
    setSizeUndefined();
}

From source file:ru.codeinside.gses.webui.CertificateSelection.java

License:Mozilla Public License

public CertificateSelection(String userLogin, CertificateListener certificateListener) {
    this.certificateListener = certificateListener;

    String userName = StringUtils
            .trimToNull(Flash.flash().getAdminService().findEmployeeByLogin(userLogin).getFio());
    if (userName == null) {
        userName = userLogin;/*from   w  w w .ja  v a 2  s  . c  o m*/
    }

    Label header = new Label(" ?");
    header.setStyleName(Reindeer.LABEL_H1);

    Label hint = new Label("<b>" + userName
            + "</b>, ? ?   ? ?? ? "
            + "   ?,     ??? ? "
            + "<a target='_blank' href='http://ru.wikipedia.org/wiki/"
            + "%D0%AD%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D1%8C'"
            + ">? ?</a></i> ??  .",
            Label.CONTENT_XHTML);

    SignApplet applet = new SignApplet(new Protocol());
    applet.setName(" ?");
    applet.setCaption(null);
    applet.setBindingMode();

    appletHint = new Label("??  <b>Java</b>  "
            + Flash.getActor().getBrowser() + "   <b> JCP</b>.<br/> "
            + "   ?  ?  ?? "
            + "   <a target='_blank' href='http://ca.oep-penza.ru/'"
            + ">??  ?   ?</a>.",
            Label.CONTENT_XHTML);

    Button logout = new Button(" ( ?   )",
            new Logout());
    logout.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    buttons.addComponent(logout);

    VerticalLayout flow = new VerticalLayout();
    flow.setSizeUndefined();
    flow.setMargin(true);
    flow.setSpacing(true);
    flow.addComponent(header);
    flow.addComponent(hint);
    flow.addComponent(applet);
    flow.addComponent(appletHint);
    flow.addComponent(buttons);

    Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(flow);

    VerticalLayout center = new VerticalLayout();
    center.addComponent(panel);
    center.setExpandRatio(panel, 1f);
    center.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    center.setSizeFull();

    setCompositionRoot(center);

    setSizeFull();
}

From source file:xyz.iipster.ui.DefaultIbmiLoginComponent.java

License:Apache License

@Override
public void attach() {
    super.attach();
    final FormLayout fl = new FormLayout();
    fl.setSizeUndefined();//from ww w. j av  a  2 s. c  o m

    userNameTF.setCaption(i18N.get("iipster.login.username.label"));
    //        userNameTF.setRequired(true);
    userNameTF.addStyleName("upper-case");
    userNameTF.setMaxLength(10);
    passwordPF.setCaption(i18N.get("iipster.login.password.label"));
    //        passwordPF.setRequired(true);

    fl.addComponent(userNameTF);
    fl.addComponent(passwordPF);

    final VerticalLayout vl = new VerticalLayout();
    vl.setSizeUndefined();
    vl.addComponent(fl);
    vl.setExpandRatio(fl, 1F);
    vl.setComponentAlignment(fl, Alignment.MIDDLE_CENTER);

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();

    loginButton.setCaption(i18N.get("iipster.login.loginButton.label"));
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    loginButton.addClickListener(event -> {
        if (userNameTF.isEmpty()) {
            Notification.show(i18N.get("iipster.login.username.missing"), Notification.Type.WARNING_MESSAGE);
            userNameTF.focus();
            return;
        }
        if (passwordPF.isEmpty()) {
            Notification.show(i18N.get("iipster.login.password.missing"), Notification.Type.WARNING_MESSAGE);
            passwordPF.focus();
            return;
        }

        try {
            Authentication auth = securityUtils.login(userNameTF.getValue(), passwordPF.getValue());
            eventBus.post(new LoginEvent(auth.getPrincipal().toString()));
        } catch (BadCredentialsException e) {
            Notification.show(i18N.get("iipster.login.bad.credential"), Notification.Type.WARNING_MESSAGE);
        } catch (DisabledException e) {
            Notification.show(i18N.get("iipster.login.disabled"), Notification.Type.WARNING_MESSAGE);
        } catch (CredentialsExpiredException e) {
            changePasswordComponent.setUserName(userNameTF.getValue());
            changePasswordComponent.setCurrentPassword(passwordPF.getValue());
            UI.getCurrent().addWindow(changePasswordComponent);
        } catch (Exception e) {
            Notification.show(i18N.get("iipster.login.error"), Notification.Type.WARNING_MESSAGE);
        }
    });
    hl.addComponent(loginButton);
    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
    vl.setSizeUndefined();

    vl.setMargin(true);
    final Panel panel = new Panel(i18N.get("iipster.login.panel.title"), vl);
    panel.setSizeUndefined();

    rootLayout.addComponent(panel);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    setCompositionRoot(rootLayout);
    setSizeFull();
}