Example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing.

Prototype

public void setSpacing(int spacing) 

Source Link

Document

Sets the amount of spacing between this panel's cells.

Usage

From source file:liber.browse.client.MyDialogBox.java

License:Apache License

/**
 * Creates an empty dialog box specifying its "auto-hide" property. It should
 * not be shown until its child widget has been added using
 * {@link #add(Widget)}./*from w  w  w. j a va  2  s  .  co m*/
 *
 * @param autoHide <code>true</code> if the dialog should be automatically
 *          hidden when the user clicks outside of it
 * @param modal <code>true</code> if keyboard and mouse events for widgets
 *          not contained by the dialog should be ignored
 */
public MyDialogBox(boolean autoHide, boolean modal) {
    super(autoHide, modal);
    dock = new HorizontalPanel();
    dock.add(caption);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(0);
    dock.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

    listener = new DialogListener(this);
    minimiseBtn.addClickListener(listener);
    maximiseBtn.addClickListener(listener);
    closeBtn.addClickListener(listener);

    hp.add(minimiseBtn);
    hp.add(maximiseBtn);
    hp.add(closeBtn);
    dock.add(hp);
    panel.add(dock);

    panel.setHeight("100%");
    panel.setSpacing(0);

    sp = new ScrollPanel();
    panel.add(sp);
    super.setWidget(panel);

    setStyleName("gwt-DialogBox");
    dock.setStyleName("Caption");
    caption.addMouseListener(this);
}

From source file:mcamara.client.TutorialComposite.java

License:Open Source License

/**
 * Instantiates a new tutorial composite.
 *
 * @param idioma the idioma//from  w  w  w.  j  a v  a  2s  .c  om
 */
@SuppressWarnings("deprecation")
public TutorialComposite(String idioma) {
    m = Util.getMensajes(idioma);
    DockPanel dockPanel = new DockPanel();
    initWidget(dockPanel);
    dockPanel.setSize("800", "500");

    panelTitulo = new HorizontalPanel();
    panelTitulo.setSpacing(1);
    panelTitulo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panelTitulo.setBorderWidth(0);
    titulo = new Label("New label");
    titulo.setStyleName("gwt-Label-Titulo");
    titulo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panelTitulo.add(titulo);
    titulo.setWidth("100%");
    dockPanel.add(panelTitulo, DockPanel.NORTH);
    panelTitulo.setWidth("100%");

    itemsMenuPantallas = new ScrollPanel();
    menuPantallas = new VerticalPanel();
    menuPantallas.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    menuPantallas.setSpacing(1);
    menuPantallas.setBorderWidth(1);
    itemsMenuPantallas.add(menuPantallas);
    menuPantallas.setSize("120px", "100%");
    dockPanel.add(itemsMenuPantallas, DockPanel.WEST);
    itemsMenuPantallas.setSize("100%", "100%");

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.setSpacing(5);
    verticalPanel_1.setBorderWidth(0);
    dockPanel.add(verticalPanel_1, DockPanel.CENTER);
    verticalPanel_1.setSize("100%", "100%");

    horizontalPanel = new HorizontalPanel();
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.add(horizontalPanel);
    horizontalPanel.setWidth("80%");

    image = new Image((String) null);
    horizontalPanel.add(image);

    explicacion = new TextArea();
    explicacion.setTextAlignment(TextBoxBase.ALIGN_CENTER);
    explicacion.setEnabled(false);
    explicacion.setVisibleLines(4);
    explicacion.setReadOnly(true);
    explicacion.setAlignment(TextAlignment.LEFT);
    verticalPanel_1.add(explicacion);
    explicacion.setWidth("100%");

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setSpacing(1);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel_1.add(horizontalPanel_1);
    horizontalPanel_1.setWidth("100%");

    continuar = new Button(m.continuar());
    horizontalPanel_1.add(continuar);
}

From source file:mr.davidsanderson.uml.client.impl.EditorPanelImpl.java

License:Apache License

/**
 * /*from w w w  . j  a v a  2  s . c  om*/
 */
