Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER

Introduction

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

Prototype

Alignment MIDDLE_CENTER

To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.

Click Source Link

Usage

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getAccLog() {
    HorizontalLayout c = new HorizontalLayout();
    c.setSizeFull();// www .j  a v a  2s.  c om
    Label lb = new Label("No Data Available!");
    c.addComponent(lb);
    c.setMargin(true);
    c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER);
    return c;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getActLog() {
    HorizontalLayout c = new HorizontalLayout();
    c.setSizeFull();/*from w  w  w.j ava2s  .  c om*/
    Label lb = new Label("No Data Available!");
    c.addComponent(lb);
    c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER);
    c.setMargin(true);
    return c;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private void addLinkUserContainer() {

    VerticalLayout cDeletePrompt = new VerticalLayout();
    cPlaceholder.addComponent(cDeletePrompt);
    cPlaceholder.setComponentAlignment(cDeletePrompt, Alignment.MIDDLE_CENTER);
    // cDeletePrompt.setWidth("100%");
    cDeletePrompt.setStyleName("c_link");
    cDeletePrompt.setSpacing(true);/*from  ww  w. ja v  a 2s  . c om*/
    String username = curUser;

    Label lbActivationPrompt = new Label(
            "<span style='text-align: center;'>Please enter Child Username to link to " + username
                    + "'s Account</span>");
    lbActivationPrompt.setContentMode(ContentMode.HTML);
    lbActivationPrompt.setWidth("300px");
    lbActivationPrompt.setStyleName("lb_link_user");

    cDeletePrompt.addComponent(lbActivationPrompt);
    cDeletePrompt.setComponentAlignment(lbActivationPrompt, Alignment.TOP_LEFT);

    VerticalLayout frmDeleteReason = new VerticalLayout();
    frmDeleteReason.setSizeUndefined();
    frmDeleteReason.setSpacing(true);
    frmDeleteReason.setMargin(true);
    cDeletePrompt.addComponent(frmDeleteReason);
    cDeletePrompt.setComponentAlignment(frmDeleteReason, Alignment.TOP_CENTER);

    tFU = new TextField("Child Username");
    tFU.setRequired(true);

    final ComboBox comboUProf = new ComboBox("Select Profile");
    comboUProf.setNullSelectionAllowed(false);
    comboUProf.setRequired(true);
    comboUProf.addItem(8);
    comboUProf.setItemCaption(8, "DEPOSIT_ONLY");

    comboUProf.addItem(9);
    comboUProf.setItemCaption(9, "DEPOSIT_AND_WITHDRAWAL");

    comboUProf.select(8);

    final TextField tFP = new TextField("Parent Account ID");
    tFP.setValue(username);
    tFP.setEnabled(false);

    final TextField tFInitUser = new TextField("Initiating User");
    tFInitUser.setValue(UI.getCurrent().getSession().getAttribute("user").toString());
    tFInitUser.focus();
    tFInitUser.setEnabled(false);

    frmDeleteReason.addComponent(tFU);
    frmDeleteReason.addComponent(comboUProf);
    frmDeleteReason.addComponent(tFP);
    frmDeleteReason.addComponent(tFInitUser);

    HorizontalLayout cPopupBtns = new HorizontalLayout();
    cPopupBtns.setSizeUndefined();
    cPopupBtns.setSpacing(true);

    final Button btnCancel = new Button();
    btnCancel.setIcon(FontAwesome.UNDO);
    btnCancel.setStyleName("btn_link");
    btnCancel.setDescription("Cancel");

    final Button btnSet = new Button("Link");
    btnSet.setDescription("Link specified account.");
    btnSet.setIcon(FontAwesome.LINK);
    cPopupBtns.addComponent(btnSet);
    cPopupBtns.addComponent(btnCancel);
    frmDeleteReason.addComponent(cPopupBtns);

    cDeletePrompt.setComponentAlignment(frmDeleteReason, Alignment.MIDDLE_CENTER);
    btnSet.setClickShortcut(KeyCode.ENTER, null);

    btnSet.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -6318666715385643538L;

        @Override
        public void buttonClick(ClickEvent event) {

            tFU.validate();
            btnSet.setEnabled(false);
            btnCancel.setEnabled(false);

            Button btn = event.getButton();

            if (ums == null)
                ums = new UserManagementService();
            btn.setEnabled(false);

            String strResponse = null;
            try {

                strResponse = UserManagementService.linkUser(tFP.getValue(),
                        new Integer(comboUProf.getValue().toString()), tFInitUser.getValue(), tFU.getValue());

                if (strResponse.equals("The operation was successful and completed")) {

                    updateLinksTable(tFU.getValue());
                    cPlaceholder.setVisible(false);
                    tFU.setValue("");
                    btnLink.setVisible(true);

                    NotifCustom.show("Link", strResponse);

                } else {
                    NotifCustom.show("Link", strResponse);
                }

            } catch (RemoteException e) {

                e.printStackTrace();

            }

            btnSet.setEnabled(true);
            btnCancel.setEnabled(true);

        }
    });

    btnCancel.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 7161821652386306043L;

        @Override
        public void buttonClick(ClickEvent event) {
            btnLink.setVisible(true);
            cPlaceholder.setVisible(false);

        }

    });

}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void duplicateAppointment(Appointment app) {

    InlineDateField date = new InlineDateField();
    //date.setTextFieldEnabled(false);
    date.setLocale(new Locale("es", "ES"));
    date.setResolution(Resolution.MINUTE);
    date.setValue(app.getProgramDateStart().getTime());
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(date);//from   w ww. j a  va  2 s . co  m
    layout.setComponentAlignment(date, Alignment.MIDDLE_CENTER);

    DialogWindow dlgWin = new DialogWindow("Seleccione una fecha", layout, DialogWindow.DialogButton.OK,
            DialogWindow.DialogButton.CANCEL) {

        @Override
        protected void onButtonCancelClicked() {
            this.close();
        }

        @Override
        protected void onButtonOKClicked() {
            java.util.Calendar cal;
            cal = new java.util.Calendar.Builder().build();
            cal.setTime(date.getValue());
            try {
                Appointment newAppointment = appointmentService.duplicate(app, cal);

                Notification success = new PrettyNotification("Cita duplicada correctamente");
                success.show(Page.getCurrent());

                eventBus.post(new DashboardEvent.NotificationsCountUpdatedEvent());
                eventBus.post(new AppointmentUpdatedEvent());
                this.close();

                bind(newAppointment);
            } catch (InstantiationException | IllegalAccessException ex) {
                Logger.getLogger(AppointmentView.class.getName()).log(Level.SEVERE, null, ex);
                Notification.show(ex.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }

    };

    dlgWin.setModal(true);
    dlgWin.setCaption("Seleccione nueva fecha");
    UI.getCurrent().addWindow(dlgWin);
    dlgWin.focus();
}

From source file:com.thingtrack.vaadin.desktop.MyVaadinUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();/* w w w  .jav  a2  s. co  m*/
    mainLayout.setMargin(true);
    setContent(mainLayout);

    mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    textArea = new TextArea();
    textArea.setInputPrompt("Send message");
    mainLayout.addComponent(textArea);

    Button button = new Button("Send");
    button.setImmediate(true);
    button.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            if (publisher == null) {
                publisher = new Publisher();
                publisher.start();
            }

            String message = textArea.getValue();

            try {
                publisher.send(message);
            } catch (MqttException e) {
                Notification.show(e.getMessage(), Type.ERROR_MESSAGE);
            }
        }
    });

    mainLayout.addComponent(button);
}

