Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

Introduction

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

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:lalala.client.demo.RoomsView.java

License:Apache License

public RoomsView(int visibleItems, String width) {
    HorizontalPanel firstRow = new HorizontalPanel();
    HorizontalPanel secondRow = new HorizontalPanel();
    add(firstRow);//from w w w  . j  av  a2 s .  c o m
    add(secondRow);
    firstRow.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    secondRow.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    VerticalPanel verticalPadding200 = new VerticalPanel();
    verticalPadding200.addStyleName("width200");
    verticalPadding200.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    VerticalPanel verticalPadding = new VerticalPanel();
    verticalPadding.addStyleName(CSS_DEMO_DUAL_LIST_EXAMPLE_CENTER);
    verticalPadding.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    VerticalPanel verticalPadding2 = new VerticalPanel();
    verticalPadding.addStyleName(CSS_DEMO_DUAL_LIST_EXAMPLE_CENTER);
    verticalPadding.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    dragController = new ListBoxDragController(this);
    waitingList = new MouseListBox(dragController, LIST_SIZE);
    room1 = new MouseListBox(dragController, LIST_SIZE);
    room2 = new MouseListBox(dragController, LIST_SIZE);

    VerticalPanel waitingRoomPanel = new VerticalPanel();
    waitingRoomPanel.add(new Label("waiting room"));
    waitingRoomPanel.add(waitingList);

    VerticalPanel room1Panel = new VerticalPanel();
    room1Panel.add(new Label("room 1"));
    room1Panel.add(room1);

    VerticalPanel room2Panel = new VerticalPanel();
    room2Panel.add(new Label("room 2"));
    room2Panel.add(room2);

    waitingList.setWidth(width);
    room1.setWidth(width);
    room2.setWidth(width);

    firstRow.add(waitingRoomPanel);
    firstRow.add(verticalPadding200);
    firstRow.add(room1Panel);
    firstRow.add(verticalPadding);
    firstRow.add(room2Panel);

    //
    room3 = new MouseListBox(dragController, LIST_SIZE);
    room4 = new MouseListBox(dragController, LIST_SIZE);
    room3.setWidth(width);
    room4.setWidth(width);

    VerticalPanel room3Panel = new VerticalPanel();
    room1Panel.add(new Label("room 3"));
    room1Panel.add(room3);

    VerticalPanel room4Panel = new VerticalPanel();
    room1Panel.add(new Label("room 4"));
    room1Panel.add(room4);

    secondRow.add(room3Panel);
    secondRow.add(verticalPadding2);
    secondRow.add(room4Panel);

    ListBoxDropController waitingListController = new ListBoxDropController(waitingList);
    ListBoxDropController room1Controller = new ListBoxDropController(room1);
    ListBoxDropController room2Controller = new ListBoxDropController(room2);
    ListBoxDropController room3Controller = new ListBoxDropController(room3);
    ListBoxDropController room4Controller = new ListBoxDropController(room4);
    dragController.registerDropController(waitingListController);
    dragController.registerDropController(room1Controller);
    dragController.registerDropController(room2Controller);
    dragController.registerDropController(room3Controller);
    dragController.registerDropController(room4Controller);

}

From source file:n3phele.client.BasePanel.java

License:Open Source License

public BasePanel(n3phele.client.ClientFactory clientFactory) {
    this.clientFactory = clientFactory;
    this.basePanelName = new HTML();
    this.basePanelName.addStyleName(N3phele.n3pheleResource.css().gwtHTMLBasePanelName());
    this.basePanelName.setHTML("n3phele");
    this.basePanelName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    this.menu = new HorizontalPanel();
    this.menu.setSize("100%", "100%");
    this.menu.addStyleName(N3phele.n3pheleResource.css().panelMenu());
    this.setWidget(0, 0, this.menu);

    this.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_MIDDLE);
    this.getFlexCellFormatter().setColSpan(0, 0, 2);
    this.getFlexCellFormatter().setHeight(0, 0, "40px");
    this.menu.add(basePanelName);

    this.lhs = new VerticalPanel();
    this.lhs.setWidth("200px");
    this.setWidget(1, 0, this.lhs);
    this.getFlexCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_TOP);

    this.getCellFormatter().setAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_TOP);

    this.n3phele = new Image(N3phele.n3pheleResource.loginGraphic().getURL());
    this.n3phele.setPixelSize(N3phele.n3pheleResource.loginGraphic().getWidth() * 250
            / N3phele.n3pheleResource.loginGraphic().getHeight(), 250);
    this.lhs.add(this.n3phele);
    this.lhs.setCellHorizontalAlignment(this.n3phele, VerticalPanel.ALIGN_CENTER);

}

From source file:n3phele.client.view.AccountHyperlinkView.java

License:Open Source License

