com.vaadin.ui.ListSelect Java Examples

The following examples show how to use com.vaadin.ui.ListSelect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserListWindow.java    From usergrid with Apache License 2.0 6 votes vote down vote up
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;" );
    }
 
Example #2
Source File: GenericConfigForm.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: SelectPDPGroupWindow.java    From XACML with MIT License 5 votes vote down vote up
@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;
}
 
Example #4
Source File: AttributeDictionarySelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
@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;
}
 
Example #5
Source File: UserListWindow.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private void loadData( ListSelect list ) {

        UserDao userDao = InjectorFactory.getInstance( UserDao.class );

        for ( User user : userDao.getList() ) {
            list.addItem( user.getUsername() );
        }
    }
 
Example #6
Source File: VariableReferenceEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@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;
}
 
Example #7
Source File: PolicyEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@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;
}
 
Example #8
Source File: PolicySetEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@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;
}