Example usage for com.vaadin.ui VerticalLayout setMargin

List of usage examples for com.vaadin.ui VerticalLayout setMargin

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.vaadHL.window.base.BaseWindow.java

License:Apache License

/**
 * Displays the window content in case the window cannot be open due to
 * permissions.//  w ww  .  j a  v a2 s.  c om
 * 
 * @param msg
 *            the message to display.
 */
protected void setNotPermitedContent(String msg) {

    Button btClose = null;
    btClose = new Button(getI18S("btClose"));
    btClose.addClickListener(new ClickListener() {

        private static final long serialVersionUID = -1610492227149824003L;

        @Override
        public void buttonClick(ClickEvent event) {
            BaseWindow.super.close();
        }
    });
    VerticalLayout p = new VerticalLayout();
    p.addComponent(new Label(msg));
    p.addComponent(btClose);
    p.setMargin(true);
    setContent(p);
}

From source file:com.vaadHL.window.base.BaseWindow.java

License:Apache License

/**
 * Creates and sets the content of the window. Uses
 * {@link #getCompositeContent getCompositeContent} for the content
 * creation. Create content but don't bind data.
 *///  w ww.  ja va2  s  .co  m
public void setCompositeContent() {
    Component c = getCompositeContent();
    c.setSizeFull();
    VerticalLayout l = new VerticalLayout();
    l.addComponent(c);
    l.setSizeFull();
    l.setMargin(true);
    setContent(l);
}

From source file:com.wcs.vaadin.userinactivity.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    Label label = new Label("A window will pop up, when no action in " + SESSION_TIMEOUT + " second.");
    label.setStyleName("h1");
    layout.addComponent(label);/* www . j av a 2 s .  c  om*/
    layout.addComponent(new Button("Button"));
    setContent(layout);
    UserInactivityExtension userInactivityExtension = UserInactivityExtension.init(this);
    sessionTimeoutHandler = userInactivityExtension.initSessionTimeoutHandler();
    sessionTimeoutHandler.addTimeoutListener(new SessionTimeoutHandler.SessionTimeoutListener() {

        @Override
        public void timeout() {
            sessionTimeoutHandler.stop();
            openCountDownWindow();
        }
    });
    sessionTimeoutHandler.start(SESSION_TIMEOUT);
    userInactivityExtension.addActionListener(new UserInactivityExtension.ActionListener() {

        @Override
        public void action() {
            if (sessionTimeoutHandler.isRunning()) {
                Notification.show("OK, " + SESSION_TIMEOUT + " seconds from now");
            }
        }
    });
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.ui.ConfirmDialog.java

License:Apache License

private void initForm() {
    VerticalLayout windowLayout = new VerticalLayout();
    setContent(windowLayout);//from  w ww .  j  a  v  a2s.  c om
    windowLayout.setSizeUndefined();
    windowLayout.setMargin(true);
    setCaption(confirmHeader);

    question = new Label(confirmQuestion);
    windowLayout.addComponent(question);

    HorizontalLayout buttonLayout = createButtonLayout();
    windowLayout.addComponent(buttonLayout);
    windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_CENTER);
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStatePanel.java

License:Apache License

private void createLayout() {
    VerticalLayout panelLayout = new VerticalLayout();
    setContent(panelLayout);//from   ww  w  .ja  va 2s  .c  o  m
    panelLayout.setMargin(false);
    currentUploadingLayout = new UploadStateLayout(this);
    panelLayout.addComponent(currentUploadingLayout);
    panelLayout.addComponent(table);
}

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));/*w  w  w  .  j  av  a  2s .c o  m*/
    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.zklogtool.web.components.MainLayout.java

License:Apache License

public MainLayout() {

    buildMainLayout();/*from w ww . j  av  a  2  s  .c  om*/

    setCompositionRoot(mainLayout);

    versionLabel.setValue("zklogtoolwebapp " + projectVersion());

    MenuItem fileMenuItem = menuBar_1.addItem("File", null, null);

    fileMenuItem.addItem("Open transaction log", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("Open transaction log file");
            window.setModal(true);

            OpenTransactionLogFileDialog openFileDialog = new OpenTransactionLogFileDialog(tabSheet_1, window);
            window.setHeight(300, Unit.PIXELS);
            window.setWidth(600, Unit.PIXELS);

            window.setContent(openFileDialog);
            UI.getCurrent().addWindow(window);

        }

    });

    fileMenuItem.addItem("Open snapshot", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("Open snapshot file");
            window.setModal(true);

            OpenSnapshotFileDialog openFileDialog = new OpenSnapshotFileDialog(tabSheet_1, window);
            window.setHeight(250, Unit.PIXELS);
            window.setWidth(600, Unit.PIXELS);

            window.setContent(openFileDialog);
            UI.getCurrent().addWindow(window);

        }

    });

    MenuItem helpMenuItem = menuBar_1.addItem("Help", null, null);

    helpMenuItem.addItem("About", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("About");
            window.setModal(true);

            final VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.setMargin(true);
            verticalLayout.addComponent(new Label("This is zklogtool web front end in development"));

            window.setContent(verticalLayout);
            UI.getCurrent().addWindow(window);

        }

    });

}