public AccountHyperlinkView(String uri) {
    super(new MenuItem(N3phele.n3pheleResource.accountIcon(), "Account", null),
            new MenuItem(N3phele.n3pheleResource.accountAddIcon(), "Account Edit", "account:" + uri));

    if (resource == null)
        resource = GWT.create(DataGridResource.class);

    // TABLE// ww  w .  ja v  a  2s  .c  o  m
    table = new FlexTable();
    table.setCellPadding(10);
    errorsOnPage = new ValidInputIndicatorWidget(
            "check for missing or invalid parameters marked with this icon", false);
    setTableData();
    table.getFlexCellFormatter().setRowSpan(0, 1, 2);
    table.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    table.getColumnFormatter().setWidth(0, "220px");
    table.getColumnFormatter().setWidth(1, "290px");
    table.setCellPadding(1);
    table.setCellSpacing(1);

    // DATAGRID
    dataGrid = new DataGrid<ActivityData>(15, resource);
    dataGrid.setSize("495px", "100px");

    TextColumn<ActivityData> nameColumn = new TextColumn<ActivityData>() {
        @Override
        public String getValue(ActivityData item) {
            String result = "";
            if (item != null) {
                result += item.getName();
            }
            return result;
        }
    };
    dataGrid.addColumn(nameColumn, "Name");
    dataGrid.setColumnWidth(nameColumn, "130px");

    // TODO: Working on Activity column

    Column<ActivityData, String> activityColumn = new Column<ActivityData, String>(new ClickableTextCell()) {
        @Override
        public String getValue(ActivityData item) {

            return item.getNameTop();
        }

    };
    activityColumn.setFieldUpdater(new FieldUpdater<ActivityData, String>() {
        @Override
        public void update(int index, ActivityData obj, String value) {
            presenter.onSelect(obj);

        }
    });

    activityColumn.setCellStyleNames(N3phele.n3pheleResource.css().clickableTextCellEffect());
    dataGrid.addColumn(activityColumn, "Activity");
    dataGrid.setColumnWidth(activityColumn, "100px");

    TextColumn<ActivityData> ageColumn = new TextColumn<ActivityData>() {
        @Override
        public String getValue(ActivityData item) {
            return item.getAge();
        }
    };
    dataGrid.addColumn(ageColumn, "Age");
    dataGrid.setColumnWidth(ageColumn, "80px");

    TextColumn<ActivityData> priceColumn = new TextColumn<ActivityData>() {
        @Override
        public String getValue(ActivityData item) {
            return item.getCost();
        }
    };
    dataGrid.addColumn(priceColumn, "Total Cost");
    dataGrid.setColumnWidth(priceColumn, "75px");

    // Add a selection model to handle user selection.
    final SingleSelectionModel<ActivityData> selectionModel = new SingleSelectionModel<ActivityData>();
    dataGrid.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            selectionModel.getSelectedObject();
        }
    });

    Column<ActivityData, ActivityData> cancelColumn = new Column<ActivityData, ActivityData>(
            new CancelButtonCell<ActivityData>(new Delegate<ActivityData>() {
                @Override
                public void execute(ActivityData value) {
                    if (value != null) {
                        dataGrid.getSelectionModel().setSelected(value, false);
                        getDialog(value).show();
                    }
                }
            }, "delete virtual machine")) {
        @Override
        public ActivityData getValue(ActivityData object) {
            return object;
        }
    };
    cancelColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dataGrid.addColumn(cancelColumn);
    dataGrid.setColumnWidth(cancelColumn, "50px");

    // CALL onModuleLoad()
    chartPanel = get();
    chartPanel.add(table);
    chartPanel.add(new SectionPanel("History"));
    chartPanel.add(historyTable);
    chartPanel.add(new SectionPanel("Active Machines"));
    chartPanel.add(vsTable);
    chartPanel = get();
    setChartTableData();
    onModuleLoad();
}

From source file:n3phele.client.view.AccountView.java

License:Open Source License

