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

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

Introduction

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

Prototype

public void setCellHorizontalAlignment(IsWidget w, HorizontalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:web.diva.client.view.core.GroupPanel.java

public GroupPanel() {

    this.setAnimationEnabled(true);
    this.ensureDebugId("cwBasicPopup-imagePopup");
    this.setModal(false);
    //        this.getElement().setAttribute("style", "overflow: visible; visibility: visible; margin-left: 40%; margin-top: auto; position: absolute; left:0px; top:0px; background: none;width: 230px;height: 170px; clip:auto;");

    framLayout = new VLayout();
    framLayout.setWidth(230);// w ww  .j a v  a  2 s . c  o m
    framLayout.setHeight(170);

    mainBodyLayout = new VLayout();
    mainBodyLayout.setWidth(228);
    mainBodyLayout.setHeight(148);
    mainBodyLayout.setMembersMargin(5);

    try {

        HorizontalPanel topLayout = new HorizontalPanel();
        topLayout.setWidth("228px");
        topLayout.setHeight("20px");
        topLayout.setSpacing(3);
        framLayout.addMember(topLayout);

        Label title = new Label("Create Group");
        title.setStyleName("labelheader");
        topLayout.add(title);
        title.setWidth(170 + "px");
        title.setHeight("18px");
        topLayout.setCellHorizontalAlignment(title, HorizontalPanel.ALIGN_LEFT);
        topLayout.setCellVerticalAlignment(title, HorizontalPanel.ALIGN_TOP);

        Label closeBtn = new Label();

        closeBtn.addStyleName("close");
        closeBtn.setHeight("16px");
        closeBtn.setWidth("16px");

        closeBtn.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                hide();
            }
        });

        topLayout.add(closeBtn);
        topLayout.setCellHorizontalAlignment(closeBtn, HorizontalPanel.ALIGN_RIGHT);
        topLayout.setCellVerticalAlignment(closeBtn, HorizontalPanel.ALIGN_TOP);
    } catch (Exception e) {
        Window.alert("error");
    }
    framLayout.addMember(mainBodyLayout);
    mainBodyLayout.setStyleName("modalPanelBody");
    form = new DynamicForm();
    form.setGroupTitle("Create Group");
    form.setWidth(228);
    form.setLayoutAlign(Alignment.CENTER);

    name = new TextItem();
    name.setTitle("Group Name");
    name.setRequired(true);

    description = new TextItem();
    description.setTitle("Description");
    description.setRequired(true);
    colorPicker = new ColorPickerItem("groupColor", "Group Color");
    colorPicker.setRequired(Boolean.TRUE);
    //        colorPicker.getPicker().setZIndex(framLayout.getZIndex()+1000);
    //       colorPicker.setValue("red");
    //        SC.say(colorPicker.getPicker().getScClassName()+"  "+colorPicker.getPicker().getZIndex());
    members = new TextItem();
    members.setTitle("Memebers");
    members.setRequired(true);

    members.disable();

    form.setFields(name, description, colorPicker, members);
    form.redraw();
    mainBodyLayout.addMember(form);

    HorizontalPanel hlo = new HorizontalPanel();
    mainBodyLayout.addMember(hlo);
    hlo.setWidth("228px");
    hlo.setHeight("20px");
    okBtn = new IButton("Process");
    hlo.add(okBtn);
    hlo.setCellHorizontalAlignment(okBtn, HorizontalPanel.ALIGN_CENTER);
    hlo.setCellVerticalAlignment(okBtn, HorizontalPanel.ALIGN_MIDDLE);

    this.setWidget(framLayout);
    framLayout.setStyleName("modalPanelLayout");
    framLayout.redraw();
    this.show();
    this.hide();

}

From source file:web.diva.client.view.core.RowGroupPanel.java