From source file:com.thingtrack.vaadin.mobile.MyVaadinApplication.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();//from w ww .ja  va 2 s .  c  o  m
    mainLayout.setMargin(true);
    setContent(mainLayout);
    mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    Label loadingText = new Label("MESSAGES RECEIVED: ");
    loadingText.setSizeUndefined();
    mainLayout.addComponent(loadingText);

    Subscriber subscriber = new Subscriber();
    subscriber.start(new MqttCallback() {

        @Override
        public void messageArrived(MqttTopic topic, MqttMessage message) throws Exception {

            System.out
                    .println("Message arrived. Topic: " + topic.getName() + "  Message: " + message.toString());

            Label loadingText = new Label(message.toString());
            loadingText.setSizeUndefined();
            mainLayout.addComponent(loadingText);
        }

        @Override
        public void deliveryComplete(MqttDeliveryToken arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void connectionLost(Throwable arg0) {
            // TODO Auto-generated method stub

        }
    });

}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Adds login form.// w  ww.  ja v  a  2 s.c  o  m
 */
private void addForm() {
    final VerticalLayout form = new VerticalLayout();
    form.setSizeUndefined();
    form.setSpacing(true);
    form.addComponent(this.header());
    form.addComponent(this.content());
    this.addComponent(form);
    this.setComponentAlignment(form, Alignment.MIDDLE_CENTER);
}

