Java Code Examples for org.apache.wicket.markup.html.form.DropDownChoice#setLabel()

The following examples show how to use org.apache.wicket.markup.html.form.DropDownChoice#setLabel() . 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: SingleChoiceEditor.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Construct drop down box to select single value.
 *
 * @param id         editor id.
 * @param markupProvider markup object.
 * @param model      model.
 * @param labelModel label model
 * @param attrValue  {@link org.yes.cart.domain.entity.AttrValue}
 * @param choices    list of strings {@link org.yes.cart.domain.misc.Pair}, that represent options to select one
 * @param readOnly  if true this component is read only
 */
public SingleChoiceEditor(final String id,
                          final MarkupContainer markupProvider,
                          final IModel model,
                          final IModel<String> labelModel,
                          final IModel choices,
                          final AttrValueWithAttribute attrValue,
                          final boolean readOnly) {

    super(id, "singleChoiceEditor", markupProvider);

    final DropDownChoice<Pair<String, String>> dropDownChoice =
            new DropDownChoice<Pair<String, String>>(EDIT, model, choices);
    dropDownChoice.setLabel(labelModel);
    dropDownChoice.setEnabled(!readOnly);
    dropDownChoice.setRequired(attrValue.getAttribute().isMandatory());
    dropDownChoice.setChoiceRenderer(new PairChoiceRenderer());
    add(dropDownChoice);

}
 
Example 2
Source File: AddEmailGroupPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public AddEmailGroupPanel(String id) {
	super(id);

	DropDownChoice<String> choice = new DropDownChoice<String>("group", new PropertyModel<String>(this, "group"), new GroupsModel());
	choice.setRequired(true);
	choice.setLabel(new Model<String>(getString("AclEntryPanel.group")));
	add(choice);
}
 
Example 3
Source File: AddEmailUserPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public AddEmailUserPanel(String id) {
	super(id);

	DropDownChoice<String> choice = new DropDownChoice<String>("user", new PropertyModel<String>(this, "user"), new UsersModel());
	choice.setRequired(true);
	choice.setLabel(new Model<String>(getString("AclEntryPanel.user")));
	add(choice);
}
 
Example 4
Source File: AddAnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public AddAnalysisPanel() {
	super(FormPanel.CONTENT_ID);

	DropDownChoice<String> selectedTable = new DropDownChoice<String>("tableChoice", new PropertyModel<String>(this, "selectedTable"), new TablesModel());
	selectedTable.setOutputMarkupPlaceholderTag(true);
	selectedTable.setNullValid(false);		
	selectedTable.setRequired(true);
	selectedTable.setLabel(new StringResourceModel("Analysis.source", null));
		add(selectedTable);  		
}
 
Example 5
Source File: DefineDrillEntityPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public DefineDrillEntityPanel(String id, String type, final DrillDownEntity drillEntity, Entity entity) {
	super(id, new CompoundPropertyModel<DrillDownEntity>(drillEntity));
	
	this.type = type;
	
	final Label widgetLabel = new Label("entityLabel", getString(type));		
	add(widgetLabel);
	
	final DropDownChoice<Entity> entityChoice = new DropDownChoice<Entity>("entities", 
			new PropertyModel<Entity>(drillEntity, "entity"), new WidgetDropDownModel(), new EntityChoiceRenderer());
	entityChoice.setOutputMarkupPlaceholderTag(true);
	entityChoice.setOutputMarkupId(true);
	entityChoice.setRequired(true);
	add(entityChoice);
	
	final Label linkLabel = new Label("linkLabel", getString("ActionContributor.Drill.parameter"));
	linkLabel.setOutputMarkupId(true);
	linkLabel.setOutputMarkupPlaceholderTag(true);
	add(linkLabel);
	
	final DropDownChoice<String> paramChoice = new DropDownChoice<String>("parameters",
               new PropertyModel<String>(drillEntity, "linkParameter"), parameters, new ChoiceRenderer<String>());
       paramChoice.setRequired(true);
       paramChoice.setLabel(new Model<String>( getString("ActionContributor.Drill.parameter")));
       paramChoice.setOutputMarkupId(true);
       paramChoice.setOutputMarkupPlaceholderTag(true);
       add(paramChoice);
       
       final Label columnLabel = new Label("columnLabel",  getString("ActionContributor.Drill.column"));            
       columnLabel.setOutputMarkupId(true);
       columnLabel.setOutputMarkupPlaceholderTag(true);
	add(columnLabel);
                   
       final TextField<Integer> columnField = new TextField<Integer>("column");            
       columnField.setOutputMarkupId(true);
       columnField.setOutputMarkupPlaceholderTag(true);
       add(columnField);
       
       if (drillEntity.getIndex() == 0) {
       	if (entity instanceof Chart) {
       		columnLabel.setVisible(false);            	
       		columnField.setVisible(false);            		 
       	}
       } else {
       	if (DrillDownUtil.getLastDrillType(entity) == DrillDownEntity.CHART_TYPE) {
       		columnLabel.setVisible(false);            	
       		columnField.setVisible(false);            		   
       	} 
       }
       
       entityChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {

           @Override
           protected void onUpdate(AjaxRequestTarget target) {
          	updateParameters(drillEntity);                     
              target.add(paramChoice);
           }

       }); 
       
}