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

The following examples show how to use org.apache.wicket.markup.html.form.DropDownChoice#setEnabled() . 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: ODateTimeField.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private DropDownChoice<String> createChoice(String id, int mode) {
    DropDownChoice<String> choice = new DropDownChoice<>(id, new Model<>(), Arrays.asList(AM, PM));
    boolean support = isSupportAmPm();
    choice.setOutputMarkupId(true);
    choice.setNullValid(false);
    if (mode != -1) choice.setModelObject(mode == Calendar.AM ? choice.getChoices().get(0) : choice.getChoices().get(1));
    else choice.setModelObject(choice.getChoices().get(0));
    choice.setVisible(support);
    choice.setEnabled(support);
    return choice;
}
 
Example 3
Source File: TeamAttendeesPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
private void rebuildAttendees()
{
  attendeesRepeater.removeAll();
  for (final TeamEventAttendeeDO attendee : attendees) {
    final WebMarkupContainer item = new WebMarkupContainer(attendeesRepeater.newChildId());
    attendeesRepeater.add(item);
    item.add(new AttendeeEditableLabel("editableLabel", Model.of(attendee), false));
    final DropDownChoice<TeamAttendeeStatus> statusChoice = new DropDownChoice<TeamAttendeeStatus>("status",
        new PropertyModel<TeamAttendeeStatus>(attendee, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer);
    statusChoice.setEnabled(false);
    item.add(statusChoice);
  }
}
 
Example 4
Source File: NextRuntimePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
  public void addWicketComponents() {    	        	    	
  	
      final DropDownChoice<String> exportChoice = new DropDownChoice<String>("exportType", new PropertyModel<String>(runtimeModel, "exportType"), typeList,
      		new ChoiceRenderer<String>() {
			@Override
			public Object getDisplayValue(String name) {
				if (name.equals(ReportConstants.ETL_FORMAT)) {
					return getString("Analysis.source");
				} else {
					return name;
				}
			}
});
      exportChoice.add(new AjaxFormComponentUpdatingBehavior("onChange") {
          @Override
          protected void onUpdate(AjaxRequestTarget target) {
              String format = (String) getFormComponent().getConvertedInput();
              if (ReportConstants.ETL_FORMAT.equals(format)) {
			System.out.println("***** ETL selected");
			//analysisPanel.setVisible(true);
		} else {
			System.out.println("***** " + format);
			//analysisPanel.setVisible(false);
		}
              //target.add(analysisPanel);
          }
      });
	
      exportChoice.setRequired(true);
      add(exportChoice);
      
      if (report.isAlarmType() || report.isIndicatorType() || report.isDisplayType()) {
      	exportChoice.setEnabled(false);
      } else {
      	exportChoice.setRequired(true);
      }
      
      
  }
 
Example 5
Source File: MonthlyJobPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private void enableComponents(int monthlyType, Label mLabel, DropDownChoice minuteChoice, Label label, TextField<Integer> minuteText,
                              IntervalFieldPanel hoursPanel, IntervalFieldPanel monthsPanel,
                              DropDownChoice<Integer> noChoice, DropDownChoice<String> dayChoice,
                              Label everyLabel) {
    if (ScheduleConstants.MONTHLY_GENERAL_TYPE == monthlyType) {
    	mLabel.setEnabled(true);
        minuteChoice.setEnabled(true);
        label.setEnabled(true);
        minuteText.setEnabled(true);
        hoursPanel.setEnabled(true);
        daysPanel.setEnabled(true);
        monthsPanel.setEnabled(true);
        weekdaysPanel.setEnabled(true);

        noChoice.setEnabled(false);
        dayChoice.setEnabled(false);
        everyLabel.setEnabled(false);
    } else if (ScheduleConstants.MONTHLY_DAY_OF_WEEK_TYPE == monthlyType) {
    	mLabel.setEnabled(false);
        minuteChoice.setEnabled(false);
        label.setEnabled(false);
        minuteText.setEnabled(false);
        hoursPanel.setEnabled(false);
        daysPanel.setEnabled(false);
        monthsPanel.setEnabled(false);
        weekdaysPanel.setEnabled(false);

        noChoice.setEnabled(true);
        dayChoice.setEnabled(true);
        everyLabel.setEnabled(true);
    } else {
    	mLabel.setEnabled(false);
        minuteChoice.setEnabled(false);
        label.setEnabled(false);
        minuteText.setEnabled(false);
        hoursPanel.setEnabled(false);
        daysPanel.setEnabled(false);
        monthsPanel.setEnabled(false);
        weekdaysPanel.setEnabled(false);

        noChoice.setEnabled(false);
        dayChoice.setEnabled(false);
        everyLabel.setEnabled(false);
    }
}