@Inject
public EditorPanelImpl(final GraphEventBus graphEventBus, GraphModel model) {
    Log.debug("UMLEditorPanel : start");
    this.model = model;
    graphEventBus.addHandler(eventHandler, GraphEvent.getType());
    // set editor
    this.setSpacing(5);
    this.setSize("100%", "100%");
    this.textArea = new TextArea();
    this.textArea.setSize("100%", "100%");

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    buttonPanel.setSpacing(10);

    Button okBtn = new Button(new HTML("Ok").toString(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            EditorPanelImpl.this.editing = false;
            Log.debug("UMLEditorPanel.okBtn.onClick : fire event close editor");
            graphEventBus.fireEvent(new GraphEvent(origin, GraphEventType.EDITOR_CLOSE));
            Log.debug("UMLEditorPanel.okBtn.onClick : fire content changed");
            graphEventBus.fireEvent(new GraphEvent(origin, textArea.getText(), GraphEventType.CONTENT_CHANGED));
        }
    });
    Button cancelBtn = new Button(new HTML("Cancel").toString(), new ClickHandler() {
        public void onClick(ClickEvent arg0) {
            EditorPanelImpl.this.editing = false;
            Log.debug("UMLEditorPanel.cancelBtn.onClick : fire event close editor");
            graphEventBus.fireEvent(new GraphEvent(origin, GraphEventType.EDITOR_CLOSE));
        }
    });
    buttonPanel.add(okBtn);
    buttonPanel.add(cancelBtn);

    this.add(textArea, DockPanel.CENTER);
    this.add(buttonPanel, DockPanel.SOUTH);
    this.setCellHorizontalAlignment(buttonPanel, DockPanel.ALIGN_CENTER);
    this.setCellVerticalAlignment(buttonPanel, DockPanel.ALIGN_BOTTOM);
    this.setCellHeight(textArea, "99%");
    this.setCellHorizontalAlignment(textArea, DockPanel.ALIGN_LEFT);
    this.setCellVerticalAlignment(textArea, DockPanel.ALIGN_MIDDLE);
}

From source file:mr.davidsanderson.uml.client.impl.MessagePanelImpl.java

License:Apache License

/**
 * @param graphEventBus//from  w ww  . ja v a2 s  .  c  o  m
 */
@Inject
public MessagePanelImpl(final GraphEventBus graphEventBus) {
    this.graphEventBus = graphEventBus;
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    buttonPanel.setSpacing(10);
    Button okBtn = new Button(new HTML("Ok").toString(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {

            Log.debug("MessagePanel.okBtn.onClick : fire event close editor");
            graphEventBus.fireEvent(new GraphEvent(origin, GraphEventType.MSG_CLOSE));
            Log.debug("MessagePanel.okBtn.onClick : fire content changed");
        }
    });
    Button clearBtn = new Button(new HTML("Clear").toString(), new ClickHandler() {
        public void onClick(ClickEvent arg0) {
            Log.debug("MessagePanel.Clear.onClick : clears");
            clear();
        }
    });
    Button helpBtn = new Button(new HTML("Help").toString(), new ClickHandler() {
        public void onClick(ClickEvent arg0) {

            Log.debug("MessagePanel.Help.onClick : show help");
            addMessage(helpTxtStart + helpTextMid + helpTextEnd);
        }
    });
    buttonPanel.add(okBtn);
    buttonPanel.add(clearBtn);
    buttonPanel.add(helpBtn);

    htmlPanel = new HTMLPanel(messagePanelHtml);
    htmlPanel.setSize("100%", "100%");

    this.add(htmlPanel, DockPanel.CENTER);
    this.add(buttonPanel, DockPanel.SOUTH);
    this.setCellHorizontalAlignment(buttonPanel, DockPanel.ALIGN_CENTER);
    this.setCellVerticalAlignment(buttonPanel, DockPanel.ALIGN_BOTTOM);
    this.setCellHeight(htmlPanel, "99%");
    this.setCellHorizontalAlignment(htmlPanel, DockPanel.ALIGN_LEFT);
    this.setCellVerticalAlignment(htmlPanel, DockPanel.ALIGN_MIDDLE);

    addMessage(messageDivStart + "Welcome begin modelling by clicking ok." + messageDivEnd);
}

From source file:net.autosauler.ballance.client.gui.AlertDialog.java

License:Apache License

/**
 * Inits the dialog.//  ww  w.ja v  a2 s .  c  o m
 * 
 * @param message
 *            the message
 * @param additionalinfo
 *            the additionalinfo
 */
private void initDialog(String message, String additionalinfo) {

    setHeading(M.dialog.msgAlertTitle());
    setAnimCollapse(true);
    setAutoHeight(true);
    setAutoWidth(true);
    setBlinkModal(true);
    setClosable(false);
    setDraggable(true);
    setModal(true);
    setShadow(true);
    setButtons(Dialog.OK);
    setHideOnButtonClick(true);

    VerticalPanel vpanel = new VerticalPanel();
    vpanel.setWidth("300px");

    HorizontalPanel qpanel = new HorizontalPanel();
    qpanel.setSpacing(15);
    qpanel.add(new Image(Images.menu.icoExclamation()));
    qpanel.add(new Label(message));
    vpanel.add(qpanel);

    if ((additionalinfo != null) && !additionalinfo.isEmpty()) {
        DisclosurePanel advancedDisclosure = new DisclosurePanel(M.dialog.msgAdditionalInfo());
        advancedDisclosure.setAnimationEnabled(true);
        TextArea textArea = new TextArea();
        textArea.setVisibleLines(10);
        textArea.setText(additionalinfo);
        textArea.setReadOnly(true);
        textArea.setStyleName("AdditionalInfoText");
        advancedDisclosure.setContent(textArea);
        advancedDisclosure.setWidth("100%");
        advancedDisclosure.addStyleName("LeftPadding6");
        vpanel.add(advancedDisclosure);

    }

    this.add(vpanel);

}