public AccountView() {
    super(new MenuItem(N3phele.n3pheleResource.accountIcon(), "Cloud Account", null));
    table = new FlexTable();
    table.setCellPadding(10);/* w ww.  jav  a  2 s.co m*/

    ChangeHandler update = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            validateAccount(true);
        }
    };

    KeyUpHandler keyup = new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            validateAccount(true);
        }

    };

    this.account = null;
    Label lblNewLabel = new Label("Name");
    table.setWidget(0, 0, lblNewLabel);
    nameValid = new ValidInputIndicatorWidget("Text value required", false);
    table.setWidget(0, 1, nameValid);

    name = new TextBox();
    name.setVisibleLength(40);
    name.addChangeHandler(update);
    name.addKeyUpHandler(keyup);
    table.setWidget(0, 2, name);

    Label lblNewLabel_1 = new Label("Description");
    table.setWidget(1, 0, lblNewLabel_1);

    description = new TextBox();
    description.setVisibleLength(40);
    description.addChangeHandler(update);
    table.setWidget(1, 2, description);

    Label lblNewLabel_2 = new Label("on Cloud");
    table.setWidget(2, 0, lblNewLabel_2);

    cloudSelected = new ValidInputIndicatorWidget("Cloud selection required", false);
    table.setWidget(2, 1, cloudSelected);

    cloud.addItem("--loading--");
    cloud.addChangeHandler(update);
    table.setWidget(2, 2, cloud);

    Label lblNewLabel_3 = new Label("Cloud Id");
    table.setWidget(3, 0, lblNewLabel_3);

    gotCloudId = new ValidInputIndicatorWidget("Cloud id required", false);
    table.setWidget(3, 1, gotCloudId);
    cloudId = new TextBox();
    cloudId.setVisibleLength(40);
    cloudId.addChangeHandler(update);
    cloudId.addKeyUpHandler(keyup);
    table.setWidget(3, 2, cloudId);

    Label lblNewLabel_4 = new Label("New password");
    table.setWidget(4, 0, lblNewLabel_4);

    passwordTextSupplied = new ValidInputIndicatorWidget("Password text required", false);
    table.setWidget(4, 1, passwordTextSupplied);
    password = new PasswordTextBox();
    password.setVisibleLength(40);
    password.addChangeHandler(update);
    password.addKeyUpHandler(keyup);
    table.setWidget(4, 2, password);

    Label lblNewLabel_5 = new Label("Confirm Password");
    table.setWidget(5, 0, lblNewLabel_5);
    passwordConfirmSupplied = new ValidInputIndicatorWidget("Matching password text required", false);
    table.setWidget(5, 1, passwordConfirmSupplied);
    confirmPassword = new PasswordTextBox();
    confirmPassword.setVisibleLength(40);
    confirmPassword.addChangeHandler(update);
    confirmPassword.addKeyUpHandler(keyup);
    table.setWidget(5, 2, confirmPassword);

    cancel = new Button("cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_cancel();
        }
    });

    table.setWidget(6, 3, cancel);

    save = new Button("save", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_save();
        }
    });
    table.setWidget(6, 2, save);

    errorsOnPage = new ValidInputIndicatorWidget(
            "check for missing or invalid parameters marked with this icon", false);
    table.setWidget(6, 1, errorsOnPage);
    table.getFlexCellFormatter().setHorizontalAlignment(6, 3, HasHorizontalAlignment.ALIGN_CENTER);

    for (int i = 0; i < 6; i++) {
        table.getFlexCellFormatter().setColSpan(i, 2, 2);
        table.getFlexCellFormatter().setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        //         table.getFlexCellFormatter().setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        //         table.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_LEFT);

    }
    table.getColumnFormatter().setWidth(0, "25%");
    table.getColumnFormatter().setWidth(1, "18px");
    table.getColumnFormatter().setWidth(4, "16px");
    table.setCellPadding(1);
    table.setCellSpacing(5);
    this.add(table);
}

From source file:n3phele.client.view.ActivityListView.java

License:Open Source License

public ActivityListView() {
    super(new MenuItem(N3phele.n3pheleResource.activityIcon(), "Activity History", null));

    HorizontalPanel heading = new HorizontalPanel();
    heading.setWidth("500px");
    heading.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader());
    add(heading);//w ww.j  av  a  2s.  c  o  m

    heading.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    SimplePager simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    heading.add(simplePager);
    heading.setCellHorizontalAlignment(simplePager, HorizontalPanel.ALIGN_CENTER);

    this.cellTable = new ActivityStatusList();
    this.cellTable.setWidth("100%");
    TextColumn<Progress> narrative = new TextColumn<Progress>() {

        @Override
        public String getValue(Progress progress) {
            String result = "";
            List<Narrative> narrative = progress.getNarratives();
            if (narrative != null && narrative.size() > 0) {
                result = narrative.get(narrative.size() - 1).getText();
            }

            return result;
        }
    };
    this.cellTable.addColumn(narrative);
    this.cellTable.setColumnWidth(narrative, "55%");
    Column<Progress, Progress> cancelColumn = new Column<Progress, Progress>(
            new CancelButtonCell<Progress>(new Delegate<Progress>() {

                @Override
                public void execute(Progress value) {
                    if (value != null) {
                        cellTable.getSelectionModel().setSelected(value, false);
                        getDialog(value).show();
                    }
                }
            }, "cancel activity")) {
        @Override
        public Progress getValue(Progress object) {
            String status = object.getStatus();
            if (status == null || status.equalsIgnoreCase("COMPLETE") || status.equalsIgnoreCase("FAILED")
                    || status.equalsIgnoreCase("CANCELLED")) {
                return null;
            }
            return object;
        }
    };
    cellTable.addColumn(cancelColumn);
    cellTable.setColumnWidth(cancelColumn, "26px");
    //cellTable.setSize("455px", "");
    this.add(cellTable);
    cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    final SingleSelectionModel<Progress> selectionModel = new SingleSelectionModel<Progress>();
    cellTable.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            Progress selected = selectionModel.getSelectedObject();
            if (selected != null) {
                if (presenter != null) {
                    presenter.onSelect(selected);
                    // selectionModel.setSelected(selected, false);
                }

            }
        }
    });

    /*
     * Add Table paging
     */
    simplePager.setDisplay(cellTable);
    simplePager.setPageSize(PAGESIZE);
    cellTable.addRangeChangeHandler(new RangeChangeEvent.Handler() {

        /* (non-Javadoc)
         * @see com.google.gwt.view.client.RangeChangeEvent.Handler#onRangeChange(com.google.gwt.view.client.RangeChangeEvent)
         */
        @Override
        public void onRangeChange(RangeChangeEvent event) {
            Range range = cellTable.getVisibleRange();
            int start = range.getStart();

            //            if(data == null || (data.size() < start) ){
            GWT.log("Fetch " + start);
            presenter.refresh(start);
            //            } else {
            //               if(length+start > data.size())
            //                  length = data.size()-start;
            //               GWT.log("data available start="+start);
            //               grid.setRowData(start, chunk(data.subList(start, start+length)));
            //            }
        }

    });
    this.add(cellTable);

}

