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

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

Introduction

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

Prototype

public void setCellHeight(IsWidget w, String height) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:com.openkm.frontend.client.widget.searchresult.SearchFullResult.java

License:Open Source License

/**
 * drawPropertyGroups/*from w  w w. ja  va2 s.  c om*/
 */
private void drawPropertyGroups(final String docPath, final List<GWTPropertyGroup> propertyGroups,
        final HorizontalPanel propertyGroupsPanel) {
    if (propertyGroups.size() > 0) {
        Status status = Main.get().mainPanel.search.searchBrowser.searchResult.status;
        status.setFlag_refreshPropertyGroups();
        final GWTPropertyGroup propertyGroup = propertyGroups.remove(0);
        propertyGroupService.getProperties(docPath, propertyGroup.getName(), false,
                new AsyncCallback<List<GWTFormElement>>() {
                    @Override
                    public void onSuccess(List<GWTFormElement> result) {
                        if (propertyGroupsPanel.getWidgetCount() == 0) {
                            HTML label = new HTML("");
                            label.setStyleName("okm-Security-Title");
                            label.setHeight("15");
                            Image verticalLine = new Image("img/transparent_pixel.gif");
                            verticalLine.setStyleName("okm-Vertical-Line-Border");
                            verticalLine.setSize("2", "100%");
                            VerticalPanel vlPanel = new VerticalPanel();
                            vlPanel.add(label);
                            vlPanel.add(verticalLine);
                            vlPanel.setCellWidth(verticalLine, "7");
                            vlPanel.setCellHeight(verticalLine, "100%");
                            vlPanel.setHeight("100%");
                            propertyGroupsPanel.add(vlPanel);
                            propertyGroupsPanel.setCellHorizontalAlignment(vlPanel, HasAlignment.ALIGN_LEFT);
                            propertyGroupsPanel.setCellWidth(vlPanel, "7");
                            propertyGroupsPanel.setCellHeight(vlPanel, "100%");
                        }

                        Image verticalLine = new Image("img/transparent_pixel.gif");
                        verticalLine.setStyleName("okm-Vertical-Line-Border");
                        verticalLine.setSize("2", "100%");
                        FormManager manager = new FormManager();
                        manager.setFormElements(result);
                        manager.draw(true); // read only !
                        VerticalPanel vPanel = new VerticalPanel();
                        HTML label = new HTML(propertyGroup.getLabel());
                        label.setStyleName("okm-Security-Title");
                        label.setHeight("15");
                        vPanel.add(label);
                        vPanel.add(manager.getTable());
                        propertyGroupsPanel.add(vPanel);
                        propertyGroupsPanel.add(verticalLine);
                        propertyGroupsPanel.setCellVerticalAlignment(vPanel, HasAlignment.ALIGN_TOP);
                        propertyGroupsPanel.setCellHorizontalAlignment(verticalLine, HasAlignment.ALIGN_CENTER);
                        propertyGroupsPanel.setCellWidth(verticalLine, "12");
                        propertyGroupsPanel.setCellHeight(verticalLine, "100%");
                        drawPropertyGroups(docPath, propertyGroups, propertyGroupsPanel);
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                        Main.get().showError("drawPropertyGroups", caught);
                    }
                });
    } else {
        Status status = Main.get().mainPanel.search.searchBrowser.searchResult.status;
        status.unsetFlag_refreshPropertyGroups();
    }
}

From source file:com.risevision.ui.client.common.widgets.colorPicker.ColorPickerMap.java

License:Artistic License

public ColorPickerMap() {
    hue = 0;/*from ww  w.j av  a 2  s  .  c  om*/
    saturation = 100;
    brightness = 100;

    HorizontalPanel panel = new HorizontalPanel();

    // Add the large slider map
    slidermap = new SliderMap(this, SliderBar.Saturation);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this, true, SliderMap.Saturation);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    initWidget(panel);
}