public RowGroupPanel(List<DivaGroup> rowGroupsList, String type, SelectionStyle selectionStyle) {

    this.setAnimationEnabled(true);
    this.ensureDebugId("cwBasicPopup-imagePopup");
    this.setModal(false);

    framLayout = new VerticalPanel();
    framLayout.setWidth("400px");
    framLayout.setHeight("256px");

    mainBodyLayout = new VerticalPanel();
    mainBodyLayout.setWidth("398px");
    mainBodyLayout.setHeight("234px");
    mainBodyLayout.setStyleName("modalPanelBody");

    HorizontalPanel topLayout = new HorizontalPanel();
    //        topLayout.setMembersMargin(1);
    topLayout.setWidth("398px");
    topLayout.setHeight("20px");
    framLayout.add(topLayout);/*from  w w  w .  j av a  2  s  .  c o  m*/
    framLayout.add(mainBodyLayout);
    Label title = new Label(type);
    title.setStyleName("labelheader");
    topLayout.add(title);
    title.setWidth(200 + "px");
    topLayout.setCellHorizontalAlignment(title, HorizontalPanel.ALIGN_LEFT);
    topLayout.setCellVerticalAlignment(title, HorizontalPanel.ALIGN_TOP);

    Label closeBtn = new Label();

    closeBtn.addStyleName("close");
    closeBtn.setHeight("16px");
    closeBtn.setWidth("16px");

    closeBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    topLayout.add(closeBtn);
    topLayout.setCellHorizontalAlignment(closeBtn, HorizontalPanel.ALIGN_RIGHT);
    topLayout.setCellVerticalAlignment(closeBtn, HorizontalPanel.ALIGN_TOP);
    try {

        selectionTable = new ListGrid();
        initSelectionTable(selectionStyle);
        mainBodyLayout.add(selectionTable);
        this.updateData(rowGroupsList);
        selectionTable.addCellSelectionChangedHandler(new CellSelectionChangedHandler() {

            @Override
            public void onCellSelectionChanged(CellSelectionChangedEvent event) {

                ListGridRecord[] records = selectionTable.getRecords();
                int counter = 0;
                for (ListGridRecord record : records) {
                    if (Boolean.valueOf(record.getAttribute("selection")) == true) {
                        counter++;
                        if (counter > 1) {
                            event.cancel();
                            errorlabl.setVisible(true);

                        }
                    }
                }
            }

        });

    } catch (Exception e) {
        Window.alert("error is ");
    }

    if (type.equalsIgnoreCase("Create Sub-Dataset")) {
        form = new DynamicForm();
        form.setGroupTitle("");
        form.setWidth(398);
        form.setLayoutAlign(Alignment.CENTER);

        name = new TextItem();
        name.setTitle("Sub-DS Name");
        name.setRequired(true);
        name.setWidth(200);
        form.setFields(name);
        form.redraw();
        mainBodyLayout.add(form);

    }

    HorizontalPanel hlo = new HorizontalPanel();
    hlo.setWidth("398px");
    hlo.setHeight("30px");
    okBtn = new IButton(type);
    okBtn.setWidth(200);
    hlo.add(okBtn);
    hlo.setCellHorizontalAlignment(okBtn, HorizontalPanel.ALIGN_CENTER);
    hlo.setCellVerticalAlignment(okBtn, HorizontalPanel.ALIGN_MIDDLE);

    mainBodyLayout.add(hlo);

    errorlabl = new HTML(
            "<h4 style='color:red;margin-left: 20px;height=20px;'>PLEASE CHECK YOUR DATA INPUT ..</h4>");
    errorlabl.setVisible(false);
    errorlabl.setHeight("30px");
    errorlabl.setWidth("40px");
    mainBodyLayout.add(errorlabl);
    rowGroupsList = null;
    //        mainBodyLayout.redraw();
    this.setWidget(framLayout);
    framLayout.setStyleName("modalPanelLayout");
    this.show();
    this.hide();

}

From source file:web.diva.client.view.core.SaveAsPanel.java