From source file:n3phele.client.view.CommandListGridView.java

License:Open Source License

public CommandListGridView() {
    super(new MenuItem(N3phele.n3pheleResource.commandIcon(), "Commands", null));
    String html = "<img style='border:none; vertical-align:bottom; margin:-2px; padding-right:2px;' width=20 height=20 src='"
            + N3phele.n3pheleResource.commandIcon().getURL() + "'/>create a new command";
    Button addDataSet = new Button(html, new ClickHandler() {

        @Override//from w ww. ja  v  a 2 s.  co m
        public void onClick(ClickEvent event) {
            createUploadPopup();
        }
    });
    addDataSet.setStyleName(N3phele.n3pheleResource.css().newCommandButton());
    this.strip.add(addDataSet);
    HorizontalPanel heading = new HorizontalPanel();
    heading.setWidth("500px");
    heading.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader());
    add(heading);
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    heading.add(simplePager);

    textBox = new TextBox();
    textBox.setTitle("search for a command");
    heading.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    heading.add(textBox);
    heading.setCellHorizontalAlignment(textBox, HorizontalPanel.ALIGN_RIGHT);
    textBox.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) {
                commandActivity.fetch(0, searchText = textBox.getText(), !allVersions.getValue());
            }
        }
    });

    Image searchIcon = new Image(N3phele.n3pheleResource.searchIcon().getURL());
    searchIcon.setPixelSize(20, 20);
    PushButton search = new PushButton(searchIcon);
    search.setTitle("search for a command");
    search.setStyleName(N3phele.n3pheleResource.css().commandSearchButton());
    heading.add(search);
    search.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            commandActivity.fetch(0, searchText = textBox.getText(), !allVersions.getValue());

        }
    });

    heading.setCellHorizontalAlignment(simplePager, HorizontalPanel.ALIGN_CENTER);
    DisclosurePanel more = new DisclosurePanel("advanced");
    more.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader());
    heading.add(more);
    heading.setCellHorizontalAlignment(more, HorizontalPanel.ALIGN_LEFT);
    HorizontalPanel disclosed = new HorizontalPanel();
    more.add(disclosed);
    disclosed.add(new InlineLabel("Search all versions"));

    allVersions = new SimpleCheckBox();
    allVersions.setName("allVersions");
    allVersions.setFormValue("Search all versions");
    disclosed.add(allVersions);

    grid = new CellTable<List<Command>>();
    grid.setWidth("100%", true);
    HasCell<Command, ?> nameHasCell = new HasCell<Command, Command>() {

        @Override
        public Cell<Command> getCell() {
            return new CommandTextCell(CommandNameRenderer.getInstance());
        }

        @Override
        public FieldUpdater<Command, Command> getFieldUpdater() {
            return new FieldUpdater<Command, Command>() {

                @Override
                public void update(int index, Command object, Command value) {
                    //                  if(value != null) {
                    //                     GWT.log("got-139 "+index+" "+value.getName());
                    //                     commandActivity.goTo(new CommandPlace(value.getUri()));
                    //                  }

                }
            };
        }

        @Override
        public Command getValue(Command object) {
            return object;
        }

    };
    HasCell<Command, ?> versionHasCell = new HasCell<Command, Command>() {

        @Override
        public Cell<Command> getCell() {
            return new CommandTextCell(CommandVersionRenderer.getInstance());
        }

        @Override
        public FieldUpdater<Command, Command> getFieldUpdater() {
            return new FieldUpdater<Command, Command>() {

                @Override
                public void update(int index, Command object, Command value) {
                    //                  if(value != null) {
                    //                     GWT.log("got-166 "+index+" "+value.getName());
                    //                     commandActivity.goTo(new CommandPlace(value.getUri()));
                    //                  }

                }
            };
        }

        @Override
        public Command getValue(Command object) {
            return object;
        }

    };

    List<HasCell<Command, ?>> hasCells = new ArrayList<HasCell<Command, ?>>(2);
    hasCells.add(nameHasCell);
    hasCells.add(versionHasCell);
    for (int i = 0; i < ROWLENGTH; i++) {
        Column<List<Command>, Command> c = new Column<List<Command>, Command>(new CommandIconTextCell(
                N3phele.n3pheleResource.scriptIcon(), new CompositeCell<Command>(hasCells), i)) {

            @Override
            public Command getValue(List<Command> object) {
                int index = ((CommandIconTextCell) this.getCell()).getIndex();
                if (index < object.size()) {
                    return object.get(index);
                } else {
                    return null;
                }
            }
        };
        c.setFieldUpdater(new FieldUpdater<List<Command>, Command>() {

            @Override
            public void update(int index, List<Command> object, Command value) {
                if (value != null) {
                    GWT.log("got-201 " + index + " " + value.getName());
                    commandActivity.goTo(new CommandPlace(value.getUri()));
                }

            }
        });
        grid.addColumn(c);
        grid.setColumnWidth(c, 100.0 / ROWLENGTH, Unit.PCT);
    }

    grid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    simplePager.setDisplay(grid);
    simplePager.setPageSize(PAGESIZE);
    grid.addRangeChangeHandler(new RangeChangeEvent.Handler() {

        /* (non-Javadoc)
         * @see com.google.gwt.view.client.RangeChangeEvent.Handler#onRangeChange(com.google.gwt.view.client.RangeChangeEvent)
         */
        @Override
        public void onRangeChange(RangeChangeEvent event) {
            if (suppressEvent)
                return;
            Range range = grid.getVisibleRange();
            GWT.log("Table range is " + range.getStart() + " length " + range.getLength());
            int start = range.getStart();
            if (start > total)
                start = total;
            //            if(data == null || (data.size() < start) ){

            commandActivity.fetch(start, searchText, !allVersions.getValue());
            //            } else {
            //               if(length+start > data.size())
            //                  length = data.size()-start;
            //               GWT.log("data available start="+start);
            //               grid.setRowData(start, chunk(data.subList(start, start+length)));
            //            }
        }

    });
    this.add(grid);
}

