List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:n3phele.client.view.RepoView.java
License:Open Source License
public RepoView() { super(new MenuItem(N3phele.n3pheleResource.repositoryIcon(), "Repository", null)); table = new FlexTable(); table.setCellPadding(10);//from ww w . j a v a 2 s. co m ChangeHandler update = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { validateRepositorySpecification(true); } }; KeyUpHandler keyup = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { validateRepositorySpecification(true); } }; this.repository = 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(30); 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(30); description.addChangeHandler(update); table.setWidget(1, 2, description); Label lblNewLabel_2 = new Label("Location URL"); table.setWidget(2, 0, lblNewLabel_2); // locationUrlSupplied = new ValidInputIndicatorWidget("http, https or ftp URL required", false); locationUrlSupplied = new ValidInputIndicatorWidget("http or https URL required", false); table.setWidget(2, 1, locationUrlSupplied); location = new TextBox(); location.setVisibleLength(30); location.addChangeHandler(update); location.addKeyUpHandler(keyup); table.setWidget(2, 2, location); Label lblNewLabel_3 = new Label("Kind"); table.setWidget(3, 0, lblNewLabel_3); kindSelected = new ValidInputIndicatorWidget("Kind selection required.", false); table.setWidget(3, 1, kindSelected); kind = new ListBox(false); kindMap = new HashMap<String, Integer>(); for (int i = 0; i < kinds.length; i++) { kind.addItem(kinds[i]); kindMap.put(kinds[i], i); } kind.addChangeHandler(update); table.setWidget(3, 2, kind); kind.addChangeHandler(update); kind.addKeyUpHandler(keyup); Label lblNewLabel_4 = new Label("Base path"); table.setWidget(4, 0, lblNewLabel_4); basePathSupplied = new ValidInputIndicatorWidget("bucket or other base path required", false); table.setWidget(4, 1, basePathSupplied); root = new TextBox(); root.setVisibleLength(30); root.addChangeHandler(update); root.addKeyUpHandler(keyup); table.setWidget(4, 2, root); Label lblNewLabel_5 = new Label("Authentication Id"); table.setWidget(5, 0, lblNewLabel_5); gotAuthId = new ValidInputIndicatorWidget("id required", false); table.setWidget(5, 1, gotAuthId); authId = new TextBox(); authId.setVisibleLength(30); authId.addChangeHandler(update); authId.addKeyUpHandler(keyup); table.setWidget(5, 2, authId); Label lblNewLabel_6 = new Label("New password"); table.setWidget(6, 0, lblNewLabel_6); passwordTextSupplied = new ValidInputIndicatorWidget("Password text required", false); table.setWidget(6, 1, passwordTextSupplied); password = new PasswordTextBox(); password.setVisibleLength(30); password.addChangeHandler(update); password.addKeyUpHandler(keyup); table.setWidget(6, 2, password); Label lblNewLabel_7 = new Label("Confirm Password"); table.setWidget(7, 0, lblNewLabel_7); passwordConfirmSupplied = new ValidInputIndicatorWidget("Matching password text required", false); table.setWidget(7, 1, passwordConfirmSupplied); confirmPassword = new PasswordTextBox(); confirmPassword.setVisibleLength(30); confirmPassword.addChangeHandler(update); confirmPassword.addKeyUpHandler(keyup); table.setWidget(7, 2, confirmPassword); lblNewLabel_8 = new Label("Accessible to all n3phele user?"); table.setWidget(8, 0, lblNewLabel_8); isPublic = new SimpleCheckBox(); table.setWidget(8, 1, isPublic); cancel = new Button("cancel", new ClickHandler() { public void onClick(ClickEvent event) { do_cancel(); } }); table.setWidget(9, 3, cancel); save = new Button("save", new ClickHandler() { public void onClick(ClickEvent event) { do_save(); } }); table.setWidget(9, 2, save); table.getFlexCellFormatter().setHorizontalAlignment(9, 3, HasHorizontalAlignment.ALIGN_RIGHT); errorsOnPage = new ValidInputIndicatorWidget( "check for missing or invalid parameters marked with this icon", false); table.setWidget(9, 1, errorsOnPage); for (int i = 0; i < 8; 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, "16px"); table.setCellPadding(1); table.setCellSpacing(5); this.add(table); }
From source file:n3phele.client.view.ServiceDetailsView.java
License:Open Source License
public ServiceDetailsView() { super(new MenuItem(N3phele.n3pheleResource.serviceIcon(), "Service Details", null)); // ******************************************* table = new FlexTable(); table.setCellPadding(10);/*from w w w . j a va2 s . co m*/ noStack = new Label("There's no stacks on this service!"); // Selected service. lblNewLabel = new Label(""); table.setWidget(0, 0, lblNewLabel); table.setWidget(1, 2, cancel); table.getFlexCellFormatter().setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); table.getColumnFormatter().setWidth(0, "25%"); table.getColumnFormatter().setWidth(1, "18px"); table.getColumnFormatter().setWidth(4, "16px"); table.setCellPadding(1); table.setCellSpacing(5); 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.getProcess(); } } }); grid = new CellTable<List<Stack>>(); grid.setWidth("100%", true); HasCell<Stack, ?> nameHasCell = new HasCell<Stack, Stack>() { @Override public Cell<Stack> getCell() { return new StackTextCell(StackNameRenderer.getInstance()); } @Override public FieldUpdater<Stack, Stack> getFieldUpdater() { return new FieldUpdater<Stack, Stack>() { @Override public void update(int index, Stack object, Stack value) { presenter.onSelect(value); } }; } @Override public Stack getValue(Stack object) { return object; } }; HasCell<Stack, ?> versionHasCell = new HasCell<Stack, Stack>() { @Override public Cell<Stack> getCell() { return new StackTextCell(StackVersionRenderer.getInstance()); } @Override public FieldUpdater<Stack, Stack> getFieldUpdater() { return new FieldUpdater<Stack, Stack>() { @Override public void update(int index, Stack object, Stack value) { presenter.onSelect(value); } }; } @Override public Stack getValue(Stack object) { return object; } }; List<HasCell<Stack, ?>> hasCells = new ArrayList<HasCell<Stack, ?>>(2); hasCells.add(nameHasCell); hasCells.add(versionHasCell); for (int i = 0; i < ROWLENGTH; i++) { Column<List<Stack>, Stack> c = new Column<List<Stack>, Stack>(new CommandIconTextCell( N3phele.n3pheleResource.stackIcon(), new CompositeCell<Stack>(hasCells), i)) { @Override public Stack getValue(List<Stack> object) { int index = ((CommandIconTextCell) this.getCell()).getIndex(); if (index < object.size()) { return object.get(index); } else { return null; } } }; c.setFieldUpdater(new FieldUpdater<List<Stack>, Stack>() { @Override public void update(int index, List<Stack> object, Stack value) { presenter.onSelect(value); if (value != null) { GWT.log("got-201 " + index + " " + value.getName()); } } }); 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; commandActivity.getProcess(); } }); this.add(table); this.add(grid); this.add(noStack); }
From source file:n3phele.client.view.ServiceListView.java
License:Open Source License
public ServiceListView() { super(new MenuItem(N3phele.n3pheleResource.serviceIcon(), "Service List", null), new MenuItem(N3phele.n3pheleResource.serviceIcon(), "create a new service", "service:null")); HorizontalPanel heading = new HorizontalPanel(); heading.setWidth("500px"); heading.setStyleName(N3phele.n3pheleResource.css().sectionPanelHeader()); add(heading);//from w w w. ja va2 s .co 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<CloudProcessSummary> narrative = new TextColumn<CloudProcessSummary>() { @Override public String getValue(CloudProcessSummary process) { String result = ""; List<Narrative> narrative = process.getNarrative(); 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<CloudProcessSummary, CloudProcessSummary> cancelColumn = new Column<CloudProcessSummary, CloudProcessSummary>( new CancelButtonCell<CloudProcessSummary>(new Delegate<CloudProcessSummary>() { @Override public void execute(CloudProcessSummary value) { if (value != null) { cellTable.getSelectionModel().setSelected(value, false); getDialog(value).show(); } } }, "cancel service")) { @Override public CloudProcessSummary getValue(CloudProcessSummary object) { String status = object.getState(); if (status == null || status.equalsIgnoreCase("COMPLETE") || status.equalsIgnoreCase("FAILED") || status.equalsIgnoreCase("CANCELLED")) { return null; } return object; } }; cellTable.addColumn(cancelColumn); cellTable.setColumnWidth(cancelColumn, "26px"); this.add(cellTable); cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); final SingleSelectionModel<CloudProcessSummary> selectionModel = new SingleSelectionModel<CloudProcessSummary>(); cellTable.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { CloudProcessSummary 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(); GWT.log("Fetch " + start); presenter.refresh(start); } }); this.add(cellTable); }
From source file:n3phele.client.view.UserView.java
License:Open Source License
public UserView() { super(new MenuItem(N3phele.n3pheleResource.profileIcon(), "User Profile", null)); table = new FlexTable(); table.setCellPadding(10);/*w w w .j av a 2 s .c om*/ ChangeHandler update = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { validateUser(true); } }; KeyUpHandler keyup = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { validateUser(true); } }; this.user = null; Label lblNewLabel = new Label("Email"); table.setWidget(0, 0, lblNewLabel); emailValid = new ValidInputIndicatorWidget("Email address required", false); table.setWidget(0, 1, emailValid); email = new TextBox(); email.setVisibleLength(30); email.addChangeHandler(update); email.addKeyUpHandler(keyup); table.setWidget(0, 2, email); Label lblNewLabel_1 = new Label("First Name"); table.setWidget(1, 0, lblNewLabel_1); firstNameValid = new ValidInputIndicatorWidget("Text value required", false); table.setWidget(1, 1, firstNameValid); firstName = new TextBox(); firstName.setVisibleLength(30); firstName.addChangeHandler(update); firstName.addKeyUpHandler(keyup); table.setWidget(1, 2, firstName); Label lblNewLabel_2 = new Label("Last Name"); table.setWidget(2, 0, lblNewLabel_2); lastNameValid = new ValidInputIndicatorWidget("Text value required", false); table.setWidget(2, 1, lastNameValid); lastName = new TextBox(); lastName.setVisibleLength(30); lastName.addChangeHandler(update); lastName.addKeyUpHandler(keyup); table.setWidget(2, 2, lastName); Label lblNewLabel_3 = new Label("New password"); table.setWidget(3, 0, lblNewLabel_3); passwordTextSupplied = new ValidInputIndicatorWidget("Password text required", false); table.setWidget(3, 1, passwordTextSupplied); password = new PasswordTextBox(); password.setVisibleLength(30); password.addChangeHandler(update); password.addKeyUpHandler(keyup); table.setWidget(3, 2, password); Label lblNewLabel_4 = new Label("Confirm Password"); table.setWidget(4, 0, lblNewLabel_4); passwordConfirmSupplied = new ValidInputIndicatorWidget("Matching password text required", false); table.setWidget(4, 1, passwordConfirmSupplied); confirmPassword = new PasswordTextBox(); confirmPassword.setVisibleLength(30); confirmPassword.addChangeHandler(update); confirmPassword.addKeyUpHandler(keyup); table.setWidget(4, 2, confirmPassword); cancel = new Button("cancel", new ClickHandler() { public void onClick(ClickEvent event) { do_cancel(); } }); table.setWidget(5, 3, cancel); save = new Button("save", new ClickHandler() { public void onClick(ClickEvent event) { do_save(); } }); table.setWidget(5, 2, save); errorsOnPage = new ValidInputIndicatorWidget( "check for missing or invalid parameters marked with this icon", false); table.setWidget(5, 1, errorsOnPage); table.getFlexCellFormatter().setHorizontalAlignment(5, 3, HasHorizontalAlignment.ALIGN_RIGHT); for (int i = 0; i < 5; 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, "16px"); table.setCellPadding(1); table.setCellSpacing(5); this.add(table); }
From source file:net.autosauler.ballance.client.gui.DatabasePanel.java
License:Apache License
/** * Creates the dump database panel.// w w w .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.cbtltd.client.form.SessionForm.java
@Override public void initialize() { AbstractField.CSS.ensureInjected(); CSS.ensureInjected();//w w w . j av a 2 s.c o m final ScrollPanel scroll = new ScrollPanel(); add(scroll); final HorizontalPanel panel = new HorizontalPanel(); panel.setWidth("100%"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); //panel.addStyleName(AbstractField.CSS.cbtAbstractForm()); //panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); scroll.add(panel); final FlowPanel west = new FlowPanel(); // panel.add(west); final FlowPanel sessionForm = new FlowPanel(); sessionForm.addStyleName(AbstractField.CSS.cbtAbstractControl()); sessionForm.addStyleName(CSS.formStyle()); sessionForm.addStyleName(CSS.magnify()); west.add(sessionForm); final Frame frame = new Frame(HOSTS.cloudUrl()); frame.setStylePrimaryName(CSS.frameStyle()); // panel.add(frame); //Rishi VerticalPanel frontPanel = new VerticalPanel(); frontPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); frontPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); frontPanel.addStyleName(CSS.loginPopup()); panel.add(frontPanel); // Add the header label Label loginFormLabel = new Label(CONSTANTS.headerLabel()); loginFormLabel.addStyleName(CSS.frontHeaderStyle()); frontPanel.add(loginFormLabel); // Create a horizontal panel to add the login window and registration window HorizontalPanel loginRegPanel = new HorizontalPanel(); // Add the login Panel loginRegPanel.add(new LoginWindow()); // Add the registration Panel VerticalPanel registrationPanel = new VerticalPanel(); registrationPanel.addStyleName(CSS.registerForm()); Label registerHeaderLabel = new Label("Register"); registerHeaderLabel.addStyleName(CSS.signLabel()); Label registerPropertyButton = new Label(CONSTANTS.registerPropertyLabel()); registerPropertyButton.addStyleName(CSS.passwordcreateStyle()); registerPropertyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Organization()); } }); Label registerTravelButton = new Label(CONSTANTS.registerTravelLabel()); registerTravelButton.addStyleName(CSS.passwordcreateStyle()); registerTravelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Agent()); } }); registrationPanel.add(registerHeaderLabel); registrationPanel.add(registerPropertyButton); registrationPanel.add(registerTravelButton); loginRegPanel.add(registrationPanel); frontPanel.add(loginRegPanel); //----------------------------------------------- // Log In button //----------------------------------------------- final HTML loginButton = new HTML(CONSTANTS.loginLabel()); loginButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new SessionPopup().center(); } }); loginButton.addStyleName(CSS.sessionButton()); loginButton.addStyleName(CSS.loginButton()); loginButton.addStyleName(AbstractField.CSS.cbtGradientGreen()); sessionForm.add(loginButton); final Label registerLabel = new Label(CONSTANTS.registerLabel()); registerLabel.addStyleName(CSS.registerLabel()); sessionForm.add(registerLabel); //----------------------------------------------- // Register Agent button //----------------------------------------------- final HTML registeragentButton = new HTML(CONSTANTS.registeragentLabel()); registeragentButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Agent()); } }); registeragentButton.addStyleName(CSS.sessionButton()); registeragentButton.addStyleName(CSS.registerButton()); registeragentButton.addStyleName(AbstractField.CSS.cbtGradientBase()); sessionForm.add(registeragentButton); //----------------------------------------------- // Register Manager button //----------------------------------------------- final HTML registermanagerButton = new HTML(CONSTANTS.registermanagerLabel()); registermanagerButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Organization()); } }); registermanagerButton.addStyleName(CSS.sessionButton()); registermanagerButton.addStyleName(CSS.registerButton()); registermanagerButton.addStyleName(AbstractField.CSS.cbtGradientBase()); sessionForm.add(registermanagerButton); //----------------------------------------------- // Register Affiliate button //----------------------------------------------- final HTML registercreatorButton = new HTML(CONSTANTS.registercreatorLabel()); registercreatorButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { PartyPopup.getInstance().show(Party.Type.Affiliate, null, null); } }); registercreatorButton.addStyleName(CSS.sessionButton()); registercreatorButton.addStyleName(CSS.registerButton()); registercreatorButton.addStyleName(AbstractField.CSS.cbtGradientBase()); sessionForm.add(registercreatorButton); Label infoLabel = new Label(CONSTANTS.infoLabel()); infoLabel.addStyleName(CSS.registerLabel()); sessionForm.add(infoLabel); //----------------------------------------------- // More Info button //----------------------------------------------- final HTML infoButton = new HTML(CONSTANTS.infoButton()); infoButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.open(HOSTS.infoUrl(), CONSTANTS.infoTitle(), "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"); } }); infoButton.addStyleName(CSS.sessionButton()); infoButton.addStyleName(CSS.registerButton()); infoButton.addStyleName(AbstractField.CSS.cbtGradientBase()); sessionForm.add(infoButton); FlowPanel shadow = new FlowPanel(); shadow.addStyleName(AbstractField.CSS.cbtAbstractShadow()); west.add(shadow); // if(getUserAgent().contains("msie")) { // loginButton.setVisible(false); // registerLabel.setVisible(false); // registeragentButton.setVisible(false); // registermanagerButton.setVisible(false); // sessionError.setVisible(true); // } onRefresh(); onReset(Session.LOGGED_OUT); }
From source file:net.europa13.taikai.web.client.TaikaiWebEntryPoint.java
License:Open Source License
private void initLogger() { //********************************************************************* // Logger/*from ww w .j a v a2 s. c o m*/ VerticalPanel logPanel = new VerticalPanel(); VerticalPanel logPanelContents = new VerticalPanel(); logPanel.setWidth("100%"); logPanel.setBorderWidth(1); Button logClearBTN = new Button("Tm logg", new ClickListener() { public void onClick(Widget source) { Logger.clear(); } }); HorizontalPanel logPanelHeader = new HorizontalPanel(); logPanelHeader.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); logPanelHeader.add(new HTML("<h2>Logg</h2>")); logPanelHeader.add(logClearBTN); logPanel.add(logPanelHeader); logPanel.add(logPanelContents); RootPanel.get("root_bottom").add(logPanel); Logger.setTarget(new PanelHtmlLogTarget(logPanelContents)); Logger.setLevel(LogLevel.DEBUG); }
From source file:net.meddeb.md.admin.client.MenuLauncher.java
License:Open Source License
private void doLoginAsRoot() { lblHelp.setText(mainMsg.toRootConnect()); final Grid grid = new Grid(4, 2); grid.setWidth("100%"); grid.setCellSpacing(5);//w w w . j a v a 2 s . c o m grid.getColumnFormatter().setWidth(0, "30%"); grid.getColumnFormatter().setWidth(1, "70%"); grid.getCellFormatter().getElement(0, 0).setAttribute("colSpan", "2"); grid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setAlignment(3, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); final Label lblTitle = new Label(mainMsg.rootConnectTitle()); lblTitle.setStyleName("edittitle"); final Label lblLogin = new Label(mainMsg.lblLogin()); final Label lblPassword = new Label(mainMsg.lblPassword()); final TextBox edtLogin = new TextBox(); edtLogin.setWidth("100%"); final PasswordTextBox edtPassword = new PasswordTextBox(); edtPassword.setWidth("100%"); final Button btnConnect = new Button(mainMsg.connect()); btnConnect.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { Login.Access.getInstance().getRootLoginfromServer(edtLogin.getText().trim(), edtPassword.getText().trim(), new AsyncCallback<Logininfo>() { @Override public void onSuccess(Logininfo logInfo) { showConnectstatus(logInfo); if (logInfo == null) { lblHelp.setText(mainMsg.connectErr()); doShowError(mainMsg.connectErr()); } else { RootPanel.get("main").clear(); clearMenu(); setConnected(logInfo.getSessionID()); lblHelp.setText(mainMsg.connected()); menuManager.setRootLoggedinStatus(); } } @Override public void onFailure(Throwable e) { lblHelp.setText(mainMsg.connectErr()); } }); } }); grid.setWidget(0, 0, lblTitle); grid.setWidget(1, 0, lblLogin); grid.setWidget(2, 0, lblPassword); grid.setWidget(1, 1, edtLogin); grid.setWidget(2, 1, edtPassword); grid.setWidget(3, 1, btnConnect); DecoratorPanel mainPanel = new DecoratorPanel(); mainPanel.addStyleName("decPanels"); mainPanel.setWidth("300px"); mainPanel.add(grid); final VerticalPanel basePanel = new VerticalPanel(); basePanel.setWidth("100%"); basePanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); basePanel.add(mainPanel); RootPanel.get("main").clear(); RootPanel.get("main").add(basePanel); }
From source file:net.meddeb.md.admin.client.MenuPQParams.java
License:Open Source License
private void initParamsGrid() { grid.setWidth("100%"); grid.setCellSpacing(5);/*from w w w . j a va2 s .c om*/ grid.getColumnFormatter().setWidth(0, "35%"); grid.getColumnFormatter().setWidth(1, "5%"); grid.getColumnFormatter().setWidth(2, "20%"); grid.getColumnFormatter().setWidth(3, "35%"); grid.getColumnFormatter().setWidth(4, "5%"); grid.getCellFormatter().getElement(3, 1).setAttribute("colSpan", "4"); grid.getCellFormatter().getElement(4, 1).setAttribute("colSpan", "4"); grid.getCellFormatter().setAlignment(4, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidget(1, 0, lblUppers); grid.setWidget(2, 0, lblLowers); grid.setWidget(3, 0, lblForbiddens); grid.setWidget(1, 1, edtUppers); grid.setWidget(2, 1, edtLowers); grid.setWidget(1, 3, lblDigits); grid.setWidget(2, 3, lblSpecials); grid.setWidget(3, 1, edtForbiddens); grid.setWidget(1, 4, edtDigits); grid.setWidget(2, 4, edtSpecials); grid.setWidget(4, 0, btnPanel); }
From source file:net.officefloor.demo.chat.client.ChatWidget.java
License:Open Source License
/** * Initiate.//from w ww . ja va 2 s . co m */ public ChatWidget() { // Provide means to send a message HorizontalPanel messagePanel = new HorizontalPanel(); // messagePanel.setSpacing(10); messagePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); this.add(messagePanel); // Provide message text box this.messageText.setStylePrimaryName("message"); messagePanel.add(this.messageText); this.messageText.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { ChatWidget.this.ensureHaveUserName(); } }); // Provide send button for message Button sendButton = new Button("send"); sendButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ChatWidget.this.sendChatMessage(); } }); messagePanel.add(sendButton); // Provide messages in scroll area VerticalPanel messagesPanel = new VerticalPanel(); messagesPanel.setSize("100%", "100%"); ScrollPanel scrollMessagesPanel = new ScrollPanel(messagesPanel); scrollMessagesPanel.setStylePrimaryName("messages"); this.add(scrollMessagesPanel); // Provide label to display typing users final Label typingLabel = new Label(); typingLabel.setStylePrimaryName("typing"); messagesPanel.add(typingLabel); typingLabel.setVisible(false); // initially hidden as no typing users // List to contain chat messages Cell<ChatMessage> chatCell = new AbstractCell<ChatMessage>() { @Override public void render(Context context, ChatMessage value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<span><b>"); sb.appendEscaped(value.getUserName()); sb.appendHtmlConstant("</b>"); sb.appendEscaped(" > "); sb.appendEscaped(value.getMessage()); sb.appendHtmlConstant("</span>"); } }; CellList<ChatMessage> chatList = new CellList<ChatMessage>(chatCell); messagesPanel.add(chatList); // Add the data final ListDataProvider<ChatMessage> chatEntries = new ListDataProvider<ChatMessage>(); chatEntries.addDataDisplay(chatList); // Handle listening for messages OfficeFloorComet.subscribe(ConversationSubscription.class, new ConversationSubscription() { @Override public void message(ChatMessage message) { // Determine if typing notification String userName = message.getUserName(); if ((ChatWidget.this.userName == null) || (!(ChatWidget.this.userName.equals(userName)))) { // Not user so provide notification of typing if (message.isTyping()) { // Include user as typing if (!(ChatWidget.this.typingUserNames.contains(userName))) { ChatWidget.this.typingUserNames.add(userName); } } else { // User has stopped typing ChatWidget.this.typingUserNames.remove(userName); } } // Display typing notification if (ChatWidget.this.typingUserNames.size() == 0) { // No typing users typingLabel.setVisible(false); } else { // Display the typing users StringBuilder typingUsers = new StringBuilder(); boolean isFirst = true; for (String typingUserName : ChatWidget.this.typingUserNames) { if (!isFirst) { typingUsers.append(", "); } isFirst = false; typingUsers.append(typingUserName); } typingUsers.append(" ... (typing)"); typingLabel.setText(typingUsers.toString()); typingLabel.setVisible(true); } // Add the message (if one provided) String text = message.getMessage(); if (text != null) { List<ChatMessage> list = chatEntries.getList(); if (list.size() == 0) { list.add(message); } else { list.add(0, message); } } } }, null); // Handle submitting a message this.messageText.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { // Obtain the message text and cursor position String message = ChatWidget.this.messageText.getText(); int cursorPosition = ChatWidget.this.messageText.getCursorPos(); // Handle various scenarios of keys for sending/notification switch (event.getNativeKeyCode()) { case KeyCodes.KEY_ENTER: ChatWidget.this.sendChatMessage(); break; case KeyCodes.KEY_BACKSPACE: if (ChatWidget.this.isTyping && (message.length() == 1) && (cursorPosition == 1)) { // No longer typing as deleting last character ChatWidget.this.sendChatMessage(false, null); } break; case KeyCodes.KEY_DELETE: if (ChatWidget.this.isTyping && (message.length() == 1) && (cursorPosition == 0)) { // No longer typing as deleting last character ChatWidget.this.sendChatMessage(false, null); } break; case KeyCodes.KEY_ALT: case KeyCodes.KEY_CTRL: case KeyCodes.KEY_DOWN: case KeyCodes.KEY_END: case KeyCodes.KEY_ESCAPE: case KeyCodes.KEY_HOME: case KeyCodes.KEY_LEFT: case KeyCodes.KEY_PAGEDOWN: case KeyCodes.KEY_PAGEUP: case KeyCodes.KEY_RIGHT: case KeyCodes.KEY_SHIFT: case KeyCodes.KEY_UP: // Do nothing break; default: if ((!ChatWidget.this.isTyping) && (message.length() == 0)) { // Started typing a message ChatWidget.this.sendChatMessage(true, null); } break; } } }); }