public SaveAsPanel(String fileType, final String url) {
    this.setAnimationEnabled(true);
    this.ensureDebugId("cwBasicPopup-imagePopup");
    this.setModal(false);

    VerticalPanel framLayout = new VerticalPanel();
    framLayout.setWidth("200px");
    framLayout.setHeight("80px");

    VerticalPanel mainBodyLayout = new VerticalPanel();
    mainBodyLayout.setWidth("198px");
    mainBodyLayout.setHeight("78px");

    mainBodyLayout.setStyleName("modalPanelBody");

    HorizontalPanel topLayout = new HorizontalPanel();
    topLayout.setWidth("200px");
    topLayout.setHeight("20px");
    Label title = new Label("Save " + fileType);
    title.setStyleName("labelheader");
    topLayout.add(title);// w w w.  jav a2 s.  com
    title.setWidth(150 + "px");

    Label closeBtn = new Label();

    closeBtn.addStyleName("close");
    closeBtn.setHeight("16px");
    closeBtn.setWidth("16px");

    topLayout.add(closeBtn);

    topLayout.setCellVerticalAlignment(closeBtn, HorizontalPanel.ALIGN_TOP);
    topLayout.setCellHorizontalAlignment(closeBtn, HorizontalPanel.ALIGN_RIGHT);

    topLayout.setCellVerticalAlignment(closeBtn, HorizontalPanel.ALIGN_TOP);
    topLayout.setCellHorizontalAlignment(closeBtn, HorizontalPanel.ALIGN_RIGHT);

    final HorizontalPanel btnsLayout = new HorizontalPanel();
    btnsLayout.setWidth("198px");
    btnsLayout.setHeight("30px");
    mainBodyLayout.add(btnsLayout);
    mainBodyLayout.setCellVerticalAlignment(btnsLayout, VerticalPanel.ALIGN_MIDDLE);
    mainBodyLayout.setCellHorizontalAlignment(btnsLayout, VerticalPanel.ALIGN_CENTER);

    //        downloadLink = new HTML("<a href='"+url+"'style='color: black;'target='_blank' download> Save As</a>");
    downloadLink = new HTML(new SafeHtml() {

        @Override
        public String asString() {
            return "<a href='" + url + "'style='color: black;'target='_blank' download> Save As</a>";
        }
    });
    downloadLink.setStyleName("buttonRounded");
    downloadLink.setWidth("60px");
    btnsLayout.add(downloadLink);
    btnsLayout.setCellVerticalAlignment(downloadLink, HorizontalPanel.ALIGN_MIDDLE);
    btnsLayout.setCellHorizontalAlignment(downloadLink, HorizontalPanel.ALIGN_CENTER);

    openLink = new HTML(new SafeHtml() {

        @Override
        public String asString() {
            return ("<a href='" + url + "'style='color: black;'target='_blank' > Open</a>");
        }
    });
    openLink.setStyleName("buttonRounded");
    openLink.setWidth("60px");
    btnsLayout.add(openLink);
    btnsLayout.setCellVerticalAlignment(openLink, HorizontalPanel.ALIGN_MIDDLE);
    btnsLayout.setCellHorizontalAlignment(openLink, HorizontalPanel.ALIGN_CENTER);

    //        ClickHandler hideHandler = new ClickHandler() {
    //
    //            @Override
    //            public void onClick(ClickEvent event) {
    ////                reg1.removeHandler();
    ////                reg2.removeHandler();
    //                clear();                
    //                hide(true);
    //
    //            }
    //        }; 
    //       reg1 =downloadLink.addClickHandler(hideHandler);
    //       reg2= openLink.addClickHandler(hideHandler);
    //        closeBtn.addClickHandler(hideHandler);
    closeBtn.addDomHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            clear();
            hide(true);
        }
    }, ClickEvent.getType());

    framLayout.add(topLayout);
    framLayout.add(mainBodyLayout);
    this.setWidget(framLayout);
    framLayout.setStyleName("modalPanelLayout");

}

From source file:web.diva.client.view.core.SaveDatasetPanel.java

public SaveDatasetPanel() {
    this.setAnimationEnabled(true);
    this.setAnimationEnabled(true);
    this.ensureDebugId("cwBasicPopup-imagePopup");
    this.setModal(false);
    VerticalPanel framLayout = new VerticalPanel();
    framLayout.setWidth("300px");
    framLayout.setHeight("100px");

    VerticalPanel mainBodyLayout = new VerticalPanel();
    mainBodyLayout.setWidth("298px");
    mainBodyLayout.setHeight("128px");
    mainBodyLayout.setStyleName("modalPanelBody");

    HorizontalPanel topLayout = new HorizontalPanel();
    topLayout.setWidth("298px");
    topLayout.setHeight("18px");

    Label title = new Label("Publish Dataset Online");
    title.setStyleName("labelheader");
    topLayout.add(title);//w ww . j ava 2 s .  c  om
    title.setWidth(150 + "px");
    topLayout.setCellHorizontalAlignment(title, HorizontalPanel.ALIGN_LEFT);
    topLayout.setCellVerticalAlignment(title, HorizontalPanel.ALIGN_TOP);

    Label closeBtn = new Label();
    closeBtn.addStyleName("close");
    closeBtn.setHeight("16px");
    closeBtn.setWidth("16px");

    closeBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    topLayout.add(closeBtn);
    topLayout.setCellHorizontalAlignment(closeBtn, HorizontalPanel.ALIGN_RIGHT);
    topLayout.setCellVerticalAlignment(closeBtn, HorizontalPanel.ALIGN_TOP);

    form = new DynamicForm();
    form.setGroupTitle("");

    form.setIsGroup(false);
    form.setWidth(288);
    form.setPadding(10);
    form.setLayoutAlign(Alignment.CENTER);

    name = new TextItem();
    name.setTitle("Dataset Name");
    name.setWidth(250);
    name.setRequired(true);
    name.setTitleOrientation(TitleOrientation.TOP);
    form.setFields(name);
    form.setBorder("0px solid");
    form.draw();

    mainBodyLayout.add(form);

    VerticalPanel hlo = new VerticalPanel();
    hlo.setWidth("298px");
    hlo.setHeight("20px");
    okBtn = new IButton("Process");
    hlo.add(okBtn);
    hlo.setCellHorizontalAlignment(okBtn, VerticalPanel.ALIGN_CENTER);
    hlo.setCellVerticalAlignment(okBtn, VerticalPanel.ALIGN_MIDDLE);

    mainBodyLayout.add(hlo);

    framLayout.add(topLayout);
    framLayout.add(mainBodyLayout);
    this.setWidget(framLayout);
    framLayout.setStyleName("modalPanelLayout");

}