From source file:n3phele.client.view.ForgotPasswordView.java

License:Open Source License

public ForgotPasswordView(String signupUrl) {
    this.signupUrl = signupUrl;
    this.setGlassEnabled(true);
    this.setAnimationEnabled(true);

    table = new FlexTable();
    table.setCellPadding(1);//ww  w  . j ava  2 s.  co m
    table.setCellSpacing(5);

    ChangeHandler update = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            save.setEnabled(validateUser(true));
        }
    };
    KeyUpHandler keyup = new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            validateUser(true);
        }

    };

    HTML heading = new HTML("<i><u>User Password Reset</u></i>");
    table.setWidget(0, 0, heading);

    Label lblNewLabel = new Label("Email");
    table.setWidget(1, 0, lblNewLabel);
    emailValid = new ValidInputIndicatorWidget("Email address required", true);
    table.setWidget(1, 1, emailValid);

    email = new TextBox();
    email.setVisibleLength(30);
    email.addChangeHandler(update);
    email.addKeyUpHandler(keyup);
    table.setWidget(1, 2, email);

    Label lblNewLabel_1 = new Label("First Name");
    table.setWidget(2, 0, lblNewLabel_1);
    firstNameValid = new ValidInputIndicatorWidget("Text value required", true);
    table.setWidget(2, 1, firstNameValid);

    firstName = new TextBox();
    firstName.setVisibleLength(30);
    firstName.addChangeHandler(update);
    firstName.addKeyUpHandler(keyup);
    table.setWidget(2, 2, firstName);

    Label lblNewLabel_2 = new Label("Last Name");
    table.setWidget(3, 0, lblNewLabel_2);
    lastNameValid = new ValidInputIndicatorWidget("Text value required", true);
    table.setWidget(3, 1, lastNameValid);

    lastName = new TextBox();
    lastName.setVisibleLength(30);
    lastName.addChangeHandler(update);
    lastName.addKeyUpHandler(keyup);
    table.setWidget(3, 2, lastName);

    cancel = new Button("cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_cancel();
        }
    });

    table.setWidget(4, 3, cancel);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    save = new Button("reset", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_save();
        }
    });
    table.setWidget(4, 2, save);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 2, HasHorizontalAlignment.ALIGN_RIGHT);
    save.setEnabled(false);
    errorsOnPage = new ValidInputIndicatorWidget(
            "check for missing or invalid parameters marked with this icon", true);
    table.setWidget(4, 1, errorsOnPage);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 3, HasHorizontalAlignment.ALIGN_RIGHT);

    for (int i = 1; i < 4; i++) {
        table.getFlexCellFormatter().setColSpan(i, 2, 3);
        table.getFlexCellFormatter().setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        table.getFlexCellFormatter().setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_LEFT);

    }

    table.getColumnFormatter().setWidth(1, "18px");
    table.getColumnFormatter().setWidth(4, "18px");
    table.getFlexCellFormatter().setColSpan(0, 0, 4);
    table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    this.add(table);
    this.center();
}