From source file:de.atns.common.gwt.client.composite.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;// www.ja v a2 s  .c o  m
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    String rbgroup = "color" + this.hashCode();
    rbHue = new RadioButton(rbgroup, "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton(rbgroup, "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton(rbgroup, "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton(rbgroup, "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton(rbgroup, "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton(rbgroup, "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("&deg;"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

From source file:de.eckhartarnold.client.GalleryWidget.java

License:Apache License

@Override
public void onResized() {
    Widget parent = getParent();/*from   w  w  w  .j a v  a 2  s.  com*/
    if (parent == null)
        return;
    int width = parent.getOffsetWidth();
    HorizontalPanel row = null;
    int columns = (width - paddingH) / (edgeWidth + paddingH);
    if (columns <= 0)
        columns = 1;
    int rows = thumbnails.size() / columns;
    if (thumbnails.size() % columns != 0)
        rows++;

    if (imageRows != null) {
        if (rows == imageRows.length && imageRows[0].getWidgetCount() == columns) {
            return; // layout did not change!
        }

        for (HorizontalPanel p : imageRows) {
            panel.remove(p);
        }
    }

    imageRows = new HorizontalPanel[rows];

    for (int i = 0; i < thumbnails.size(); i++) {
        if (i % columns == 0) {
            row = new HorizontalPanel();
            row.setStyleName("galleryRow");
            //row.setSpacing(paddingV);
            row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            imageRows[i / columns] = row;
        }
        Image img = thumbnails.get(i);
        if (captions[i].asString().length() > 0) {
            Tooltip.addToWidget(new Tooltip(captions[i]), img); // sometimes wrong tooltip position!?
        }
        row.add(img);
        //int delta = 0;
        //if (paddingH > paddingV) delta = 2*(paddingH-paddingV);
        row.setCellWidth(img, edgeWidth + 2 * paddingH + "px");
        row.setCellHeight(img, edgeHeight + 2 * paddingV + "px");
    }

    for (HorizontalPanel r : imageRows) {
        panel.add(r);
    }
}

From source file:edu.caltech.ipac.firefly.ui.PopupPane.java

private void init(boolean modal, boolean autoHide, HeaderType headerType) {

    content = new SimplePanel();
    if (headerType == HeaderType.TOP) {
        _mainPanel = new VerticalPanel();
        headerWidget = makeTopHeader(header);
        _mainPanel.add(headerWidget);//from w w  w  .  j  a  va2s  .  co  m
        Label sep = new Label();
        sep.setHeight("2px");
        _mainPanel.add(sep);
    } else if (headerType == HeaderType.SIDE) {
        HorizontalPanel hp = new HorizontalPanel();
        headerWidget = makeSideHeader();
        hp.add(headerWidget);
        hp.setCellHeight(headerWidget, "100%");
        hp.addStyleName("tmp1-style");
        Label sep = new Label();
        sep.setWidth("2px");
        hp.add(sep);
        _mainPanel = hp;
    } else {
        _mainPanel = new VerticalPanel();
    }
    _mainPanel.add(content);
    _mainPanel.addStyleName(_ffCss.standardBorder());

    popup = createPopup(modal, autoHide);
    definePopupStyle(modal);
}

From source file:edu.purdue.pivot.skwiki.client.sketch.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;/*from  w ww .ja v  a 2 s  .c  om*/
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickListener(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickListener(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickListener(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickListener(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickListener(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickListener(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyboardListener(this);
    tbHue.addChangeListener(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyboardListener(this);
    tbSaturation.addChangeListener(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyboardListener(this);
    tbBrightness.addChangeListener(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyboardListener(this);
    tbRed.addChangeListener(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyboardListener(this);
    tbGreen.addChangeListener(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyboardListener(this);
    tbBlue.addChangeListener(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyboardListener(this);
    tbHexColor.addChangeListener(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("&deg;"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setChecked(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

From source file:net.auroris.ColorPicker.client.ColorPicker.java

License:GNU Affero Public License

/**
 * Instantiates a new color picker./*  w  w  w  .  j a v a2s.c om*/
 */
public ColorPicker() {
    // UI Drawing
    // ------------------

    hue = 0;
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    final VerticalPanel vp = new VerticalPanel();
    final HorizontalPanel hp = new HorizontalPanel();
    final FlexTable hxTable = new FlexTable();

    vp.add(hxTable);
    vp.add(hp);

    // Add the large slider map
    slidermap = new SliderMap(this);
    hp.add(slidermap);
    hp.setCellWidth(slidermap, "130px");
    hp.setCellHeight(slidermap, "130px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    hp.add(sliderbar);
    hp.setCellWidth(sliderbar, "30px");
    hp.setCellHeight(sliderbar, "130px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("30px");
    colorpreview.setHeight("30px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    final String rbgroup = "color" + this.hashCode();
    rbHue = new RadioButton(rbgroup, "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton(rbgroup, "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton(rbgroup, "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton(rbgroup, "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton(rbgroup, "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton(rbgroup, "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    hxTable.setWidget(0, 0, colorpreview);
    hxTable.getFlexCellFormatter().setColSpan(0, 0, 3);

    // Uncomment this part if we want the rest of textboxes
    // hxTable.setWidget(1, 0, rbHue);
    // hxTable.setWidget(1, 1, tbHue);
    // hxTable.setWidget(1, 2, new HTML("&deg;"));
    // hxTable.setWidget(2, 0, rbSaturation);
    // hxTable.setWidget(2, 1, tbSaturation);
    // hxTable.setText(2, 2, "%");
    // hxTable.setWidget(3, 0, rbBrightness);
    // hxTable.setWidget(3, 1, tbBrightness);
    // hxTable.setText(3, 2, "%");
    // hxTable.setWidget(4, 0, rbRed);
    // hxTable.setWidget(4, 1, tbRed);
    // hxTable.setWidget(5, 0, rbGreen);
    // hxTable.setWidget(5, 1, tbGreen);
    // hxTable.setWidget(6, 0, rbBlue);
    // hxTable.setWidget(6, 1, tbBlue);

    hxTable.setText(0, 1, "# ");
    hxTable.setWidget(0, 2, tbHexColor);
    // table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    // panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(vp);
}

From source file:net.europa13.taikai.web.client.ui.MainPanel.java

License:Open Source License

/**
 * Constructor.//from  w ww .  j a v  a  2 s.  c  o  m
 */
private MainPanel() {

    super("<div id=\"top\"></div>\n<div id=\"middle\"></div>\n<div id=\"bottom\">\n");

    setWidth("100%");

    HorizontalPanel topPanel = new HorizontalPanel();
    //        topPanel.setWidth("100%");
    topPanel.add(new HTML("<h1>TaikaiWeb</h1>"));
    //        topPanel.setBorderWidth(1);
    add(topPanel, "top");

    HorizontalPanel middlePanel = new HorizontalPanel();

    sidePanel = new SidePanel(this);
    sidePanel.setWidth("100%");
    sidePanel.setHeight("100%");
    //        sidePanel.setBorderWidth(1);
    middlePanel.add(sidePanel);

    toolbarPanel = new FlowPanel();
    toolbarPanel.setStyleName("taikaiweb-Toolbar");
    toolbarPanel.add(new Label("Tools:"));

    contentContainerPanel = new HTMLPanel("<div id=\"toolbar\"></div><div id=\"content\"></div>");
    contentContainerPanel.setWidth("100%");
    contentContainerPanel.setHeight("100%");
    contentContainerPanel.add(toolbarPanel, "toolbar");

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(contentContainerPanel);
    decorator.setWidth("100%");
    decorator.setHeight("100%");
    //        decorator.set
    //        middlePanel.add(contentContainerPanel);
    middlePanel.add(decorator);

    //        middlePanel.setCellHeight(sidePanel, "100%");
    middlePanel.setCellWidth(sidePanel, "20%");
    middlePanel.setCellHeight(sidePanel, "100%");
    middlePanel.setCellWidth(contentContainerPanel, "80%");
    middlePanel.setCellWidth(contentContainerPanel, "100%");
    middlePanel.setWidth("100%");

    add(middlePanel, "middle");

}

From source file:org.iplantc.de.pipelineBuilder.client.Window.java

License:Apache License

public Window(String title, Widget content) {
    this.title = new Label(title);
    this.title.setWordWrap(false);
    bar = new HorizontalPanel();
    bar.setWidth("100%");
    bar.setStyleName("window-bar");
    modalMask.setStyleName("modal-mask");
    VerticalPanel master = new VerticalPanel();
    outside = new FlowPanel() {
        @Override/*from w w  w .  j  a va2s .c o m*/
        protected void onLoad() {
            getElement().getStyle().setLeft(
                    (com.google.gwt.user.client.Window.getClientWidth() / 2) - (getOffsetWidth() / 2), Unit.PX);
            getElement().getStyle().setTop(
                    (com.google.gwt.user.client.Window.getClientHeight() / 2) - (getOffsetHeight() / 2),
                    Unit.PX);
            super.onLoad();
        }
    };
    com.google.gwt.user.client.Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            outside.getElement().getStyle().setLeft(
                    (com.google.gwt.user.client.Window.getClientWidth() / 2) - (outside.getOffsetWidth() / 2),
                    Unit.PX);
            outside.getElement().getStyle().setTop(
                    (com.google.gwt.user.client.Window.getClientHeight() / 2) - (outside.getOffsetHeight() / 2),
                    Unit.PX);
        }
    });
    outside.setStyleName("eta-window");
    HorizontalPanel header = new HorizontalPanel();
    this.title.addMouseDownHandler(new MouseDownHandler() {

        @Override
        public void onMouseDown(MouseDownEvent event) {
            isDraging = true;
            x_start = event.getX();
            y_start = event.getY();
        }
    });

    moveHandler = new MouseMoveHandler() {
        @Override
        public void onMouseMove(MouseMoveEvent event) {
            if (!isDraging)
                return;
            int left = event.getClientX() - x_start;
            int top = event.getClientY() - y_start;
            if (left > 0
                    && left + outside.getOffsetWidth() < com.google.gwt.user.client.Window.getClientWidth())
                outside.getElement().getStyle().setLeft(left - 16, Unit.PX);
            if (top > 0
                    && top + outside.getOffsetHeight() < com.google.gwt.user.client.Window.getClientHeight())
                outside.getElement().getStyle().setTop(top - 16, Unit.PX);
        }
    };
    modalMask.addMouseMoveHandler(moveHandler);
    this.title.addMouseMoveHandler(moveHandler);
    outside.addDomHandler(moveHandler, MouseMoveEvent.getType());
    master.addDomHandler(moveHandler, MouseMoveEvent.getType());

    this.title.addMouseUpHandler(new MouseUpHandler() {
        @Override
        public void onMouseUp(MouseUpEvent event) {
            isDraging = false;
        }
    });
    this.title.getElement().getStyle().setCursor(Cursor.MOVE);
    header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    header.setHeight("25px");
    master.add(header);
    header.setStyleName("header");
    header.add(this.title);
    Label close = new Label("x");
    close.setStyleName("close");
    FlowPanel tempContent = new FlowPanel() {
        @Override
        protected void onLoad() {
            super.onLoad();
            if (com.google.gwt.user.client.Window.getClientHeight() < getOffsetHeight()) {
                setHeight(com.google.gwt.user.client.Window.getClientHeight() - 100 + "px");
                getElement().getStyle().setOverflow(Overflow.AUTO);
            } else if (com.google.gwt.user.client.Window.getClientWidth() < getOffsetWidth()) {
                setWidth(com.google.gwt.user.client.Window.getClientWidth() - 300 + "px");
                getElement().getStyle().setOverflow(Overflow.AUTO);
            }
        }
    };
    tempContent.getElement().getStyle().setPadding(10, Unit.PX);
    tempContent.add(content);
    content.setWidth("100%");
    master.add(bar);
    master.add(tempContent);
    header.add(close);
    header.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_RIGHT);
    header.setCellWidth(close, "16px");
    header.setCellHeight(close, "16px");
    header.setWidth("100%");
    master.setWidth("100%");
    master.setCellHeight(header, "25px");
    master.setStyleName("inside");
    outside.add(master);

    close.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            destroy();
        }
    });

}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseDetailsViewImpl.java

License:Apache License

protected void constructTopPanel() {
    FlowPanel panel = new FlowPanel();
    panel.setSize("100%", "100%");
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    topPanel.add(panel);/*  w  ww . jav  a2s  . c o m*/
    topPanel.setCellHeight(panel, "100%");
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setHeight("100%");
    panel.add(horizontalPanel);

    HorizontalPanel backButtonPanel = new HorizontalPanel();
    backButtonPanel.setHeight("100%");
    backButtonPanel.addStyleName(Utils.kaaAdminStyle.bAppPaddedPanel());
    backButtonPanel.setVisible(false);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(backButtonPanel);
    horizontalPanel.setCellHeight(backButtonPanel, "100%");

    backButtonPanelWidget = backButtonPanel;

    Button backButton = new Button();
    backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton());
    backButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    backButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    backButtonPanel.add(backButton);
    backButtonPanel.setCellHeight(backButton, "100%");

    backButtonWidget = backButton;

    Label titleLabel = new Label();
    titleLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle());
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(titleLabel);
    horizontalPanel.setCellHeight(titleLabel, "100%");

    titleLabelWidget = titleLabel;

    HorizontalPanel buttonsPanel = new HorizontalPanel();
    buttonsPanel.setHeight("100%");
    buttonsPanel.addStyleName(Utils.avroUiStyle.buttonsPanel());
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(buttonsPanel);
    horizontalPanel.setCellHeight(buttonsPanel, "100%");

    Button saveButton = new Button();
    buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.add(saveButton);
    buttonsPanel.setCellHeight(saveButton, "100%");

    saveButtonWidget = saveButton;

    Button cancelButton = new Button();
    cancelButton.setVisible(false);
    buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setCellHeight(cancelButton, "100%");

    cancelButtonWidget = cancelButton;
}