List of usage examples for com.google.gwt.user.client.ui Label Label
protected Label(Element element)
From source file:client.template.page.DefaultPage.java
License:Open Source License
/** * Creates a default page with title + describing text *///from www .j av a 2 s .c om public DefaultPage(final String title, final String text) { final FlexTable table = new FlexTable(); final HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setStyleName("gui-DefaultPage"); hPanel.add(new Image("phosphoruslogo.png")); final VerticalPanel vPanel = new VerticalPanel(); final Label titleLabel = new Label(title); titleLabel.setStyleName("gui-DefaultPage-Title"); vPanel.add(titleLabel); final HTML ruler = new HTML("<hr />"); ruler.setStyleName("gui-DefaultPage-Ruler"); vPanel.add(ruler); final Label textLabel = new Label(text); textLabel.setStyleName("gui-DefaultPage-Text"); vPanel.add(textLabel); hPanel.add(vPanel); table.setWidget(0, 0, hPanel); table.setWidth("100%"); table.setHeight("100%"); table.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); this.initWidget(table); }
From source file:client.tools.page.ConsoleSettingsPage.java
License:Open Source License
/** * //from w w w. ja v a2 s. com */ public ConsoleSettingsPage() { final VerticalPanel panel = new VerticalPanel(); final int cookie = this.getValue(); final Label label = new Label("Console LogLevel"); panel.add(label); // Make some radio buttons, all in one group. this.rb0 = new RadioButton("logLevelGrp", "Trace"); this.rb1 = new RadioButton("logLevelGrp", "Debug"); this.rb2 = new RadioButton("logLevelGrp", "Warn"); this.rb4 = new RadioButton("logLevelGrp", "Error"); this.rb3 = new RadioButton("logLevelGrp", "Fatal"); this.button = new Button("Save"); this.button.addClickListener(this); if (GuiLogger.DEBUG == cookie) { this.rb1.setChecked(true); } else if (GuiLogger.WARN == cookie) { this.rb2.setChecked(true); } else if (GuiLogger.ERROR == cookie) { this.rb3.setChecked(true); } else if (GuiLogger.FATAL == cookie) { this.rb4.setChecked(true); } else { this.rb0.setChecked(true); } panel.add(this.rb0); panel.add(this.rb1); panel.add(this.rb2); panel.add(this.rb3); panel.add(this.rb4); panel.add(this.button); this.initWidget(panel); }
From source file:cmg.org.monitor.module.client.InviteUser.java
License:Open Source License
/** * Show dialog invited./*w w w. j a va2s . c o m*/ */ static void showDialogInvited() { dialogInvite = new DialogBox(); dialogInvite.setAnimationEnabled(true); final Button exitButton = new Button(); exitButton.setStyleName(""); exitButton.getElement().setId("closeButton"); exitButton.addStyleName("align=right"); exitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogInvite.hide(); } }); btt_invite = new Button("Invite"); btt_invite.setStyleName("margin:6px;"); btt_invite.addStyleName("form-button"); btt_invite.addClickHandler(new inviteUserHandler()); btt_reset = new Button("Reset"); btt_reset.setStyleName("margin:6px;"); btt_reset.addStyleName("form-button"); btt_reset.addClickHandler(new ResetInviteHandler()); txt_email = new TextArea(); txt_email.setTitle("Invite user"); txt_email.setWidth("400px"); txt_email.setHeight("100px"); FlexTable panelButton = new FlexTable(); panelButton.setWidget(0, 0, btt_invite); panelButton.setWidget(0, 1, btt_reset); panelButton.setCellPadding(5); panelButton.setCellSpacing(5); panelValidateEmail = new AbsolutePanel(); panelValidateEmail.setVisible(false); listGroupInvi = new ListBox(); listGroupInvi.setTitle("List Group"); listGroupInvi.setWidth("200px"); for (SystemGroup s : listGroup) { listGroupInvi.addItem(s.getName()); } Label lblEmail = new Label("Gmail Address"); FlexTable table = new FlexTable(); table.setCellPadding(5); table.setCellSpacing(5); table.setWidget(0, 0, lblEmail); table.setWidget(0, 1, txt_email); table.setWidget(0, 2, panelValidateEmail); table.setWidget(0, 3, listGroupInvi); /*table.setWidget(2, 0, panelLog);*/ table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_LEFT); table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.add(exitButton); dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(table); dialogVPanel.add(panelButton); dialogVPanel.setCellHorizontalAlignment(panelButton, VerticalPanel.ALIGN_RIGHT); dialogInvite.setWidget(dialogVPanel); dialogInvite.getCaption().asWidget().setStyleName("myCaption"); dialogInvite.center(); }
From source file:co.edu.udea.iw.rtf.client.ui.AsignarSolicitudViewImpl.java
License:Open Source License
public AsignarSolicitudViewImpl() { initWidget(binder.createAndBindUi(this)); labelCelular = new Label("Celular: "); labelCorreoElectronico = new Label("Correo Electrnico: "); labelNombreCompleto = new Label("Nombre completo: "); labelNombreProducto = new Label("Producto: "); labelNombreSucursal = new Label("Sucursal: "); labelNombreTipoSolicitud = new Label("Tipo de solicitud: "); labelTelefono = new Label("Telefono: "); labelTextoSolicitud = new Label("Texto de la solicitud: "); labelUsuarioAsigando = new Label("usuario asignado: "); labelUsuarioAsignadoError = new Label(""); textBoxCelular = new TextBox(); textBoxCorreoElectronico = new TextBox(); textBoxNombreProducto = new TextBox(); textBoxNombreSolicitante = new TextBox(); textBoxNombreSucursal = new TextBox(); textBoxNombreTipoSolicitud = new TextBox(); textBoxTelefono = new TextBox(); textBoxTextoSolicitud = new TextArea(); listBoxUsuarioAsignado = new ListBox(); textBoxCelular.setReadOnly(true);/* w ww . j ava2 s. c o m*/ textBoxCorreoElectronico.setReadOnly(true); textBoxNombreProducto.setReadOnly(true); textBoxNombreSolicitante.setReadOnly(true); textBoxNombreSucursal.setReadOnly(true); textBoxNombreTipoSolicitud.setReadOnly(true); textBoxTelefono.setReadOnly(true); textBoxTextoSolicitud.setReadOnly(true); tabla.setWidget(0, 0, labelNombreCompleto); tabla.setWidget(0, 1, textBoxNombreSolicitante); tabla.setWidget(1, 0, labelCorreoElectronico); tabla.setWidget(1, 1, textBoxCorreoElectronico); tabla.setWidget(2, 0, labelTelefono); tabla.setWidget(2, 1, textBoxTelefono); tabla.setWidget(3, 0, labelCelular); tabla.setWidget(3, 1, textBoxCelular); tabla.setWidget(4, 0, labelNombreSucursal); tabla.setWidget(4, 1, textBoxNombreSucursal); tabla.setWidget(5, 0, labelNombreProducto); tabla.setWidget(5, 1, textBoxNombreProducto); tabla.setWidget(6, 0, labelNombreTipoSolicitud); tabla.setWidget(6, 1, textBoxNombreTipoSolicitud); tabla.setWidget(7, 0, labelTextoSolicitud); tabla.setWidget(7, 1, textBoxTextoSolicitud); tabla.setWidget(8, 0, labelUsuarioAsigando); tabla.setWidget(8, 1, listBoxUsuarioAsignado); tabla.setWidget(8, 2, labelUsuarioAsignadoError); textBoxCelular.addStyleName("textBox"); textBoxCorreoElectronico.addStyleName("textBox"); textBoxNombreProducto.addStyleName("textBox"); textBoxNombreSolicitante.addStyleName("textBox"); textBoxNombreSucursal.addStyleName("textBox"); textBoxNombreTipoSolicitud.addStyleName("textBox"); textBoxTelefono.addStyleName("textBox"); textBoxTextoSolicitud.addStyleName("area"); listBoxUsuarioAsignado.addStyleName("lista"); }
From source file:co.edu.udea.iw.rtf.client.ui.CrearSolicitudViewImpl.java
License:Open Source License
public CrearSolicitudViewImpl() { initWidget(binder.createAndBindUi(this)); labelNombresSolicitante = new Label("* Nombres: "); labelApellidosSolicitante = new Label("* Apellidos: "); labelCelular = new Label("Celular: "); labelCorreoElectronico = new Label("* Correo electrnico: "); labelConfirmacionCorreo = new Label("* Confirmacin del correo: "); labelTelefono = new Label("* Telefono: "); labelOtroProducto = new Label("Otro producto: "); labelProducto = new Label("* Producto: "); labelSucursal = new Label("* Sucursal: "); labelTextoSolicitud = new Label("* Texto de la solicitud: "); labelTipoSolicitud = new Label("* Tipo de solicitud: "); labelNombresSolicitanteError = new Label(); labelApellidosSolicitanteError = new Label(); labelCelularError = new Label(); labelCorreoElectronicoError = new Label(); labelConfirmacionCorreoError = new Label(); labelTelefonoError = new Label(); labelOtroProductoError = new Label(); labelProductoError = new Label(); labelSucursalError = new Label(); labelTextoSolicitudError = new Label(); labelTipoSolicitudError = new Label(); textBoxApellidosSolicitante = new TextBox(); textBoxCelular = new TextBox(); textBoxConfirmacionCorreo = new TextBox(); textBoxCorreoElectronico = new TextBox(); textBoxNombresSolicitante = new TextBox(); textBoxOtroProducto = new TextBox(); textBoxTelefono = new TextBox(); textBoxTextoSolicitud = new TextArea(); listBoxProducto = new ListBox(); listBoxSuscursal = new ListBox(); listBoxTipoSolicitud = new ListBox(); textBoxNombresSolicitante.setMaxLength(45); textBoxApellidosSolicitante.setMaxLength(45); textBoxTelefono.setMaxLength(15);//from ww w . j a v a 2s. c o m textBoxCelular.setMaxLength(15); textBoxCorreoElectronico.setMaxLength(120); textBoxConfirmacionCorreo.setMaxLength(120); labelNombresSolicitante.addStyleName("label"); labelApellidosSolicitante.addStyleName("label"); labelCelular.addStyleName("label"); labelCorreoElectronico.addStyleName("label"); labelConfirmacionCorreo.addStyleName("label"); labelTelefono.addStyleName("label"); labelOtroProducto.addStyleName("label"); labelProducto.addStyleName("label"); labelSucursal.addStyleName("label"); labelTextoSolicitud.addStyleName("label"); labelTipoSolicitud.addStyleName("label"); textBoxNombresSolicitante.addStyleName("textBox"); textBoxApellidosSolicitante.addStyleName("textBox"); textBoxCorreoElectronico.addStyleName("textBox"); textBoxConfirmacionCorreo.addStyleName("textBox"); textBoxTelefono.addStyleName("textBox"); textBoxCelular.addStyleName("textBox"); textBoxOtroProducto.addStyleName("textBox"); textBoxTextoSolicitud.addStyleName("area"); listBoxProducto.addStyleName("lista"); listBoxSuscursal.addStyleName("lista"); listBoxTipoSolicitud.addStyleName("lista"); tabla.setWidget(0, 0, labelNombresSolicitante); tabla.setWidget(0, 1, textBoxNombresSolicitante); tabla.setWidget(0, 2, labelNombresSolicitanteError); tabla.setWidget(1, 0, labelApellidosSolicitante); tabla.setWidget(1, 1, textBoxApellidosSolicitante); tabla.setWidget(1, 2, labelApellidosSolicitanteError); tabla.setWidget(2, 0, labelCorreoElectronico); tabla.setWidget(2, 1, textBoxCorreoElectronico); tabla.setWidget(2, 2, labelCorreoElectronicoError); tabla.setWidget(3, 0, labelConfirmacionCorreo); tabla.setWidget(3, 1, textBoxConfirmacionCorreo); tabla.setWidget(3, 2, labelConfirmacionCorreoError); tabla.setWidget(4, 0, labelTelefono); tabla.setWidget(4, 1, textBoxTelefono); tabla.setWidget(4, 2, labelTelefonoError); tabla.setWidget(5, 0, labelCelular); tabla.setWidget(5, 1, textBoxCelular); tabla.setWidget(5, 2, labelCelularError); tabla.setWidget(6, 0, labelProducto); tabla.setWidget(6, 1, listBoxProducto); tabla.setWidget(6, 2, labelProductoError); tabla.setWidget(7, 0, labelOtroProducto); tabla.setWidget(7, 1, textBoxOtroProducto); tabla.setWidget(7, 2, labelOtroProductoError); tabla.setWidget(8, 0, labelSucursal); tabla.setWidget(8, 1, listBoxSuscursal); tabla.setWidget(8, 2, labelSucursalError); tabla.setWidget(9, 0, labelTipoSolicitud); tabla.setWidget(9, 1, listBoxTipoSolicitud); tabla.setWidget(9, 2, labelTipoSolicitudError); tabla.setWidget(10, 0, labelTextoSolicitud); tabla.setWidget(10, 1, textBoxTextoSolicitud); tabla.setWidget(10, 2, labelTextoSolicitudError); dialogBox = new DialogBox(); dialogBox.setText("Default Dialog Text"); dialogBox.setAnimationEnabled(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); dialogBox.hide(); // Add a handler to close the DialogBox closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); }
From source file:com.acme.gwt.client.TvGuide.java
License:Apache License
public void onModuleLoad() { //code from jnorthrup's fork, will be moved to a presenter soon enough EventBus eventBus = GWT.create(SimpleEventBus.class); final MyRequestFactory rf = GWT.create(MyRequestFactory.class); rf.initialize(eventBus);// w w w. ja v a 2s.c om final GateKeeper gateKeeper = new GateKeeper(); new DialogBox() { { final TextBox email = new TextBox() { { setText("you@example.com"); } }; final PasswordTextBox passwordTextBox = new PasswordTextBox(); setText("please log in"); setWidget(new VerticalPanel() { { add(new HorizontalPanel() { { add(new Label("email")); add(email); } }); add(new HorizontalPanel() { { add(new Label("Password")); add(passwordTextBox); } }); add(new Button("OK!!") { { addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String text = passwordTextBox.getText(); String digest = Md5.md5Hex(text); Request<TvViewerProxy> authenticate = rf.reqViewer() .authenticate(email.getText(), digest); authenticate .with("geo", "name", "favoriteShows.name", "favoriteShows.description") .to(gateKeeper).fire(new Receiver<Void>() { @Override public void onSuccess(Void response) { hide(); //todo: review for a purpose removeFromParent(); } }); } }); } }); } }); center(); show(); } }; }
From source file:com.agnie.gwt.common.client.widget.SuggestionBox.java
License:Open Source License
public SuggestionBox() { container = (HTMLPanel) uiBinder.createAndBindUi(this); initWidget(container);/*from ww w . j a v a2s . c o m*/ list.setVisible(false); Label label = new Label(I18.messages.noData()); list.setEmptyListWidget(label); dp.addDataDisplay(list); search.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { list.setVisible(true); } }); list.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // Add a selection model to handle user selection. final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(); list.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { String selected = selectionModel.getSelectedObject(); if (selected != null) { Window.alert("You selected: " + selected); } } }); }
From source file:com.agnie.useradmin.contextmgr.client.presenter.shared.ui.CTXUsersCellTable.java
License:Open Source License
public CTXUsersCellTable() { initWidget(uiBinder.createAndBindUi(this)); multiSelectionModel = new MultiSelectionModel<UserApplicationCtxRegistrationPx>(keyProvider); table.setPageSize(ApplicationConfig.getInstance().getPageSize()); Column<UserApplicationCtxRegistrationPx, Boolean> select = new Column<UserApplicationCtxRegistrationPx, Boolean>( new CheckboxCell(true, false)) { @Override/*from ww w . ja va 2 s .co m*/ public Boolean getValue(UserApplicationCtxRegistrationPx object) { return multiSelectionModel.isSelected(object); } }; table.addColumn(select, messages.select()); Column<UserApplicationCtxRegistrationPx, String> fname = new TextColumn<UserApplicationCtxRegistrationPx>() { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return object.getUser().getFirstName(); } }; fname.setSortable(true); fname.setDataStoreName("user.firstName"); table.addColumn(fname, messages.fName()); Column<UserApplicationCtxRegistrationPx, String> lName = new TextColumn<UserApplicationCtxRegistrationPx>() { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return object.getUser().getLastName(); } }; lName.setSortable(true); lName.setDataStoreName("user.lastName"); table.addColumn(lName, messages.lName()); Column<UserApplicationCtxRegistrationPx, String> userName = new TextColumn<UserApplicationCtxRegistrationPx>() { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return object.getUser().getUserName(); } }; userName.setSortable(true); userName.setDataStoreName("user.userName"); table.addColumn(userName, messages.uName()); Column<UserApplicationCtxRegistrationPx, String> status = new TextColumn<UserApplicationCtxRegistrationPx>() { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return (object.getStatus() != null ? object.getStatus().getLocalized() : RequestStatus.DISABLED.getLocalized()); } }; status.setSortable(true); status.setDataStoreName("status"); table.addColumn(status, messages.status()); Column<UserApplicationCtxRegistrationPx, String> roles = new Column<UserApplicationCtxRegistrationPx, String>( new ButtonCell()) { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return messages.view_edit(); } }; roles.setFieldUpdater(new FieldUpdater<UserApplicationCtxRegistrationPx, String>() { @Override public void update(int index, UserApplicationCtxRegistrationPx object, String value) { if (presenter.checkPermission(Permissions.CONTEXT_USER_ROLE_MANAGER)) { getViewFactory().getCTXUsersView().getUserCTXRoles(object); } } }); table.addColumn(roles, messages.roles()); Column<UserApplicationCtxRegistrationPx, String> adminRoles = new Column<UserApplicationCtxRegistrationPx, String>( new ButtonCell()) { @Override public String getValue(UserApplicationCtxRegistrationPx object) { return messages.view_edit(); } }; adminRoles.setFieldUpdater(new FieldUpdater<UserApplicationCtxRegistrationPx, String>() { @Override public void update(int index, UserApplicationCtxRegistrationPx object, String value) { if (presenter.checkPermission(Permissions.CONTEXT_USER_ADMIN_ROLE_MANAGER)) { getViewFactory().getCTXUsersView().getUserCTXAdminRoles(object); } } }); table.addColumn(adminRoles, messages.adminRoles()); VerticalPanel panel = new VerticalPanel(); Label label = new Label(messages.no_data()); panel.add(label); panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER); table.setEmptyTableWidget(label); table.setSelectionModel(multiSelectionModel, DefaultSelectionEventManager.<UserApplicationCtxRegistrationPx>createCustomManager( new MultiSelectEventTranslator<UserApplicationCtxRegistrationPx>())); pager.setRangeLimited(true); pager.setDisplay(table); AsyncHandler columnSortHandler = new AsyncHandler(table); table.addColumnSortHandler(columnSortHandler); }
From source file:com.agnie.useradmin.main.client.presenter.sahered.ui.AppUsersCellTable.java
License:Open Source License
public AppUsersCellTable() { initWidget(uiBinder.createAndBindUi(this)); multiSelectionModel = new MultiSelectionModel<UserApplicationRegistrationPx>(keyProvider); table.setPageSize(ApplicationConfig.getInstance().getPageSize()); Column<UserApplicationRegistrationPx, Boolean> select = new Column<UserApplicationRegistrationPx, Boolean>( new CheckboxCell(true, false)) { @Override//from w w w.j a v a 2s.c om public Boolean getValue(UserApplicationRegistrationPx object) { return multiSelectionModel.isSelected(object); } }; table.addColumn(select, messages.select()); Column<UserApplicationRegistrationPx, String> fName = new TextColumn<UserApplicationRegistrationPx>() { @Override public String getValue(UserApplicationRegistrationPx object) { return object.getUser().getFirstName(); } }; fName.setSortable(true); fName.setDataStoreName("user.firstName"); table.addColumn(fName, messages.fName()); Column<UserApplicationRegistrationPx, String> lName = new TextColumn<UserApplicationRegistrationPx>() { @Override public String getValue(UserApplicationRegistrationPx object) { return object.getUser().getLastName(); } }; lName.setSortable(true); lName.setDataStoreName("user.lastName"); table.addColumn(lName, messages.lName()); Column<UserApplicationRegistrationPx, String> userName = new TextColumn<UserApplicationRegistrationPx>() { @Override public String getValue(UserApplicationRegistrationPx object) { return object.getUser().getUserName(); } }; userName.setSortable(true); userName.setDataStoreName("user.userName"); table.addColumn(userName, messages.uName()); Column<UserApplicationRegistrationPx, String> status = new TextColumn<UserApplicationRegistrationPx>() { @Override public String getValue(UserApplicationRegistrationPx object) { return (object.getStatus() != null ? object.getStatus().getLocalized() : RequestStatus.DISABLED.getLocalized()); } }; status.setSortable(true); status.setDataStoreName("status"); table.addColumn(status, messages.status()); Column<UserApplicationRegistrationPx, String> roles = new Column<UserApplicationRegistrationPx, String>( new ButtonCell()) { @Override public String getValue(UserApplicationRegistrationPx object) { return messages.view_edit(); } }; roles.setFieldUpdater(new FieldUpdater<UserApplicationRegistrationPx, String>() { @Override public void update(int index, UserApplicationRegistrationPx object, String value) { if (presenter.checkPermission(Permissions.APPLICATION_USER_ROLE_MANAGER)) { getViewFactory().getAppUsersView().getUserAppRoles(object); } } }); table.addColumn(roles, messages.roles()); Column<UserApplicationRegistrationPx, String> adminRoles = new Column<UserApplicationRegistrationPx, String>( new ButtonCell()) { @Override public String getValue(UserApplicationRegistrationPx object) { return messages.view_edit(); } }; adminRoles.setFieldUpdater(new FieldUpdater<UserApplicationRegistrationPx, String>() { @Override public void update(int index, UserApplicationRegistrationPx object, String value) { if (presenter.checkPermission(Permissions.APPLICATION_USER_ADMIN_ROLE_MANAGER)) { getViewFactory().getAppUsersView().getUserAppAdminRoles(object); } } }); table.addColumn(adminRoles, messages.adminRoles()); VerticalPanel panel = new VerticalPanel(); Label label = new Label(messages.no_data()); panel.add(label); panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER); table.setEmptyTableWidget(label); table.setSelectionModel(multiSelectionModel, DefaultSelectionEventManager.<UserApplicationRegistrationPx>createCustomManager( new MultiSelectEventTranslator<UserApplicationRegistrationPx>())); pager.setRangeLimited(true); pager.setDisplay(table); AsyncHandler columnSortHandler = new AsyncHandler(table); table.addColumnSortHandler(columnSortHandler); }
From source file:com.agnie.useradmin.main.client.presenter.sahered.ui.ManageContextsCellTable.java
License:Open Source License
public ManageContextsCellTable() { initWidget(uiBinder.createAndBindUi(this)); multiSelectionModel = new MultiSelectionModel<ContextPx>(keyProvider); table.setPageSize(ApplicationConfig.getInstance().getPageSize()); Column<ContextPx, String> name = new Column<ContextPx, String>(new TextCell()) { @Override//from w ww. j av a 2 s . c o m public String getValue(ContextPx object) { return object.getName(); } }; table.addColumn(name, I18.messages.name()); Column<ContextPx, String> description = new Column<ContextPx, String>(new TextCell()) { @Override public String getValue(ContextPx object) { return object.getDescription(); } }; table.addColumn(description, I18.messages.description()); VerticalPanel panel = new VerticalPanel(); Label label = new Label(I18.messages.no_data()); panel.add(label); panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER); table.setEmptyTableWidget(label); table.setSelectionModel(multiSelectionModel, DefaultSelectionEventManager .<ContextPx>createCustomManager(new MultiSelectEventTranslator<ContextPx>( new MultiSelectEventTranslator.RowSelectCommand<ContextPx>() { ContextPx selected; @Override public void execute() { getViewFactory().getManageContextsView().setManContextViewData(selected); getViewFactory().getManageContextsView().enableSaveButton(false); getViewFactory().getManageContextsView().deleteBtnVisible(true); getViewFactory().getManageContextsView().setContextToDelete(selected); } @Override public void setSelected(ContextPx selected) { this.selected = selected; } }))); pager.setRangeLimited(true); pager.setDisplay(table); AsyncHandler columnSortHandler = new AsyncHandler(table); table.addColumnSortHandler(columnSortHandler); }