From source file:n3phele.client.view.NewUserView.java

License:Open Source License

public NewUserView(String signupUrl) {
    this.signupUrl = signupUrl;
    this.setGlassEnabled(true);
    this.setAnimationEnabled(true);

    table = new FlexTable();
    table.setCellPadding(1);//  ww  w  .  j a v  a 2 s.c o  m
    table.setCellSpacing(5);

    ChangeHandler update = new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            save.setEnabled(validateUser(true));
        }
    };
    KeyUpHandler keyup = new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            validateUser(true);
        }

    };

    HTML heading = new HTML("<i><u>New User Registration</u></i>");
    table.setWidget(0, 0, heading);

    Label lblNewLabel = new Label("Email");
    table.setWidget(1, 0, lblNewLabel);
    emailValid = new ValidInputIndicatorWidget("Email address required", true);
    table.setWidget(1, 1, emailValid);

    email = new TextBox();
    email.setVisibleLength(30);
    email.addChangeHandler(update);
    email.addKeyUpHandler(keyup);
    table.setWidget(1, 2, email);

    Label lblNewLabel_1 = new Label("First Name");
    table.setWidget(2, 0, lblNewLabel_1);
    firstNameValid = new ValidInputIndicatorWidget("Text value required", true);
    table.setWidget(2, 1, firstNameValid);

    firstName = new TextBox();
    firstName.setVisibleLength(30);
    firstName.addChangeHandler(update);
    firstName.addKeyUpHandler(keyup);
    table.setWidget(2, 2, firstName);

    Label lblNewLabel_2 = new Label("Last Name");
    table.setWidget(3, 0, lblNewLabel_2);
    lastNameValid = new ValidInputIndicatorWidget("Text value required", true);
    table.setWidget(3, 1, lastNameValid);

    lastName = new TextBox();
    lastName.setVisibleLength(30);
    lastName.addChangeHandler(update);
    lastName.addKeyUpHandler(keyup);
    table.setWidget(3, 2, lastName);

    Label lblNewLabel_3 = new Label("New password");
    table.setWidget(4, 0, lblNewLabel_3);
    passwordTextSupplied = new ValidInputIndicatorWidget("Password text required", true);
    table.setWidget(4, 1, passwordTextSupplied);

    password = new PasswordTextBox();
    password.setVisibleLength(30);
    password.addChangeHandler(update);
    password.addKeyUpHandler(keyup);
    table.setWidget(4, 2, password);

    Label lblNewLabel_4 = new Label("Confirm Password");
    table.setWidget(5, 0, lblNewLabel_4);
    passwordConfirmSupplied = new ValidInputIndicatorWidget("Matching password text required", true);
    table.setWidget(5, 1, passwordConfirmSupplied);

    confirmPassword = new PasswordTextBox();
    confirmPassword.setVisibleLength(30);
    confirmPassword.addChangeHandler(update);
    confirmPassword.addKeyUpHandler(keyup);
    table.setWidget(5, 2, confirmPassword);

    Label lblNewLabel_5 = new Label("Amazon EC2 Access Key ID");
    table.setWidget(6, 0, lblNewLabel_5);
    accessKeySupplied = new ValidInputIndicatorWidget("Access key required", true);
    table.setWidget(6, 1, accessKeySupplied);

    accessKey = new TextBox();
    accessKey.setVisibleLength(30);
    accessKey.addChangeHandler(update);
    accessKey.addKeyUpHandler(keyup);
    table.setWidget(6, 2, accessKey);

    Label lblNewLabel_6 = new Label("Amazon EC2 Secret Access Key");
    table.setWidget(7, 0, lblNewLabel_6);
    ec2SecretSupplied = new ValidInputIndicatorWidget("Amazon EC2 secret access key required", true);
    table.setWidget(7, 1, ec2SecretSupplied);

    ec2Secret = new PasswordTextBox();
    ec2Secret.setVisibleLength(30);
    ec2Secret.addChangeHandler(update);
    ec2Secret.addKeyUpHandler(keyup);
    table.setWidget(7, 2, ec2Secret);

    Label lblNewLabel_7 = new Label("Confirm EC2 Secret Access Key");
    table.setWidget(8, 0, lblNewLabel_7);
    ec2ConfirmSupplied = new ValidInputIndicatorWidget("Matching Amazon EC2 secret access key required", true);
    table.setWidget(8, 1, ec2ConfirmSupplied);

    confirmSecret = new PasswordTextBox();
    confirmSecret.setVisibleLength(30);
    confirmSecret.addChangeHandler(update);
    confirmSecret.addKeyUpHandler(keyup);
    table.setWidget(8, 2, confirmSecret);

    cancel = new Button("cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_cancel();
        }
    });

    table.setWidget(9, 3, cancel);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    save = new Button("register", new ClickHandler() {
        public void onClick(ClickEvent event) {
            do_save();
        }
    });
    table.setWidget(9, 2, save);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 2, HasHorizontalAlignment.ALIGN_RIGHT);
    save.setEnabled(false);
    errorsOnPage = new ValidInputIndicatorWidget(
            "check for missing or invalid parameters marked with this icon", true);
    table.setWidget(9, 1, errorsOnPage);
    table.getFlexCellFormatter().setHorizontalAlignment(9, 3, HasHorizontalAlignment.ALIGN_RIGHT);

    for (int i = 1; i < 9; i++) {
        table.getFlexCellFormatter().setColSpan(i, 2, 3);
        table.getFlexCellFormatter().setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        table.getFlexCellFormatter().setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        table.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_LEFT);

    }

    table.getColumnFormatter().setWidth(1, "18px");
    table.getColumnFormatter().setWidth(4, "18px");
    table.getFlexCellFormatter().setColSpan(0, 0, 4);
    table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    this.add(table);
    this.center();
}