From source file:net.autosauler.ballance.client.gui.CommInfoPanel.java

License:Apache License

/**
 * Instantiates a new comm info panel./*from w  w w.j a v  a  2 s .  c  o m*/
 */
public CommInfoPanel() {
    super(false);
    Image i = new Image(Images.menu.icoRefresh());
    Label msg = new Label(M.comm.commInProgress());

    HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("200px");
    panel.setHeight("32px");
    panel.add(i);
    panel.setCellWidth(i, "32px");
    panel.setSpacing(2);
    panel.add(msg);

    setWidget(panel);

    // int width = RootPanel.get().getOffsetWidth();
    // int height = RootPanel.get().getOffsetHeight();

    int width = Window.getClientWidth() - 20;
    int height = Window.getClientHeight() * 3 / 4;

    int x = 250;
    int y = 100;
    if (width > 0) {
        x = width - 320;
    }
    if (height > 0) {
        y = height;
    }
    setPopupPosition(x, y);
}

From source file:net.autosauler.ballance.client.gui.DatabasePanel.java

License:Apache License

/**
 * Instantiates a new database panel./*  ww w.  ja v a 2 s  .com*/
 */
private DatabasePanel() {
    super(new VBoxLayout());

    add(createGlobalScriptPanel());
    add(createDropDatabasePanel());
    add(createDumpDatabasePanel());
    settingspanel = createSettingsPanel();
    add(settingspanel);

    MainPanel.setCommInfo(true);
    Services.database.getSettings(new AsyncCallback<HashMap<String, String>>() {

        @Override
        public void onFailure(Throwable caught) {
            MainPanel.setCommInfo(false);
            settingspanel.clear();
            Label err = new Label(caught.getMessage());
            err.setVisible(false);
            settingspanel.add(err);
            effectAppear(err.getElement());
            Log.error(caught.getMessage());
        }

        @Override
        public void onSuccess(HashMap<String, String> result) {
            MainPanel.setCommInfo(false);
            settings = result;
            settingspanel.clear();

            final Button btn = new Button();
            btn.setText(M.database.btnSoreChanges());
            btn.setEnabled(false);

            settingvalue = new TextBox();
            settingvalue.setWidth("200px");
            settingvalue.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(ChangeEvent event) {
                    btn.setEnabled(true);

                }
            });

            // create celllist
            // ============================================
            ProvidesKey<String> provider = new ProvidesKey<String>() {
                @Override
                public Object getKey(String item) {
                    return item == null ? null : item;
                }
            };

            ListDataProvider<String> dataProvider = new ListDataProvider<String>();
            dataProvider.setList(new ArrayList<String>(settings.keySet()));

            setingsList = new CellList<String>(new TextCell() {
            }, provider);
            setingsList.setPageSize(30);
            setingsList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
            setingsList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);

            // Add a selection model so we can select cells.
            final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(provider);
            setingsList.setSelectionModel(selectionModel);
            selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
                @Override
                public void onSelectionChange(SelectionChangeEvent event) {
                    settingvalue.setText(settings.get(selectionModel.getSelectedObject()));
                }
            });

            dataProvider.addDataDisplay(setingsList);
            // celllist created
            // =======================================================

            btn.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    String name = selectionModel.getSelectedObject();
                    String value = settingvalue.getText().trim();
                    if (!value.isEmpty()) {
                        HashMap<String, String> values = new HashMap<String, String>();
                        values.put(name, value);
                        MainPanel.setCommInfo(true);
                        Services.database.setSettings(values, new AsyncCallback<Void>() {

                            @Override
                            public void onFailure(Throwable caught) {
                                MainPanel.setCommInfo(false);
                                new AlertDialog(caught).show();
                            }

                            @Override
                            public void onSuccess(Void result) {
                                MainPanel.setCommInfo(false);
                                btn.setEnabled(false);
                            }
                        });
                    }

                }
            });

            HorizontalPanel panel = new HorizontalPanel();
            panel.setSpacing(4);
            panel.setWidth("500px");
            panel.setVisible(false);
            panel.add(setingsList);
            panel.setCellWidth(setingsList, "200px");
            panel.add(settingvalue);
            panel.add(btn);
            settingspanel.add(panel);
            effectAppear(panel.getElement());
        }
    });
}

From source file:net.autosauler.ballance.client.gui.DatabasePanel.java

License:Apache License