From source file:com.zklogtool.web.components.TransactionLogView.java

License:Apache License

public TransactionLogView(final File transactionLogFile, final File snapshotDir, final boolean follow,
        final boolean startFromLast, final TabSheet displayTabSheet, final String name) {
    buildMainLayout();// w w w .  j a  v  a  2 s .  c o m
    setCompositionRoot(mainLayout);

    descriptionLabel.setContentMode(ContentMode.PREFORMATTED);

    final Container container = new IndexedContainer();
    container.addContainerProperty("zxid", String.class, 0);
    container.addContainerProperty("cxid", String.class, 0);
    container.addContainerProperty("client id", String.class, 0);
    //container.addContainerProperty("time", Date.class, 0);
    container.addContainerProperty("operation", ZkOperations.class, "");
    container.addContainerProperty("path", String.class, "");

    reconstructDataTreeButton.setVisible(false);
    filterTable.setContainerDataSource(container);
    filterTable.setFilterBarVisible(true);
    filterTable.setFilterDecorator(new TransactionFilterDecoder());
    filterTable.setSelectable(true);
    filterTable.setImmediate(true);

    final TransactionLog transactionLog;
    final Iterator<Transaction> iterator;
    final Map<String, Transaction> transactionMap = new HashMap<String, Transaction>();

    filterTable.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (filterTable.getValue() == null)
                return;

            StringBuilder description = new StringBuilder();

            TransactionPrinter printer = new TransactionPrinter(description, new UnicodeDecoder());

            printer.print(transactionMap.get("0x" + filterTable.getValue().toString()));

            descriptionLabel.setValue(description.toString());

            if (snapshotDir != null && transactionLogFile.isDirectory()) {

                reconstructDataTreeButton.setVisible(true);

            }

        }
    });

    if (transactionLogFile.isFile()) {

        transactionLog = new TransactionLog(transactionLogFile, new TransactionLogReaderFactory());
    } else {

        transactionLog = new TransactionLog(new DataDirTransactionLogFileList(transactionLogFile),
                new TransactionLogReaderFactory());
    }

    iterator = transactionLog.iterator();

    if (startFromLast) {

        while (iterator.hasNext()) {

            iterator.next();
        }
    }

    final Runnable fillData = new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub

            while (iterator.hasNext()) {

                Transaction t = iterator.next();

                transactionMap.put(Util.longToHexString(t.getTxnHeader().getZxid()), t);

                Item item = container.addItem(Long.toHexString(t.getTxnHeader().getZxid()));
                item.getItemProperty("zxid").setValue(Util.longToHexString(t.getTxnHeader().getZxid()));

                item.getItemProperty("cxid").setValue(Util.longToHexString(t.getTxnHeader().getCxid()));

                item.getItemProperty("client id")
                        .setValue(Util.longToHexString(t.getTxnHeader().getClientId()));

                /*item.getItemProperty("time").setValue(
                 new Date(t.getTxnHeader().getTime()));*/
                switch (t.getTxnHeader().getType()) {

                case OpCode.create:
                    CreateTxn createTxn = (CreateTxn) t.getTxnRecord();
                    item.getItemProperty("operation").setValue(ZkOperations.CREATE);
                    item.getItemProperty("path").setValue(createTxn.getPath());
                    break;

                case OpCode.delete:
                    DeleteTxn deleteTxn = (DeleteTxn) t.getTxnRecord();
                    item.getItemProperty("operation").setValue(ZkOperations.DELTE);
                    item.getItemProperty("path").setValue(deleteTxn.getPath());
                    break;

                case OpCode.setData:
                    SetDataTxn setDataTxn = (SetDataTxn) t.getTxnRecord();
                    item.getItemProperty("operation").setValue(ZkOperations.SET_DATA);
                    item.getItemProperty("path").setValue(setDataTxn.getPath());
                    break;

                case OpCode.setACL:
                    SetACLTxn setACLTxn = (SetACLTxn) t.getTxnRecord();
                    item.getItemProperty("operation").setValue(ZkOperations.SET_ACL);
                    item.getItemProperty("path").setValue(setACLTxn.getPath());
                    break;

                case OpCode.check:
                    CheckVersionTxn checkVersionTxn = (CheckVersionTxn) t.getTxnRecord();
                    item.getItemProperty("operation").setValue(ZkOperations.CHECK);
                    item.getItemProperty("path").setValue(checkVersionTxn.getPath());
                    break;

                case OpCode.multi:
                    item.getItemProperty("operation").setValue(ZkOperations.MULTI);
                    break;

                case OpCode.createSession:
                    item.getItemProperty("operation").setValue(ZkOperations.CREATE_SESSION);
                    break;

                case OpCode.closeSession:
                    item.getItemProperty("operation").setValue(ZkOperations.CLOSE_SESSION);
                    break;

                case OpCode.error:
                    item.getItemProperty("operation").setValue(ZkOperations.ERROR);
                    break;

                }

            }
        }

    };

    fillData.run();

    Thread monitorThread = new Thread(new Runnable() {

        @Override
        public void run() {

            while (true) {
                //push UI
                UI.getCurrent().access(fillData);

                try {
                    Thread.sleep(250);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    });

    if (follow) {
        monitorThread.start();

    }

    reconstructDataTreeButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {

            DataDirHelper dataDirHelper = new DataDirHelper(transactionLogFile, snapshotDir);
            List<File> snapshots = dataDirHelper.getSortedSnapshotList();
            DataDirTransactionLogFileList l = new DataDirTransactionLogFileList(transactionLogFile);
            TransactionLog transactionLog = new TransactionLog(l, new TransactionLogReaderFactory());

            File snapFile = null;
            DataState dataState = null;

            long currentZxid = Long.parseLong(filterTable.getValue().toString(), 16);

            int i = snapshots.size() - 1;
            while (i >= 0) {

                long snapZxid = Util.getZxidFromName(snapshots.get(i).getName());

                if (snapZxid <= currentZxid) {

                    if (i == 0) {
                        snapFile = snapshots.get(0);
                    } else {
                        snapFile = snapshots.get(i - 1);
                    }

                    break;

                }

                i--;

            }

            if (snapFile == null) {
                dispalyNotEnoughDataErrorMessage();
                return;
            }

            long TS = Util.getZxidFromName(snapFile.getName());

            //catch this exception and print error
            SnapshotFileReader snapReader = new SnapshotFileReader(snapFile, TS);

            try {
                dataState = snapReader.restoreDataState(transactionLog.iterator());
            } catch (Exception ex) {
                //dispay error dialog
                //not enough information
                dispalyNotEnoughDataErrorMessage();
                return;
            }

            //set iterator to last zxid
            TransactionIterator iterator = transactionLog.iterator();
            Transaction t;

            do {

                t = iterator.next();

            } while (t.getTxnHeader().getZxid() < TS);

            while (iterator.nextTransactionState() == TransactionState.OK
                    && dataState.getLastZxid() < currentZxid) {
                dataState.processTransaction(iterator.next());
            }

            HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setCaption(name + " at zxid 0x" + Long.toString(currentZxid, 16));
            horizontalLayout.addComponent(new SnapshotView(dataState));
            horizontalLayout.setWidth("100%");
            horizontalLayout.setHeight("100%");
            Tab snapshotTab = displayTabSheet.addTab(horizontalLayout);
            snapshotTab.setClosable(true);
            displayTabSheet.setSelectedTab(snapshotTab);

        }

        void dispalyNotEnoughDataErrorMessage() {

            final Window window = new Window("Error");
            window.setModal(true);

            final VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.setMargin(true);
            verticalLayout.addComponent(new Label("Not enough data to reconstruct data tree"));

            window.setContent(verticalLayout);
            UI.getCurrent().addWindow(window);

        }

    });

}