From source file:com.trender.user.IndexPageView.java

private void init() {

    verticalLayout = new VerticalLayout();

    studyTreeTable = new TreeTable();
    textLabel = new Label();
    studyTestLable = new Label();
    verticalLayout.addComponent(new Header().intitIngexPageComponent());

    textLabel.setValue("  ?!  ??!!!");
    textLabel.addStyleName("h1");
    textLabel.addStyleName("v-label");
    textLabel.addStyleName("v-label-align-center");
    textLabel.setWidth(100, Unit.PERCENTAGE);
    verticalLayout.addComponent(textLabel);
    verticalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_CENTER);
    studyTestLable.setValue(//from   w w  w .j av a2  s  .  co m
            "  ?  ?? ?  "
                    + "?? ?. ? ?  ???");

    studyTestLable.setWidth(100, Unit.PERCENTAGE);
    studyTestLable.setHeight(21, Unit.PIXELS);
    verticalLayout.addComponent(studyTestLable);
    studyTreeTable.setWidth(636, Unit.PIXELS);
    studyTreeTable.setHeight(273, Unit.PIXELS);
    verticalLayout.addComponent(studyTreeTable);
    verticalLayout.setSizeFull();

    setCompositionRoot(verticalLayout);
    setSizeFull();
}

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    final ConfigComponent configComponent = new ConfigComponent();

    layout.addComponent(new Label("<h1>Vaadin ReCaptcha Add-on Demo</h1>" + "<p>See "
            + "<a href=\"https://developers.google.com/recaptcha/docs/customization\" target=\"_blank\">"
            + "ReCaptcha API" + "</a>" + " to understand theese settings. Or just Press 'SHOW' :)" + "</p>",
            ContentMode.HTML));/*from  www .  j a v  a  2 s  . c  om*/
    layout.addComponent(configComponent);
    layout.setSpacing(true);
    layout.setMargin(true);

    Button showBtn = new Button("SHOW", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            layout.removeAllComponents();
            DummyRegWithReCaptcha dummyRegWithReCaptcha = new DummyRegWithReCaptcha(configComponent);
            layout.addComponent(dummyRegWithReCaptcha);
            layout.setComponentAlignment(dummyRegWithReCaptcha, Alignment.MIDDLE_CENTER);
        }
    });

    layout.addComponent(showBtn);
    setContent(layout);
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildTitle() {
    Label logo = new Label("PFServer <strong>Dashboard</strong>", ContentMode.HTML);
    logo.setSizeUndefined();//  www.  j a va  2  s.  c  om
    HorizontalLayout logoWrapper = new HorizontalLayout(logo);
    logoWrapper.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
    logoWrapper.addStyleName("valo-menu-title");
    return logoWrapper;
}