From source file:n3phele.client.view.ProcessView.java

License:Open Source License

public ProcessView() {
    super(new MenuItem(N3phele.n3pheleResource.activityIcon(), "Activity", null));
    table = new FlexTable();
    table.setCellPadding(2);//w  ww.  j  a  v a 2  s  .com

    this.add(table);
    table.setWidth("100%");

    Label lblNewLabel_4 = new Label("name");
    table.setWidget(0, 0, lblNewLabel_4);

    name = new Label("");
    table.setWidget(0, 1, name);

    iconStatus = new CellWidget<IconText>(new IconTextCell<IconText>(32, 32, 15));
    table.setWidget(0, 2, iconStatus);
    table.getColumnFormatter().setWidth(0, "60px");
    table.getColumnFormatter().setWidth(2, "170px");

    Label lblNewLabel = new Label("running");
    table.setWidget(1, 0, lblNewLabel);

    command = new Hyperlink("", "");
    table.setWidget(1, 1, command);
    table.getFlexCellFormatter().setColSpan(1, 1, 2);

    //      description = new Label("-description-");
    //      table.setWidget(1, 2, description);

    Label lblNewLabel_3 = new Label("started");
    table.setWidget(2, 0, lblNewLabel_3);

    startdate = new CellWidget<Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT)));

    table.setWidget(2, 1, startdate);
    //table.getFlexCellFormatter().setColSpan(2, 1, 2);

    Label lblNewLabel_6 = new Label("completed");
    table.setWidget(3, 0, lblNewLabel_6);

    completedate = new CellWidget<Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT)));
    table.setWidget(3, 1, completedate);
    //table.getFlexCellFormatter().setColSpan(3, 1, 2);

    duration = new Label(".duration");
    table.setWidget(3, 2, duration);

    if (resource == null)
        resource = GWT.create(NarrativeListCellTableResource.class);
    narrativeTable = new CellTable<Narrative>(15, resource);
    this.add(narrativeTable);
    narrativeTable.setWidth("100%", true);

    final Map<String, ImageResource> mapper = new HashMap<String, ImageResource>();
    mapper.put("info", N3phele.n3pheleResource.narrativeInfo());
    mapper.put("warning", N3phele.n3pheleResource.narrativeWarning());
    mapper.put("error", N3phele.n3pheleResource.narrativeError());
    state = new Column<Narrative, ImageResource>(new ImageResourceCell()) {
        @Override
        public ImageResource getValue(Narrative object) {
            return mapper.get(object.getState());
        }
    };
    state.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    state.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    narrativeTable.addColumn(state);
    narrativeTable.setColumnWidth(state, "8%");

    Column<Narrative, Date> date = new Column<Narrative, Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))) {
        @Override
        public Date getValue(Narrative object) {
            return object.getStamp();
        }
    };
    narrativeTable.addColumn(date);
    narrativeTable.setColumnWidth(date, "15%");

    Column<Narrative, Hyperlink> id = new Column<Narrative, Hyperlink>(new HyperlinkCell()) {

        @Override
        public Hyperlink getValue(Narrative object) {
            if (object == null)
                return null;
            String name = object.getTag();
            String historyToken = presenter.getToken(object.getProcessUri());
            return new Hyperlink(name, historyToken);
        }

    };
    id.setFieldUpdater(new FieldUpdater<Narrative, Hyperlink>() {
        @Override
        public void update(int index, Narrative object, Hyperlink value) {
            ProcessView.this.narrativeTable.setFocus(false);
        }
    });
    id.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    id.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    narrativeTable.addColumn(id);
    narrativeTable.setColumnWidth(id, "20%");

    TextColumn<Narrative> msg = new TextColumn<Narrative>() {
        @Override
        public String getValue(Narrative object) {
            return object.getText();
        }
    };
    msg.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    msg.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    narrativeTable.addColumn(msg);
    narrativeTable.setColumnWidth(msg, "60%");
}

