protected Component buildAndBindList(String key, String caption) { ListSelect field = new ListSelect(); field.setCaption(caption); field.setNullSelectionAllowed(false); field.addValueChangeListener((ValueChangeEvent event) -> { String path = (String) event.getProperty().getValue(); if (path != null) { // open app (subapp) Location location = new RerootBrowserLocation("neatconfiguration", "helperBrowser", path, false); adminEventBus.fireEvent(new LocationChangedEvent(location)); } }); dataBindings.put(key, field); return field; }
protected void updateScheduleFields() { if (agentDeployment.getStartExpression() != null) { String[] fields = agentDeployment.getStartExpression().split(" "); for (int i = 0; i < fields.length; i++) { if (fields[i].equals("?")) { fields[i] = "*"; } String[] values = fields[i].split(","); ListSelect listSelect = ((ListSelect) cronLayout.getComponent(i)); for (Object itemId : listSelect.getItemIds()) { listSelect.unselect(itemId); } for (String value : values) { listSelect.select(value); } } } }
public OrderingListSelect(String caption) { final GridLayout layout = new GridLayout(2, 1); listSelect = new ListSelect(); final VerticalLayout buttonLayout = new VerticalLayout(); buttonLayout.setSpacing(true); layout.addComponent(listSelect, 0, 0); layout.addComponent(buttonLayout, 1, 0); layout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); upButton = new Button("▲"); downButton = new Button("▼"); buttonLayout.addComponent(upButton); buttonLayout.addComponent(downButton); setButtonClickListeners(); listSelect.setCaption(caption); setCompositionRoot(layout); }
private void addList( AbsoluteLayout mainLayout ) { ListSelect list = new ListSelect(); list.setWidth( "100%" ); list.setHeight( "420px" ); list.setNullSelectionAllowed( false ); list.setImmediate( true ); list.addValueChangeListener( new Property.ValueChangeListener() { @Override public void valueChange( Property.ValueChangeEvent event ) { Object value = event.getProperty().getValue(); if ( value != null ) { close(); selectedUser = ( String ) value; showUser( ( String ) value ); } } }); loadData( list ); mainLayout.addComponent( list, "left: 0px; top: 0px;" ); }
private void mostrarEvaluadoresDisponibles( ListSelect tab ) { lstEvaluadores.removeAllItems( ); tab.removeAllItems(); EvaluacionBO evaluacionBO = (EvaluacionBO) ControladorPropietario.getInstance().getAcademUI().getHTTPSession().getAttribute("evaluacion"); RolBO rol = new RolBO(); rol.setEvaluacion( evaluacionBO.getId() ); rol.setNombre( tab.getCaption( ) ); for( UsuarioBO e : evaluacionBO.getEvaluadores( ) ) { if( e.getRoles().contains(rol) ) tab.addItem( e ); else lstEvaluadores.addItem( e ); } }
/** Initialise les listes * @param listSelect * @param container */ private void initListSelect(ListSelect listSelect, BeanItemContainer<DroitFonctionnalite> container){ listSelect.setWidth(100, Unit.PERCENTAGE); listSelect.setMultiSelect(true); listSelect.setNullSelectionAllowed(false); listSelect.setContainerDataSource(container); listSelect.setImmediate(true); listSelect.setRows(17); listSelect.setItemCaptionPropertyId(DroitFonctionnalite_.libFonc.getName()); }
/** * Initialise les listes de PJ * * @param listSelect * @param container */ private void initListSelectPj(ListSelect listSelect, BeanItemContainer<PieceJustif> container) { listSelect.setWidth(100, Unit.PERCENTAGE); listSelect.setMultiSelect(true); listSelect.setNullSelectionAllowed(false); listSelect.setContainerDataSource(container); listSelect.setImmediate(true); listSelect.setItemCaptionPropertyId(PieceJustif_.libPj.getName()); }
/** * Initialise les listes de PJ * * @param listSelect * @param container */ private void initListSelectFormulaire(ListSelect listSelect, BeanItemContainer<Formulaire> container) { listSelect.setWidth(100, Unit.PERCENTAGE); listSelect.setMultiSelect(true); listSelect.setNullSelectionAllowed(false); listSelect.setContainerDataSource(container); listSelect.setImmediate(true); listSelect.setItemCaptionPropertyId(Formulaire_.libFormulaire.getName()); }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // listSelectPDPGroup listSelectPDPGroup = new ListSelect(); listSelectPDPGroup.setImmediate(false); listSelectPDPGroup.setWidth("-1px"); listSelectPDPGroup.setHeight("-1px"); listSelectPDPGroup.setInvalidAllowed(false); listSelectPDPGroup.setRequired(true); mainLayout.addComponent(listSelectPDPGroup); mainLayout.setExpandRatio(listSelectPDPGroup, 1.0f); // buttonSave buttonSave = new Button(); buttonSave.setCaption("Save"); buttonSave.setImmediate(true); buttonSave.setWidth("-1px"); buttonSave.setHeight("-1px"); mainLayout.addComponent(buttonSave); mainLayout.setComponentAlignment(buttonSave, new Alignment(48)); return mainLayout; }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // horizontalLayout_2 horizontalLayout_2 = buildHorizontalLayout_2(); mainLayout.addComponent(horizontalLayout_2); // listSelectAttribute listSelectAttribute = new ListSelect(); listSelectAttribute.setCaption("Dictionary Attributes"); listSelectAttribute.setImmediate(false); listSelectAttribute.setWidth("100.0%"); listSelectAttribute.setHeight("-1px"); listSelectAttribute.setInvalidAllowed(false); listSelectAttribute.setRequired(true); mainLayout.addComponent(listSelectAttribute); mainLayout.setExpandRatio(listSelectAttribute, 1.0f); return mainLayout; }
/** * Method called to generate and bind the Field component corresponding to a * scalar property * @param label * @param propId * @param prop * @return the generated Field object */ protected Field<?> buildAndBindField(String label, String propId, Property<?> prop) { Field<?> field = fieldGroup.buildAndBind(label, propId); Class<?> propType = prop.getType(); if (propId.equals(PROP_ID)) field.setReadOnly(true); else if (propId.endsWith("." + PROP_ID)) field.setVisible(false); else if (propId.endsWith("." + PROP_NAME)) field.setVisible(false); else if (propId.endsWith(PROP_ENABLED)) field.setVisible(false); else if (propId.endsWith(PROP_MODULECLASS)) field.setReadOnly(true); if (propType.equals(String.class)) field.setWidth(500, Unit.PIXELS); else if (propType.equals(int.class) || propType.equals(Integer.class) || propType.equals(float.class) || propType.equals(Float.class) || propType.equals(double.class) || propType.equals(Double.class)) field.setWidth(200, Unit.PIXELS); else if (Enum.class.isAssignableFrom(propType)) ((ListSelect)field).setRows(3); if (field instanceof TextField) { ((TextField)field).setNullSettingAllowed(true); ((TextField)field).setNullRepresentation(""); } return field; }
protected ComboBox getStartTypeComponent() { startTypeCombo = new ComboBox("Start Type"); startTypeCombo.setWidth(200, Unit.PIXELS); startTypeCombo.setNullSelectionAllowed(false); StartType[] values = StartType.values(); for (StartType value : values) { startTypeCombo.addItem(value.name()); } startTypeCombo.setValue(agentDeployment.getStartType()); startTypeCombo.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { agentDeployment.setStartType((String) startTypeCombo.getValue()); updateScheduleEnable(); for (int i = 0; i < 7; i++) { ListSelect listSelect = ((ListSelect) cronLayout.getComponent(i)); for (Object itemId : listSelect.getItemIds()) { listSelect.unselect(itemId); } listSelect.select(listSelect.getItemIds().iterator().next()); } String startExpression = null; if (agentDeployment.getStartType().equals(StartType.SCHEDULED_CRON.name())) { startExpression = "0 0 0 * * ?"; } startExpressionTextField.setValue(startExpression); agentDeployment.setStartExpression(startExpression); updateScheduleFields(); saveAgentDeployment(agentDeployment); } }); return startTypeCombo; }
protected ListSelect getScheduleComponent(String caption) { ListSelect listSelect = new ListSelect(caption); listSelect.setWidth(90, Unit.PIXELS); listSelect.setMultiSelect(true); listSelect.setRows(10); listSelect.setImmediate(true); listSelect.addItem("*"); listSelect.setItemCaption("*", "<All>"); if (caption.equals("Second") || caption.equals("Minute")) { for (int i = 0; i <= 59; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Hour")) { for (int i = 0; i <= 23; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Day")) { for (int i = 1; i <= 31; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Month")) { listSelect.addItems("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"); } else if (caption.equals("Day of Week")) { listSelect.addItems("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"); } else if (caption.equals("Year")) { for (int i = Calendar.getInstance().get(Calendar.YEAR); i <= 2099; i++) { listSelect.addItem(String.valueOf(i)); } } listSelect.select(listSelect.getItemIds().iterator().next()); listSelect.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { updateScheduleExpression(); } }); return listSelect; }
@SuppressWarnings("unchecked") protected Set<Object> getCronValue(int index) { Set<Object> values = (Set<Object>) ((ListSelect) cronLayout.getComponent(index)).getValue(); if (values.contains("*") && values.size() > 1) { values = new HashSet<Object>(); values.add("*"); } return values; }
@Override public void buildDialogLayout() { Map<String, String> env = this.getContext().getEnvironment(); pathToShellScripts = env.get(ExecuteShellScript.SHELL_SCRIPT_PATH); final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true); mainLayout.setSpacing(true); lstScriptName = new ListSelect(ctx.tr("ExecuteShellScript.dialog.scriptName")); lstScriptName.setRows(5); lstScriptName.setNullSelectionAllowed(true); lstScriptName.setWidth("100%"); mainLayout.addComponent(lstScriptName); txtConfiguration = new TextArea(ctx.tr("ExecuteShellScript.dialog.configuration")); txtConfiguration.setSizeFull(); mainLayout.addComponent(txtConfiguration); errorLabel = new Label(); errorLabel.setVisible(false); errorLabel.setStyleName("dpu-error-label"); mainLayout.addComponent(errorLabel); fillListValues(); setCompositionRoot(mainLayout); }
private void createDashboardSelector() { dashBoardSelector = new ListSelect(); dashBoardSelector.setHeight("100%"); dashBoardSelector.setWidth("300"); // dashBoardSelector.setItemCaptionPropertyId(Tblportallayout_.name.getName()); // dashBoardSelector.setItemCaptionMode(ItemCaptionMode.PROPERTY); container = new BeanItemContainer<>(Tblportallayout.class); loadDashboardList(); dashBoardSelector.setContainerDataSource(container); dashBoardSelector.setNullSelectionAllowed(false); dashBoardSelector.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 2850017605363067882L; @Override public void valueChange(ValueChangeEvent event) { if (!loading) { Tblportallayout portalLayout = (Tblportallayout) event.getProperty().getValue(); if (portalLayout != null) { portalLayout = JpaBaseDao.getGenericDao(Tblportallayout.class).findByEntityId(portalLayout); createDashboard(portalLayout); closeToolBar(); } } } }); }
private void loadData( ListSelect list ) { UserDao userDao = InjectorFactory.getInstance( UserDao.class ); for ( User user : userDao.getList() ) { list.addItem( user.getUsername() ); } }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // butCrearCompetencia butCrearCompetencia = new Button(); butCrearCompetencia.setCaption("Crear Competencia"); butCrearCompetencia.setImmediate(false); butCrearCompetencia.setWidth("-1px"); butCrearCompetencia.setHeight("-1px"); mainLayout.addComponent(butCrearCompetencia, "top:40.0px;left:80.0px;"); // butEditarCompetencia butEditarCompetencia = new Button(); butEditarCompetencia.setCaption("Editar Competencia"); butEditarCompetencia.setImmediate(false); butEditarCompetencia.setWidth("-1px"); butEditarCompetencia.setHeight("-1px"); mainLayout.addComponent(butEditarCompetencia, "top:40.0px;left:240.0px;"); // listSelect_1 listSelect_1 = new ListSelect(); listSelect_1.setImmediate(false); listSelect_1.setWidth("500px"); listSelect_1.setHeight("200px"); mainLayout.addComponent(listSelect_1, "top:100.0px;left:80.0px;"); return mainLayout; }
public void actualizar( List<RolBO> roles ) { for( RolBO rol : roles ) { ListSelect l = new ListSelect( rol.getNombre( ) ); l.setWidth("100%"); l.setHeight("100%"); tstRoles.addTab( l ); } mostrarEvaluadoresDisponibles( ( ListSelect )tstRoles.getSelectedTab( ) ); }
public void setRows(int rows) { if (getInternalField() instanceof ListSelect) { ((ListSelect<?>) getInternalField()).setRows(rows); } }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // listSelectVariables listSelectVariables = new ListSelect(); listSelectVariables.setCaption("Defined Variables"); listSelectVariables.setImmediate(false); listSelectVariables.setWidth("100.0%"); listSelectVariables.setHeight("-1px"); mainLayout.addComponent(listSelectVariables); mainLayout.setExpandRatio(listSelectVariables, 1.0f); // textFieldVariable textFieldVariable = new TextField(); textFieldVariable.setCaption("Variable"); textFieldVariable.setImmediate(false); textFieldVariable.setWidth("-1px"); textFieldVariable.setHeight("-1px"); textFieldVariable.setInvalidAllowed(false); textFieldVariable.setRequired(true); textFieldVariable.setInputPrompt("Eg. \"12345\" or \"myVariable1\""); mainLayout.addComponent(textFieldVariable); mainLayout.setExpandRatio(textFieldVariable, 1.0f); // buttonSave buttonSave = new Button(); buttonSave.setCaption("Save"); buttonSave.setImmediate(true); buttonSave.setWidth("-1px"); buttonSave.setHeight("-1px"); mainLayout.addComponent(buttonSave); mainLayout.setComponentAlignment(buttonSave, new Alignment(48)); return mainLayout; }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // labelID labelID = new Label(); labelID.setCaption("Policy Set ID"); labelID.setImmediate(false); labelID.setWidth("100.0%"); labelID.setHeight("-1px"); labelID.setValue("Label"); mainLayout.addComponent(labelID); // textFieldVersion textFieldVersion = new TextField(); textFieldVersion.setCaption("Version"); textFieldVersion.setImmediate(false); textFieldVersion .setDescription("The format is numbers only separated by decimal point."); textFieldVersion.setWidth("-1px"); textFieldVersion.setHeight("-1px"); textFieldVersion.setInvalidAllowed(false); textFieldVersion.setRequired(true); textFieldVersion.setInputPrompt("Eg. 1 or 1.0 or 1.0.0 etc."); mainLayout.addComponent(textFieldVersion); // listSelectAlgorithm listSelectAlgorithm = new ListSelect(); listSelectAlgorithm.setCaption("Policy Combining Algorithm"); listSelectAlgorithm.setImmediate(false); listSelectAlgorithm.setWidth("100.0%"); listSelectAlgorithm.setHeight("-1px"); listSelectAlgorithm.setInvalidAllowed(false); listSelectAlgorithm.setRequired(true); mainLayout.addComponent(listSelectAlgorithm); // textAreaDescription textAreaDescription = new TextArea(); textAreaDescription.setCaption("Description"); textAreaDescription.setImmediate(false); textAreaDescription.setWidth("100.0%"); textAreaDescription.setHeight("-1px"); mainLayout.addComponent(textAreaDescription); mainLayout.setExpandRatio(textAreaDescription, 1.0f); // buttonSave buttonSave = new Button(); buttonSave.setCaption("Save"); buttonSave.setImmediate(true); buttonSave.setWidth("-1px"); buttonSave.setHeight("-1px"); mainLayout.addComponent(buttonSave); mainLayout.setComponentAlignment(buttonSave, new Alignment(48)); return mainLayout; }
protected AbstractLayout buildSearchLayout() { FormLayout layout = new FormLayout(); layout.setMargin(true); List<Plugin> existingPlugins = context.getPluginService().findPlugins(); Set<String> groups = new HashSet<>(); Set<String> names = new HashSet<>(); for (Plugin plugin : existingPlugins) { groups.add(plugin.getArtifactGroup()); names.add(plugin.getArtifactName()); } versionSelect = new ListSelect("Versions"); groupCombo = new ComboBox("Group"); nameCombo = new ComboBox("Name"); versionSelect.setRows(4); versionSelect.setMultiSelect(false); versionSelect.setNullSelectionAllowed(false); versionSelect.setWidth(100, Unit.PERCENTAGE); versionSelect.addValueChangeListener(e -> versionSelected()); groupCombo.setWidth(100, Unit.PERCENTAGE); groupCombo.setNewItemsAllowed(true); groupCombo.addItems(groups); groupCombo.addValueChangeListener(e -> { populateNameField(nameCombo); setSearchButtonEnabled(); }); groupCombo.setNewItemHandler((newItemCaption) -> { groupCombo.removeItem(handEnteredGroup); handEnteredGroup = newItemCaption; groupCombo.addItem(handEnteredGroup); groupCombo.setValue(handEnteredGroup); setSearchButtonEnabled(); }); layout.addComponent(groupCombo); nameCombo.setWidth(100, Unit.PERCENTAGE); nameCombo.setNewItemsAllowed(true); nameCombo.addItems(names); nameCombo.addValueChangeListener(e -> { setSearchButtonEnabled(); }); nameCombo.setNewItemHandler((newItemCaption) -> { nameCombo.removeItem(handEnteredName); handEnteredName = newItemCaption; nameCombo.addItem(handEnteredName); nameCombo.setValue(handEnteredName); setSearchButtonEnabled(); }); layout.addComponent(nameCombo); layout.addComponent(versionSelect); return layout; }
protected void initSelectComponent() { select = new ListSelect(); select.setMultiSelect(true); select.setNullSelectionAllowed(true); }
public CanvasImport(){ VerticalLayout canvasImportLayout = new VerticalLayout(); canvasImportLayout.setMargin(true); setContent(canvasImportLayout); uploader=new NavigatorFileUpload("Upload"){ @Override public void uploadFailed(FailedEvent failedEvent){ reportMessage("Upload failed"); } @Override public void uploadSucceeded(SucceededEvent succeededEvent){ File file=getUploadedFile(); String format=theCanvas.getImportFormatShortFormat((String)importTypes.getValue()); try{ theCanvas.theDoc.importFrom(file.getPath(), format); }catch(Exception ex){ reportMessage("Wrong format or invalid content"); } if(LogUtils.hasLastError()){ reportMessage("Wrong format or invalid content"); } LogUtils.clearLastError(); if(file.delete()==false){ reportException(new Exception("Unable to delete file: "+file.getPath())); } removeLocalResource(file); } @Override public void uploadFailed(Message msg){ reportMessage(msg.getMessage()); } }; uploader.setLocalResourceWatchers(localResourceWatchers); List<String> importTypeList=theCanvas.getImportFormats(); importTypes=new ListSelect("Format", importTypeList); importTypes.setNullSelectionAllowed(false); importTypes.setValue(importTypeList.get(0)); canvasImportLayout.addComponent(importTypes); canvasImportLayout.addComponent(uploader.getUploadComponent()); }
public ListSelect getListSelect() { return listSelect; }
public TranslatorDialog(TranslatorConfig tConfig) { config = tConfig; urlList.addAll(config.DEFAULT_PREDICATES); form.setFormFieldFactory(new DefaultFieldFactory() { @Override public Field createField(Item item, Object propertyId, Component uiContext) { if ("predicates".equals(propertyId)) { ListSelect box = new ListSelect("predicates to translate"); box.setMultiSelect(true); box.setContainerDataSource(urlList); box.setValue(config.getPredicates()); box.setRows(3); box.setNewItemsAllowed(true); for (URI predicate : config.getPredicates()) box.addItem(predicate.stringValue()); return box; } else if ("translationCache".equals("propertyId")) { TextField uriField = new TextField("Translation Cache Graph"); uriField.setWidth(350, VerticalLayout.UNITS_PIXELS); uriField.setDescription("Graph URI were translations are stored"); uriField.setImmediate(true); uriField.addValidator(new AbstractStringValidator(null) { @Override protected boolean isValidString(String value) { try { new URIImpl(value); return true; } catch (Exception ex) { setErrorMessage("Invalid graph URI: " + ex.getMessage()); return false; } } }); return uriField; } else return super.createField(item, propertyId, uiContext); } }); form.setItemDataSource(new BeanItem<TranslatorConfig>(this.config)); form.setVisibleItemProperties(new String[]{"providerClientID", "providerClientSecret", "predicates", "translationCache"}); addComponent(form); }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // btnGuardar btnGuardar = new Button(); btnGuardar.setCaption("Guardar"); btnGuardar.setImmediate(true); btnGuardar.setWidth("-1px"); btnGuardar.setHeight("-1px"); mainLayout.addComponent(btnGuardar, "top:20.0px;left:10.0px;"); // lblEvaluadores lblEvaluadores = new Label(); lblEvaluadores.setImmediate(false); lblEvaluadores.setWidth("-1px"); lblEvaluadores.setHeight("-1px"); lblEvaluadores.setValue("Evaluadores:"); mainLayout.addComponent(lblEvaluadores, "top:80.0px;left:30.0px;"); // btnAgregar btnAgregar = new Button(); btnAgregar.setCaption(">"); btnAgregar.setImmediate(true); btnAgregar.setWidth("-1px"); btnAgregar.setHeight("-1px"); mainLayout.addComponent(btnAgregar, "top:160.0px;left:204.0px;"); // btnRemover btnRemover = new Button(); btnRemover.setCaption("<"); btnRemover.setImmediate(true); btnRemover.setWidth("-1px"); btnRemover.setHeight("-1px"); mainLayout.addComponent(btnRemover, "top:234.0px;left:204.0px;"); // lblRoles lblRoles = new Label(); lblRoles.setImmediate(false); lblRoles.setWidth("-1px"); lblRoles.setHeight("-1px"); lblRoles.setValue("Roles:"); mainLayout.addComponent(lblRoles, "top:80.0px;left:280.0px;"); // tstRoles tstRoles = new TabSheet(); tstRoles.setImmediate(false); tstRoles.setWidth("410px"); tstRoles.setHeight("246px"); mainLayout.addComponent(tstRoles, "top:114.0px;left:280.0px;"); // lstEvaluadores lstEvaluadores = new ListSelect(); lstEvaluadores.setImmediate(false); lstEvaluadores.setWidth("140px"); lstEvaluadores.setHeight("246px"); mainLayout.addComponent(lstEvaluadores, "top:114.0px;left:20.0px;"); return mainLayout; }
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // lstResultados lstResultados = new ListSelect(); lstResultados.setImmediate(false); lstResultados.setWidth("420px"); lstResultados.setHeight("146px"); mainLayout.addComponent(lstResultados, "top:100.0px;left:40.0px;"); // lblResultados lblResultados = new Label(); lblResultados.setImmediate(false); lblResultados.setWidth("-1px"); lblResultados.setHeight("-1px"); lblResultados.setValue("Resultados de aprendizaje:"); mainLayout.addComponent(lblResultados, "top:22.0px;left:40.0px;"); // btnCrear btnCrear = new Button(); btnCrear.setCaption("Crear Rúbria"); btnCrear.setImmediate(false); btnCrear.setWidth("-1px"); btnCrear.setHeight("-1px"); mainLayout.addComponent(btnCrear, "top:60.0px;left:40.0px;"); // btnEditar btnEditar = new Button(); btnEditar.setCaption("Editar Rúbrica"); btnEditar.setImmediate(false); btnEditar.setWidth("-1px"); btnEditar.setHeight("-1px"); mainLayout.addComponent(btnEditar, "top:60.0px;left:160.0px;"); return mainLayout; }
/** * Contruct an upload element for R (implemented as Vaadin CustomComponent). * * @param caption * String caption or null * @param R * the corresponding RSession to upload the files to */ public RUpload(String caption, RContainer R) { /* Create the RUpload custom component */ super.setSizeUndefined(); root = new Panel(caption); root.setWidth("90ex"); setCompositionRoot(root); HorizontalLayout hbox = new HorizontalLayout(); hbox.setWidth("100%"); /* Create the Upload component */ final Upload upload = new Upload("Choose file", this); upload.setButtonCaption("Submit"); /* Listen for events regarding the success of upload. */ upload.addSucceededListener(this); upload.addFailedListener(this); hbox.addComponent(upload); Label hfill = new Label(); hbox.addComponent(hfill); hbox.setExpandRatio(hfill, 1.0f); remove = new Button("Remove", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { String current = getSelection(); if (current != null) { /* Delete the file */ delete(current); /* Update the lists and the notification area */ int i = fileNames.indexOf(current); fileNames.remove(i); mimeTypes.remove(i); uploadedFiles.removeItem(current); /* Gray out the button, if this was the last item */ if (fileNames.isEmpty()) { remove.setEnabled(false); } } } }); hbox.addComponent(remove); remove.setEnabled(false); hbox.setComponentAlignment(remove, Alignment.BOTTOM_RIGHT); /* Notification area for already uploaded files */ uploadedFiles = new ListSelect("Already submitted files"); uploadedFiles.setMultiSelect(false); uploadedFiles.setNullSelectionAllowed(false); uploadedFiles.setHeight("4em"); uploadedFiles.setWidth("100%"); // Changed for Vaadin 7, not tested!! VerticalLayout vbox = new VerticalLayout(); vbox.addComponent(hbox); vbox.addComponent(uploadedFiles); root.setContent(vbox); /* Bind the component to the given R session */ this.R = R; }
/** * <p> * Returns a Vaadin ListSelect object with an implicit ValueChangeListener * that writes the selected options directly to the R workspace. See also * {@link RContainer#getOptionGroup}. * </p> * * <p> * For example, if R workspace contains the variable * {@code classes <- c("A", "B", "C")"}, then * {@code getListSelect("classes", "selected")} returns a ListSelect element * which automatically updates the variable {@code "selected"} in R. The * value can be e.g. {@code "A"}, or {@code c("A", "C")}, if we have in * addition chosen {@code setMultiSelect(true)} for the element. * </p> * * <p> * The input options can be (re)set any time with * {@link RContainer#buildSelectOptions} * </p> * * <p> * Observe that the separate element can be constructed step by step:<br> * {@code R.eval("classes <- c('A', 'B', 'C')");} <br> * {@code ListSelect chooseGroups = new ListSelect();} <br> * {@code R.buildSelectOptions(chooseGroups, "classes");}<br> * {@code R.buildSelectListener(chooseGroups, "selected");} * </p> * * * @param optionsInName * The R character vector name to contain the different choices. * Repeated elements will be ignored. * @param selectedOutName * The R character vector to immediately write the selection to. * @return Vaadin ListSelect object */ public ListSelect getListSelect(String optionsInName, final String selectedOutName) { final ListSelect listselect = new ListSelect(); listselect.setNullSelectionAllowed(false); buildSelectOptions(listselect, optionsInName); buildSelectListener(listselect, selectedOutName); return listselect; }
public ListSelect getListSelect(final String selectedOutName) { final ListSelect listselect = new ListSelect(); return listselect; }
/** * Sets the number of rows in the selects. If the number of rows is set to 0 * or less, the actual number of displayed rows is determined implicitly by * the selects. * <p> * If a height if set (using {@link #setHeight(String)} or * {@link #setHeight(float, Unit)}) it overrides the number of rows. Leave * the height undefined to use this method. * * @param rows * the number of rows to set. * @return this (for method chaining) * @see ListSelect#setRows(int) */ @SuppressWarnings("unchecked") public default THIS withRows(int rows) { ((ListSelect<ITEM>) this).setRows(rows); return (THIS) this; }