/**
 * Creates the dump database panel./*from  www. j  a v  a2 s.  c o  m*/
 * 
 * @return the decorator panel
 */
private FieldSet createDumpDatabasePanel() {
    VerticalPanel v = new VerticalPanel();

    HorizontalPanel p = new HorizontalPanel();
    p.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    p.setSpacing(6);
    p.add(new Label(M.database.msgDumpDatabaseTitle()));
    dumpfile = new TextBox(); // TODO: replace with list of old dump files
    p.add(dumpfile);
    btnDumpDatabase = new Button(M.database.btnExecute());
    btnDumpDatabase.addClickHandler(this);
    p.add(btnDumpDatabase);
    v.add(p);

    p = new HorizontalPanel();
    p.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    p.setSpacing(6);
    p.add(new Label(M.database.msgRestoreDatabaseTitle()));
    restorefile = new TextBox();
    p.add(restorefile);
    btnRestoreDatabase = new Button(M.database.btnExecute());
    btnRestoreDatabase.addClickHandler(this);
    p.add(btnRestoreDatabase);
    v.add(p);

    FieldSet fieldSet = new FieldSet();
    fieldSet.add(v);
    return fieldSet;
}

From source file:net.autosauler.ballance.client.gui.EditUserDialog.java

License:Apache License

/**
 * Creates the gui./*  ww w .ja  va2 s  .  c  o m*/
 * 
 */
private void createGUI() {

    if (editlogin == null) {
        setText(M.users.menuAddUser());
    } else {
        setText(M.users.titleEditUser());
    }
    setAnimationEnabled(true);
    setGlassEnabled(true);

    String addText = M.users.btnAdd();
    if (editlogin != null) {
        addText = M.users.btnUpdate();
    }
    Button btnAdd = new Button(addText);

    btnAdd.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (editlogin == null) {
                createUser();
            } else {
                updateUser();
            }
        }

    });

    Button btnCancel = new Button(M.users.btnCancel());
    btnCancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            EditUserDialog.this.hide();

        }

    });

    VerticalPanel vpanel = new VerticalPanel();
    // vpanel.setWidth("400px");

    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);

    layout.setHTML(0, 0, M.users.fullName());
    name = new TextBox();
    name.setText(user.getUsername());
    layout.setWidget(0, 1, name);

    layout.setHTML(1, 0, M.users.login());
    login = new TextBox();
    login.setText(user.getLogin());
    if (editlogin != null) {
        login.setReadOnly(true);
    }
    layout.setWidget(1, 1, login);

    layout.setHTML(2, 0, M.users.password());
    password = new TextBox();
    password.setText("");
    layout.setWidget(2, 1, password);

    layout.setHTML(3, 0, M.users.isactive());
    isactive = new CheckBox();
    isactive.setValue(user.isActive());
    layout.setWidget(3, 1, isactive);

    layout.setHTML(4, 0, M.users.access());

    UserRole role = user.getUserrole();

    FlexTable access = new FlexTable();
    access.setCellSpacing(6);

    access.setHTML(0, 0, M.users.isadmin());
    isadmin = new CheckBox();
    isadmin.setValue(role.isAdmin());
    access.setWidget(0, 1, isadmin);

    access.setHTML(1, 0, M.users.isdocuments());
    isdocuments = new CheckBox();
    isdocuments.setValue(role.isDocuments());
    access.setWidget(1, 1, isdocuments);

    access.setHTML(2, 0, M.users.isfinances());
    isfinances = new CheckBox();
    isfinances.setValue(role.isFinances());
    access.setWidget(2, 1, isfinances);

    access.setHTML(3, 0, M.users.ismanager());
    ismanager = new CheckBox();
    ismanager.setValue(role.isManager());
    access.setWidget(3, 1, ismanager);

    layout.setWidget(4, 1, access);

    vpanel.add(layout);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setWidth("100%");
    buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    HorizontalPanel bcontainer = new HorizontalPanel();
    bcontainer.add(btnAdd);
    bcontainer.add(btnCancel);
    bcontainer.setSpacing(5);
    buttons.add(bcontainer);

    vpanel.add(buttons);

    setWidget(vpanel);
    /*
     * setPopupPosition( (Ballance_autosauler_net.mainpanel.getOffsetWidth()
     * / 2 - 200), 100);
     */
    show();
}

From source file:net.autosauler.ballance.client.gui.LeftMenu.java

License:Apache License

/**
 * Gets the menu item./*w  w  w  .  j ava2 s  .c o m*/
 * 
 * @param text
 *            the text
 * @param tag
 *            the tag
 * @param image
 *            the image
 * @return the menu item
 */
private HorizontalPanel getMenuItem(String text, String tag, ImageResource image) {
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(5);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hPanel.add(new Image(image));
    Hyperlink link = new Hyperlink(text, tag);
    hPanel.add(link);

    return hPanel;
}