From source file:n3phele.client.view.ProgressView.java

License:Open Source License

public ProgressView() {
    super(new MenuItem(N3phele.n3pheleResource.activityIcon(), "Activity", null));
    table = new FlexTable();
    table.setCellPadding(2);/*from ww w  .jav a2 s  . co  m*/

    this.add(table);
    //table.setSize("478px", "260px");

    Label lblNewLabel_4 = new Label("name");
    table.setWidget(0, 0, lblNewLabel_4);

    name = new Label("");
    table.setWidget(0, 1, name);

    iconStatus = new CellWidget<IconText>(new IconTextCell<IconText>(32, 32, 15));
    //      {
    //         @Override
    //         public IconText getValue(Progress progress) {
    //            String status = progress.getStatus();
    //            ImageResource icon = statusVizualization.get(status);
    //            if(icon != null) return new IconText(icon, progress.getName());
    //            return new IconText(getTemplate().statusBar(getPercentComplete(progress), barUrl ), progress.getName()); // make progress bar
    //         }
    //      };

    table.setWidget(0, 2, iconStatus);

    Label lblNewLabel = new Label("running");
    table.setWidget(1, 0, lblNewLabel);

    command = new Hyperlink("", "");
    table.setWidget(1, 1, command);

    description = new Label("-description-");
    table.setWidget(1, 2, description);

    Label lblNewLabel_3 = new Label("started");
    table.setWidget(2, 0, lblNewLabel_3);

    startdate = new CellWidget<Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT)));

    table.setWidget(2, 1, startdate);
    table.getFlexCellFormatter().setColSpan(2, 1, 2);

    Label lblNewLabel_6 = new Label("completed");
    table.setWidget(3, 0, lblNewLabel_6);

    completedate = new CellWidget<Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT)));
    table.setWidget(3, 1, completedate);
    table.getFlexCellFormatter().setColSpan(3, 1, 2);

    Label lblNewLabel_7 = new Label("estimated duration", true);
    table.setWidget(4, 0, lblNewLabel_7);

    duration = new Label(".duration");
    table.setWidget(4, 1, duration);
    table.getFlexCellFormatter().setColSpan(4, 1, 2);
    if (resource == null)
        resource = GWT.create(NarrativeListCellTableResource.class);
    narrativeTable = new CellTable<Narrative>(15, resource);
    this.add(narrativeTable);
    narrativeTable.setWidth("100%", true);

    final Map<String, ImageResource> mapper = new HashMap<String, ImageResource>();
    mapper.put("info", N3phele.n3pheleResource.narrativeInfo());
    mapper.put("warning", N3phele.n3pheleResource.narrativeWarning());
    mapper.put("error", N3phele.n3pheleResource.narrativeError());
    state = new Column<Narrative, ImageResource>(new ImageResourceCell()) {
        @Override
        public ImageResource getValue(Narrative object) {
            return mapper.get(object.getState());
        }
    };
    state.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    state.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    narrativeTable.addColumn(state);
    narrativeTable.setColumnWidth(state, "8%");

    Column<Narrative, Date> date = new Column<Narrative, Date>(
            new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))) {
        @Override
        public Date getValue(Narrative object) {
            return object.getStamp();
        }
    };
    narrativeTable.addColumn(date);
    narrativeTable.setColumnWidth(date, "15%");

    TextColumn<Narrative> id = new TextColumn<Narrative>() {
        @Override
        public String getValue(Narrative object) {
            return object.getId();
        }
    };
    id.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    id.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    narrativeTable.addColumn(id);
    narrativeTable.setColumnWidth(id, "20%");

    TextColumn<Narrative> msg = new TextColumn<Narrative>() {
        @Override
        public String getValue(Narrative object) {
            return object.getText();
        }
    };
    msg.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    msg.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    narrativeTable.addColumn(msg);
    narrativeTable.setColumnWidth(msg, "60%");
}