From source file:customcomponent.CustomcomponentUI.java

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);//  www  .jav a2s .com

    Label terms = new Label("You agree with us on everything.");

    Panel panel = new Panel("LICENSE TERMS:");
    panel.setContent(terms);
    layout.addComponent(panel);

    AcceptTermsButton button = new AcceptTermsButton("Yeah right. I do accept that.", "Install");

    button.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("Software installed.");
        }
    });

    layout.addComponent(button);
}

From source file:cz.iivos.todo.dialogs.TaskDlg.java

/**
 * Konstruktor.//from w  ww  . j  a va 2 s  .co  m
 * 
 * @param caption nadpis okna
 * @param sqlCont sqlcontainer na kterm je postavena tabulka s koly.
 * @param item vybran poloka z SQLcontaineru (dek z tabulky).
 * @param lis Listener na obnovu view.
 */
public TaskDlg(String caption, SQLContainer sqlCont, Item item, RenewTodoListener lis) {
    this.listener = lis;
    this.setCaption(caption);
    setModal(true);
    flInputForm = new InputFormLayout<Task>(Task.class, item, sqlCont, this);

    // obsah dialogu
    VerticalLayout content = new VerticalLayout(flInputForm);
    content.setSpacing(true);
    content.setMargin(true);

    setContent(content);
}