List of usage examples for com.google.gwt.user.client.ui ValueListBox ValueListBox
public ValueListBox(Renderer<T> renderer)
From source file:org.javahispano.javaleague.client.application.cars.car.CarView.java
License:Apache License
@Inject CarView(Binder uiBinder, Driver driver, CarPropertiesEditor carProperties) { this.driver = driver; this.carProperties = carProperties; manufacturer = new ValueListBox<>(new ManufacturerRenderer()); initWidget(uiBinder.createAndBindUi(this)); driver.initialize(this); }
From source file:org.javahispano.javaleague.client.application.rating.RatingDetailView.java
License:Apache License
@Inject RatingDetailView(Binder uiBinder, Driver driver) { this.driver = driver; car = new ValueListBox<>(new CarRenderer()); initWidget(uiBinder.createAndBindUi(this)); driver.initialize(this); rating.getElement().setAttribute("placeholder", "Your rating"); }
From source file:org.javahispano.javaleague.client.application.rating.ui.EditRatingView.java
License:Apache License
@Inject EditRatingView(Binder uiBinder, Driver driver, EventBus eventBus, CarRenderer carRenderer) { super(eventBus); car = new ValueListBox<>(carRenderer); this.driver = driver; initWidget(uiBinder.createAndBindUi(this)); driver.initialize(this); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.GenerateSdkDialog.java
License:Apache License
public GenerateSdkDialog(String applicationId, SchemaVersions schemaVersions, List<AefMapInfoDto> aefMaps) { super(false, true); this.applicationId = applicationId; this.aefMaps = aefMaps; setWidth("500px"); setTitle(Utils.constants.generate_sdk()); VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4);// w w w .j a v a2 s .c om setWidget(dialogContents); errorPanel = new AlertPanel(AlertPanel.Type.ERROR); errorPanel.setVisible(false); dialogContents.add(errorPanel); FlexTable table = new FlexTable(); table.setCellSpacing(6); int row = 0; ValueChangeHandler<SchemaDto> schemaValueChangeHandler = new ValueChangeHandler<SchemaDto>() { @Override public void onValueChange(ValueChangeEvent<SchemaDto> event) { fireChanged(); } }; Widget label = new Label(Utils.constants.configurationSchemaVersion()); label.addStyleName(REQUIRED); configurationSchemaVersion = new SchemaListBox(); configurationSchemaVersion.setWidth("80px"); List<SchemaDto> confSchemaVersions = schemaVersions.getConfigurationSchemaVersions(); configurationSchemaVersion.setValue(getMaxSchemaVersions(confSchemaVersions)); configurationSchemaVersion.setAcceptableValues(confSchemaVersions); configurationSchemaVersion.addValueChangeHandler(schemaValueChangeHandler); table.setWidget(row, 0, label); table.setWidget(row, 1, configurationSchemaVersion); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); row++; label = new Label(Utils.constants.profileSchemaVersion()); label.addStyleName(REQUIRED); profileSchemaVersion = new SchemaListBox(); profileSchemaVersion.setWidth("80px"); List<SchemaDto> pfSchemaVersions = schemaVersions.getProfileSchemaVersions(); profileSchemaVersion.setValue(getMaxSchemaVersions(pfSchemaVersions)); profileSchemaVersion.setAcceptableValues(pfSchemaVersions); profileSchemaVersion.addValueChangeHandler(schemaValueChangeHandler); table.setWidget(row, 0, label); table.setWidget(row, 1, profileSchemaVersion); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); row++; label = new Label(Utils.constants.notificationSchemaVersion()); label.addStyleName(REQUIRED); notificationSchemaVersion = new SchemaListBox(); notificationSchemaVersion.setWidth("80px"); List<SchemaDto> notSchemaVersions = schemaVersions.getNotificationSchemaVersions(); notificationSchemaVersion.setValue(getMaxSchemaVersions(notSchemaVersions)); notificationSchemaVersion.setAcceptableValues(notSchemaVersions); notificationSchemaVersion.addValueChangeHandler(schemaValueChangeHandler); table.setWidget(row, 0, label); table.setWidget(row, 1, notificationSchemaVersion); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); row++; label = new Label(Utils.constants.logSchemaVersion()); label.addStyleName(REQUIRED); logSchemaVersion = new SchemaListBox(); logSchemaVersion.setWidth("80px"); List<SchemaDto> logSchemaVersions = schemaVersions.getLogSchemaVersions(); logSchemaVersion.setValue(getMaxSchemaVersions(logSchemaVersions)); logSchemaVersion.setAcceptableValues(logSchemaVersions); logSchemaVersion.addValueChangeHandler(schemaValueChangeHandler); table.setWidget(row, 0, label); table.setWidget(row, 1, logSchemaVersion); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); row++; label = new Label(Utils.constants.targetPlatform()); label.addStyleName(REQUIRED); Renderer<SdkPlatform> targetPlatformRenderer = new Renderer<SdkPlatform>() { @Override public String render(SdkPlatform object) { if (object != null) { return Utils.constants.getString(object.getResourceKey()); } else { return ""; } } @Override public void render(SdkPlatform object, Appendable appendable) throws IOException { appendable.append(render(object)); } }; targetPlatform = new ValueListBox<>(targetPlatformRenderer); targetPlatform.setWidth("80px"); // Set default sdk platform targetPlatform.setValue(SdkPlatform.ANDROID); targetPlatform.setAcceptableValues(Arrays.asList(SdkPlatform.values())); targetPlatform.addValueChangeHandler(new ValueChangeHandler<SdkPlatform>() { @Override public void onValueChange(ValueChangeEvent<SdkPlatform> event) { fireChanged(); } }); table.setWidget(row, 0, label); table.setWidget(row, 1, targetPlatform); table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT); row++; FlexTable ecfsTable = new FlexTable(); ecfsTable.setCellSpacing(6); availableAefMaps = new MultiAefMapListBox(); selectedAefMaps = new MultiAefMapListBox(); addAefMapButton = new Button(Utils.constants.add()); removeAefMapButton = new Button(Utils.constants.remove()); VerticalPanel availableEcfsPanel = new VerticalPanel(); availableEcfsPanel.setSpacing(6); Label availableLabel = new Label(Utils.constants.available()); availableEcfsPanel.add(availableLabel); availableEcfsPanel.add(availableAefMaps); VerticalPanel ecfButtonsPanel = new VerticalPanel(); ecfButtonsPanel.setSpacing(6); ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); ecfButtonsPanel.add(addAefMapButton); ecfButtonsPanel.add(removeAefMapButton); VerticalPanel selectedEcfsPanel = new VerticalPanel(); selectedEcfsPanel.setSpacing(6); Label selectedLabel = new Label(Utils.constants.selected()); selectedEcfsPanel.add(selectedLabel); selectedEcfsPanel.add(selectedAefMaps); ecfsTable.setWidget(0, 0, availableEcfsPanel); ecfsTable.setWidget(0, 1, ecfButtonsPanel); ecfsTable.setWidget(0, 2, selectedEcfsPanel); DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs()); ecfsDisclosure.setAnimationEnabled(true); ecfsDisclosure.setContent(ecfsTable); aefMapComparator = new AefMapInfoDtoComparator(); Collections.sort(aefMaps, aefMapComparator); availableAefMaps.setAcceptableValues(aefMaps); addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); addAefMapButton.setEnabled(false); removeAefMapButton.setEnabled(false); addAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addAefMap(); } }); removeAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeAefMap(); } }); availableAefMaps.setSize("150px", "100px"); selectedAefMaps.setSize("150px", "100px"); availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); dialogContents.add(table); dialogContents.add(ecfsDisclosure); generateSdkButton = new Button(Utils.constants.generate_sdk(), new ClickHandler() { @Override public void onClick(ClickEvent event) { performGenerateSdk(); } }); Button closeButton = new Button(Utils.constants.close(), new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); addButton(generateSdkButton); addButton(closeButton); generateSdkButton.setEnabled(false); fireChanged(); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.AddSdkProfileViewImpl.java
License:Apache License
@Override protected void initDetailsTable() { detailsTable.getColumnFormatter().setWidth(0, "250px"); detailsTable.getColumnFormatter().setWidth(1, "500px"); int row = 0;/* w w w . j a v a 2s . c o m*/ Widget label = new Label(Utils.constants.name()); label.addStyleName(REQUIRED); name = new KaaAdminSizedTextBox(256); name.addInputHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, name); row++; label = new Label(Utils.constants.configurationSchemaVersion()); label.addStyleName(REQUIRED); configurationSchemaVersion = new VersionListBox(); configurationSchemaVersion.setWidth("80px"); configurationSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, configurationSchemaVersion); row++; label = new Label(Utils.constants.profileSchemaVersion()); label.addStyleName(REQUIRED); profileSchemaVersion = new VersionListBox(); profileSchemaVersion.setWidth("80px"); profileSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, profileSchemaVersion); row++; label = new Label(Utils.constants.notificationSchemaVersion()); label.addStyleName(REQUIRED); notificationSchemaVersion = new VersionListBox(); notificationSchemaVersion.setWidth("80px"); notificationSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, notificationSchemaVersion); row++; label = new Label(Utils.constants.logSchemaVersion()); label.addStyleName(REQUIRED); logSchemaVersion = new VersionListBox(); logSchemaVersion.setWidth("80px"); logSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, logSchemaVersion); row++; FlexTable ecfsTable = new FlexTable(); ecfsTable.setCellSpacing(6); availableAefMaps = new MultiAefMapListBox(); selectedAefMaps = new MultiAefMapListBox(); addAefMapButton = new Button(Utils.constants.add()); removeAefMapButton = new Button(Utils.constants.remove()); VerticalPanel availableEcfsPanel = new VerticalPanel(); availableEcfsPanel.setSpacing(6); Label availableLabel = new Label(Utils.constants.available()); availableEcfsPanel.add(availableLabel); availableEcfsPanel.add(availableAefMaps); VerticalPanel ecfButtonsPanel = new VerticalPanel(); ecfButtonsPanel.setSpacing(6); ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); ecfButtonsPanel.add(addAefMapButton); ecfButtonsPanel.add(removeAefMapButton); VerticalPanel selectedEcfsPanel = new VerticalPanel(); selectedEcfsPanel.setSpacing(6); Label selectedLabel = new Label(Utils.constants.selected()); selectedEcfsPanel.add(selectedLabel); selectedEcfsPanel.add(selectedAefMaps); ecfsTable.setWidget(0, 0, availableEcfsPanel); ecfsTable.setWidget(0, 1, ecfButtonsPanel); ecfsTable.setWidget(0, 2, selectedEcfsPanel); ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs()); ecfsDisclosure.setAnimationEnabled(true); ecfsDisclosure.setContent(ecfsTable); addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); addAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addAefMap(); } }); removeAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeAefMap(); } }); availableAefMaps.setSize("250px", "100px"); selectedAefMaps.setSize("250px", "100px"); availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); detailsTable.setWidget(row, 0, ecfsDisclosure); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); row++; label = new Label(Utils.constants.defaultUserVerifier()); Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() { @Override public String render(UserVerifierDto object) { if (object != null) { return object.getName(); } else { return ""; } } @Override public void render(UserVerifierDto object, Appendable appendable) throws IOException { appendable.append(render(object)); } }; defaultUserVerifier = new ValueListBox<>(userVerifierRenderer); defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() { @Override public void onValueChange(ValueChangeEvent<UserVerifierDto> event) { fireChanged(); } }); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, defaultUserVerifier); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.GenerateSdkDialog.java
License:Apache License
public GenerateSdkDialog(Listener listener) { super(false, true); this.listener = listener; this.setText(Utils.constants.generateSdk()); VerticalPanel root = new VerticalPanel(); this.setWidget(root); FlexTable grid = new FlexTable(); grid.setCellSpacing(15);/*from w ww . j a v a 2s . c o m*/ grid.getColumnFormatter().setWidth(0, "115px"); grid.getColumnFormatter().setWidth(1, "115px"); Label label = new Label(Utils.constants.targetPlatform()); this.targetPlatform = new ValueListBox<>(new Renderer<SdkPlatform>() { @Override public String render(SdkPlatform object) { if (object != null) { return Utils.constants.getString(object.getResourceKey()); } else { return null; } } @Override public void render(SdkPlatform object, Appendable appendable) throws IOException { appendable.append(this.render(object)); } }); // For some reason this adds a null value to the list box // targetPlatform.setAcceptableValues(Arrays.asList(SdkPlatform.values())); targetPlatform.setWidth("100%"); // TODO: Do something with this workaround for (SdkPlatform value : SdkPlatform.values()) { targetPlatform.setValue(value); } targetPlatform.setValue(SdkPlatform.ANDROID); grid.setWidget(0, 0, label); grid.setWidget(0, 1, targetPlatform); root.add(grid); Button generateSdk = new Button(Utils.constants.generateSdk(), new ClickHandler() { @Override public void onClick(ClickEvent event) { GenerateSdkDialog.this.hide(); if (GenerateSdkDialog.this.listener != null) { SdkPlatform targetPlatform = GenerateSdkDialog.this.targetPlatform.getValue(); GenerateSdkDialog.this.listener.onGenerateSdk(targetPlatform); } } }); Button cancel = new Button(Utils.constants.cancel(), new ClickHandler() { @Override public void onClick(ClickEvent event) { GenerateSdkDialog.this.hide(); if (GenerateSdkDialog.this.listener != null) { GenerateSdkDialog.this.listener.onCancel(); } } }); this.addButton(generateSdk); this.addButton(cancel); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.GenerateSdkViewImpl.java
License:Apache License
@Override protected void initDetailsTable() { detailsTable.getColumnFormatter().setWidth(0, "250px"); detailsTable.getColumnFormatter().setWidth(1, "500px"); int row = 0;/*from w ww . j ava 2 s . c om*/ Widget label = new Label(Utils.constants.configurationSchemaVersion()); label.addStyleName(REQUIRED); configurationSchemaVersion = new SchemaListBox(); configurationSchemaVersion.setWidth("80px"); configurationSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, configurationSchemaVersion); row++; label = new Label(Utils.constants.profileSchemaVersion()); label.addStyleName(REQUIRED); profileSchemaVersion = new SchemaListBox(); profileSchemaVersion.setWidth("80px"); profileSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, profileSchemaVersion); row++; label = new Label(Utils.constants.notificationSchemaVersion()); label.addStyleName(REQUIRED); notificationSchemaVersion = new SchemaListBox(); notificationSchemaVersion.setWidth("80px"); notificationSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, notificationSchemaVersion); row++; label = new Label(Utils.constants.logSchemaVersion()); label.addStyleName(REQUIRED); logSchemaVersion = new SchemaListBox(); logSchemaVersion.setWidth("80px"); logSchemaVersion.addValueChangeHandler(this); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, logSchemaVersion); row++; label = new Label(Utils.constants.targetPlatform()); label.addStyleName(REQUIRED); Renderer<SdkPlatform> targetPlatformRenderer = new Renderer<SdkPlatform>() { @Override public String render(SdkPlatform object) { if (object != null) { return Utils.constants.getString(object.getResourceKey()); } else { return ""; } } @Override public void render(SdkPlatform object, Appendable appendable) throws IOException { appendable.append(render(object)); } }; targetPlatform = new ValueListBox<>(targetPlatformRenderer); targetPlatform.addValueChangeHandler(new ValueChangeHandler<SdkPlatform>() { @Override public void onValueChange(ValueChangeEvent<SdkPlatform> event) { fireChanged(); } }); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, targetPlatform); row++; FlexTable ecfsTable = new FlexTable(); ecfsTable.setCellSpacing(6); availableAefMaps = new MultiAefMapListBox(); selectedAefMaps = new MultiAefMapListBox(); addAefMapButton = new Button(Utils.constants.add()); removeAefMapButton = new Button(Utils.constants.remove()); VerticalPanel availableEcfsPanel = new VerticalPanel(); availableEcfsPanel.setSpacing(6); Label availableLabel = new Label(Utils.constants.available()); availableEcfsPanel.add(availableLabel); availableEcfsPanel.add(availableAefMaps); VerticalPanel ecfButtonsPanel = new VerticalPanel(); ecfButtonsPanel.setSpacing(6); ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); ecfButtonsPanel.add(addAefMapButton); ecfButtonsPanel.add(removeAefMapButton); VerticalPanel selectedEcfsPanel = new VerticalPanel(); selectedEcfsPanel.setSpacing(6); Label selectedLabel = new Label(Utils.constants.selected()); selectedEcfsPanel.add(selectedLabel); selectedEcfsPanel.add(selectedAefMaps); ecfsTable.setWidget(0, 0, availableEcfsPanel); ecfsTable.setWidget(0, 1, ecfButtonsPanel); ecfsTable.setWidget(0, 2, selectedEcfsPanel); ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs()); ecfsDisclosure.setAnimationEnabled(true); ecfsDisclosure.setContent(ecfsTable); addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall()); addAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addAefMap(); } }); removeAefMapButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeAefMap(); } }); availableAefMaps.setSize("250px", "100px"); selectedAefMaps.setSize("250px", "100px"); availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() { @Override public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) { updateAefMapButtons(); } }); detailsTable.setWidget(row, 0, ecfsDisclosure); detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2); row++; label = new Label(Utils.constants.defaultUserVerifier()); Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() { @Override public String render(UserVerifierDto object) { if (object != null) { return object.getName(); } else { return ""; } } @Override public void render(UserVerifierDto object, Appendable appendable) throws IOException { appendable.append(render(object)); } }; defaultUserVerifier = new ValueListBox<>(userVerifierRenderer); defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() { @Override public void onValueChange(ValueChangeEvent<UserVerifierDto> event) { fireChanged(); } }); detailsTable.setWidget(row, 0, label); detailsTable.setWidget(row, 1, defaultUserVerifier); }
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.user.UserViewImpl.java
License:Apache License
@Override protected void initDetailsTable() { userName = new KaaAdminSizedTextBox(DEFAULT_TEXTBOX_SIZE, create); userName.setWidth("100%"); userName.addInputHandler(this); Label userLabel = new Label(Utils.constants.userName()); if (create) { userLabel.addStyleName(REQUIRED); }//from w w w.j a va2s . co m detailsTable.setWidget(0, 0, userLabel); detailsTable.setWidget(0, 1, userName); email = new KaaAdminSizedTextBox(DEFAULT_TEXTBOX_SIZE); email.setWidth("100%"); email.addInputHandler(this); Label emailLabel = new Label(Utils.constants.email()); emailLabel.addStyleName(REQUIRED); detailsTable.setWidget(1, 0, emailLabel); detailsTable.setWidget(1, 1, email); Renderer<KaaAuthorityDto> authorityRenderer = new Renderer<KaaAuthorityDto>() { @Override public String render(KaaAuthorityDto object) { if (object != null) { return Utils.constants.getString(object.getResourceKey()); } else { return ""; } } @Override public void render(KaaAuthorityDto object, Appendable appendable) throws IOException { appendable.append(render(object)); } }; authority = new ValueListBox<>(authorityRenderer); authority.setWidth("100%"); authority.addValueChangeHandler(new ValueChangeHandler<KaaAuthorityDto>() { @Override public void onValueChange(ValueChangeEvent<KaaAuthorityDto> event) { fireChanged(); } }); List<KaaAuthorityDto> possibleAuthorities = new ArrayList<KaaAuthorityDto>(); possibleAuthorities.add(KaaAuthorityDto.TENANT_DEVELOPER); possibleAuthorities.add(KaaAuthorityDto.TENANT_USER); authority.setAcceptableValues(possibleAuthorities); Label authorityLabel = new Label(Utils.constants.accountRole()); authorityLabel.addStyleName(REQUIRED); detailsTable.setWidget(2, 0, authorityLabel); detailsTable.setWidget(2, 1, authority); userName.setFocus(true); }
From source file:org.mklab.taskit.client.ui.admin.UserEditorViewImpl.java
License:Apache License
/** * {@inheritDoc}//from w ww . j a v a 2 s. c o m */ @Override protected Widget initContent() { this.userList = new CellList<UserProxy>(new AbstractCell<UserProxy>() { @Override public void render(@SuppressWarnings("unused") com.google.gwt.cell.client.Cell.Context context, UserProxy value, SafeHtmlBuilder sb) { sb.appendEscaped(value.getAccount().getId()); } }); final SingleSelectionModel<UserProxy> selectionModel = new SingleSelectionModel<UserProxy>(); selectionModel.addSelectionChangeHandler(new Handler() { @Override public void onSelectionChange(@SuppressWarnings("unused") SelectionChangeEvent event) { final UserProxy selectedUser = selectionModel.getSelectedObject(); setEdittingUser(selectedUser); } }); this.userList.setSelectionModel(selectionModel); this.userType = new ValueListBox<UserType>(new Renderer<UserType>() { @Override public String render(UserType object) { if (object == null) return null; return object.name(); } @Override public void render(UserType object, Appendable appendable) throws IOException { appendable.append(render(object)); } }); this.userType.setAcceptableValues(Arrays.asList(UserType.values())); final Binder binder = GWT.create(Binder.class); final Widget content = binder.createAndBindUi(this); final Messages messages = getClientFactory().getMessages(); this.userIdLabel.setText(messages.userIdLabel()); this.passwordLabel.setText(messages.passwordLabel()); this.nameLabel.setText(messages.userNameLabel()); this.userInfoCaption.setCaptionText(messages.userInfoLabel()); this.applyButton.setText(messages.applyLabel()); this.userTypeLabel.setText(messages.userTypeLabel()); this.newCheck.setText(messages.newLabel()); updateEditMode(); return content; }
From source file:org.mklab.taskit.client.ui.AttendanceListViewImpl.java
License:Apache License
/** * {@inheritDoc}/*from ww w . ja v a 2 s . co m*/ */ @Override protected Widget initContent() { this.lectureList = new ValueListBox<LectureListItem>(new Renderer<LectureListItem>() { @SuppressWarnings({ "nls", "deprecation" }) @Override public String render(LectureListItem object) { if (object == null) return null; final String number = getClientFactory().getMessages() .numberLabel(String.valueOf(object.getIndex() + 1)); return number + " " + object.getLecture().getTitle() + " [" + object.getLecture().getDate().toLocaleString() + "]"; } @Override public void render(LectureListItem object, Appendable appendable) throws IOException { appendable.append(render(object)); } }); this.lectureList.addValueChangeHandler(new ValueChangeHandler<AttendanceListViewImpl.LectureListItem>() { @SuppressWarnings("synthetic-access") @Override public void onValueChange(ValueChangeEvent<LectureListItem> event) { AttendanceListViewImpl.this.presenter.lectureSelectionChanged(event.getValue().getLecture()); } }); this.table = new DataGrid<AttendanceListItem>(); final Column<AttendanceListItem, UserProxy> userColumn = new Column<AttendanceListItem, UserProxy>( new AbstractCell<UserProxy>() { @Override public void render(@SuppressWarnings("unused") com.google.gwt.cell.client.Cell.Context context, UserProxy value, SafeHtmlBuilder sb) { sb.appendEscaped(value.getAccount().getId()); } }) { @Override public UserProxy getValue(AttendanceListItem object) { return object.getUser(); } }; this.table.addColumn(userColumn, getClientFactory().getMessages().studentLabel()); for (AttendanceType type : AttendanceType.values()) { final Column<AttendanceListItem, AttendanceListItem> attendanceCell = new Column<AttendanceListItem, AttendanceListItem>( new AttendanceCell(type)) { @Override public AttendanceListItem getValue(AttendanceListItem object) { return object; } }; this.table.addColumn(attendanceCell, getLabelOfAttendanceType(getClientFactory().getMessages(), type)); } this.table.setColumnWidth(userColumn, "7em"); //$NON-NLS-1$ return binder.createAndBindUi(this); }