當前位置: 首頁>>代碼示例>>Java>>正文


Java DropDownChoice.setRequired方法代碼示例

本文整理匯總了Java中org.apache.wicket.markup.html.form.DropDownChoice.setRequired方法的典型用法代碼示例。如果您正苦於以下問題:Java DropDownChoice.setRequired方法的具體用法?Java DropDownChoice.setRequired怎麽用?Java DropDownChoice.setRequired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.wicket.markup.html.form.DropDownChoice的用法示例。


在下文中一共展示了DropDownChoice.setRequired方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeProjectTypeChoice

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
private DropDownChoice<String> makeProjectTypeChoice()
{
    DropDownChoice<String> projectTypes = new DropDownChoice<String>("mode", projectService
            .listProjectTypes().stream().map(t -> t.id()).collect(Collectors.toList()))
    {
        private static final long serialVersionUID = -8268365384613932108L;

        @Override
        protected void onConfigure()
        {
            super.onConfigure();
            setEnabled(
                    projectModel.getObject() != null && projectModel.getObject().getId() == 0);
        }
    };

    projectTypes.setRequired(true);
    return projectTypes;

}
 
開發者ID:webanno,項目名稱:webanno,代碼行數:21,代碼來源:ProjectDetailPanel.java

示例2: addParameterSettings

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
private void addParameterSettings(final int idx)
{
  final FieldsetPanel fs = gridBuilder.newFieldset(getString("scripting.script.parameterName") + " " + idx);

  final String parameterType = "parameter" + idx + "Type";
  final String parameterName = "parameter" + idx + "Name";
  final MaxLengthTextField name = new MaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, parameterName));
  WicketUtils.setSize(name, 20);
  fs.add(name);
  // DropDownChoice type
  final LabelValueChoiceRenderer<ScriptParameterType> typeChoiceRenderer = new LabelValueChoiceRenderer<ScriptParameterType>(this,
      ScriptParameterType.values());
  final DropDownChoice<ScriptParameterType> typeChoice = new DropDownChoice<ScriptParameterType>(fs.getDropDownChoiceId(),
      new PropertyModel<ScriptParameterType>(data, parameterType), typeChoiceRenderer.getValues(), typeChoiceRenderer);
  typeChoice.setNullValid(true);
  typeChoice.setRequired(false);
  fs.add(typeChoice);
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:19,代碼來源:ScriptEditForm.java

示例3: initTeamCalPicker

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
/**
 * if has access: create drop down with teamCals else create label
 * 
 * @param fieldSet
 */
private void initTeamCalPicker(final FieldsetPanel fieldSet)
{
  if (access == false) {
    final TeamCalDO calendar = data.getCalendar();
    final Label teamCalTitle = new Label(fieldSet.newChildId(), calendar != null ? new PropertyModel<String>(data.getCalendar(), "title")
        : "");
    fieldSet.add(teamCalTitle);
  } else {
    final List<TeamCalDO> list = teamCalDao.getAllCalendarsWithFullAccess();
    calendarsWithFullAccess = list.toArray(new TeamCalDO[0]);
    final LabelValueChoiceRenderer<TeamCalDO> calChoiceRenderer = new LabelValueChoiceRenderer<TeamCalDO>();
    for (final TeamCalDO cal : list) {
      calChoiceRenderer.addValue(cal, cal.getTitle());
    }
    final DropDownChoice<TeamCalDO> calDropDownChoice = new DropDownChoice<TeamCalDO>(fieldSet.getDropDownChoiceId(),
        new PropertyModel<TeamCalDO>(data, "calendar"), calChoiceRenderer.getValues(), calChoiceRenderer);
    calDropDownChoice.setNullValid(false);
    calDropDownChoice.setRequired(true);
    fieldSet.add(calDropDownChoice);
  }
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:27,代碼來源:TeamEventEditForm.java

示例4: SubnetSelectionPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
public SubnetSelectionPanel(String id, List<VlanDto> vlanDtos) {
	super(id);
	this.subnets = new ArrayList<>();
	this.subnetsMap = new HashMap<>();
	try{
		DropDownChoice<String> vlanfield;
		if(vlanDtos == null || vlanDtos.size() == 0){
			vlanfield = new DropDownChoice<String>("vlanName",
					new PropertyModel<>(this, "vlanName"), vlans);
		}else {
			vlanDtos.forEach(vlanDto -> vlans.add(vlanDto.getVlanId().toString()));
			vlanfield = new DropDownChoice<String>("vlanName",
					new PropertyModel<>(this, "vlanName"), vlans);
		}
		vlanfield.setRequired(true);
		add(vlanfield);

		addAllIpSubnet(SubnetRenderer.getAllIpSubnetNamespace(),subnets,subnetsMap);
		DropDownChoice<String> subnetfield = new DropDownChoice<String>("subnetName",
				new PropertyModel<>(this, "subnetName"), subnets);
		subnetfield.setRequired(true);
		add(subnetfield);
	} catch (ExternalServiceException e) {
		e.printStackTrace();
	}

}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:28,代碼來源:SubnetSelectionPanel.java

示例5: createDropDown

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
protected DropDownChoice<T> createDropDown(String id, IModel<List<T>> choices, IChoiceRenderer<T> renderer,
                                        boolean required) {
    DropDownChoice choice = new DropDownChoice<T>(id, getModel(), choices, renderer){

        @Override
        protected String getNullValidDisplayValue() {
            return getString("DropDownChoicePanel.empty");
        }
    };
    choice.setNullValid(!required);
    choice.setRequired(required);
    return choice;
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:14,代碼來源:DropDownFormGroup.java

示例6: AddEditRecordCollectionBoostPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
public AddEditRecordCollectionBoostPanel(String id, RecordCollectionBoost recordCollectionBoost, int index) {
    super(id, true);

    this.recordCollectionBoostModel = new EntityModel<RecordCollectionBoost>(recordCollectionBoost);

    if (recordCollectionBoost.getId() != null) {
        for (BoostRule rule : recordCollectionBoost.getBoostRules()) {
            rules.add(new BoostRuleDTO(rule));
        }
    }

    Form form = getForm();
    form.setModel(new CompoundPropertyModel(recordCollectionBoostModel));// pr eviter les repetitions

    TextField name = new TextField("name");// grace a setModel plus besoin de : new PropertyModel(this,
    form.add(name);

    // IModel collectionFieldsNames = getFields();
    // DropDownChoice metaName = new DropDownChoice("metaName", collectionFieldsNames);
    // metaName.setRequired(true);

    IModel indexFieldsModel = new AdminCollectionIndexFieldsModel(this);
    IChoiceRenderer indexFieldRenderer = new ChoiceRenderer() {
        @Override
        public Object getDisplayValue(Object object) {
            IndexField indexField = (IndexField) object;
            return indexField.getName();
        }
    };

    DropDownChoice associatedField = new DropDownChoice("associatedField", indexFieldsModel, indexFieldRenderer);
    associatedField.setRequired(true);

    form.add(associatedField);

    // tous les regex
    form.add(new BoostRuleListPanel("rulesPanel"));
}
 
開發者ID:BassJel,項目名稱:Jouve-Project,代碼行數:39,代碼來源:AddEditRecordCollectionBoostPanel.java

示例7: AddEditParticipationPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
public AddEditParticipationPanel(String id, GroupParticipation participation) {
	super(id, true);
	this.participationModel = new ReloadableEntityModel<GroupParticipation>(participation);
	
	Form form = getForm();
	form.setModel(new CompoundPropertyModel(participationModel));

	IModel usersModel = new LoadableDetachableModel() {
		@Override
		protected Object load() {
			UserServices userServices = ConstellioSpringUtils.getUserServices();
			return new ArrayList<ConstellioUser>(userServices.list());
		}
	};

	IChoiceRenderer userRenderer = new ChoiceRenderer() {
		@Override
		public Object getDisplayValue(Object object) {
			ConstellioUser user = (ConstellioUser) object;
			return user.getFirstName() + " " + user.getLastName() + " (" + user.getUsername() + ")";
		}
	};
	
	DropDownChoice userField = new DropDownChoice("constellioUser", usersModel, userRenderer);
	userField.setRequired(true);
	form.add(userField);

}
 
開發者ID:BassJel,項目名稱:Jouve-Project,代碼行數:29,代碼來源:AddEditParticipationPanel.java

示例8: AddEmailGroupPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
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);
}
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:9,代碼來源:AddEmailGroupPanel.java

示例9: AddEmailUserPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
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);
}
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:9,代碼來源:AddEmailUserPanel.java

示例10: addWicketComponents

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
@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);
      }
      
      
  }
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:41,代碼來源:NextRuntimePanel.java

示例11: AddAnalysisPanel

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
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);  		
}
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:11,代碼來源:AddAnalysisPanel.java

示例12: VlanCreationPage

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
public VlanCreationPage(WebPage backPage, VlanIdPoolDto pool) {
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        if (pool == null) {
            throw new IllegalArgumentException("pool is null.");
        }
        this.pool = pool;
        this.backPage = backPage;

        Form<Void> backForm = new Form<Void>("backForm");
        add(backForm);
        Button backButton = new Button("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                setResponsePage(getBackPage());
            }
        };
        backForm.add(backButton);

        add(new FeedbackPanel("feedback"));

        Label nodeLabel = new Label("poolName", Model.of(pool.getName()));
        add(nodeLabel);

        Form<Void> form = new Form<Void>("form");
        add(form);

        Button proceedButton = new Button("proceed") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                processCreate();
                PageUtil.setModelChanged(getBackPage());
                setResponsePage(getBackPage());
            }
        };
        form.add(proceedButton);

        Map<Integer, Integer> ids = new HashMap<Integer, Integer>();
        for (IdRange<Integer> idRange : pool.getIdRanges()) {
            for (int i = idRange.lowerBound; i <= idRange.upperBound; i++) {
                ids.put(i, i);
            }
        }

        List<Integer> vlanIdList = new ArrayList<Integer>(new TreeSet<Integer>(ids.keySet()));
        DropDownChoice<Integer> vlanList = new DropDownChoice<Integer>(
                "vlanIds",
                new PropertyModel<Integer>(this, "vlanId"),
                vlanIdList);
        vlanList.setRequired(true);
        form.add(vlanList);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:60,代碼來源:VlanCreationPage.java

示例13: initLayout

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
private void initLayout(String localPartLabelKey, String localPartTooltipKey,
	String namespaceLabelKey, String namespaceTooltipKey, boolean markLocalPartAsRequired, boolean markNamespaceAsRequired){

      Label localPartLabel = new Label(ID_LOCAL_PART_LABEL, getString(localPartLabelKey));
      localPartLabel.setOutputMarkupId(true);
      localPartLabel.setOutputMarkupPlaceholderTag(true);
      add(localPartLabel);

WebMarkupContainer localPartRequired = new WebMarkupContainer(ID_LOCAL_PART_REQUIRED);
localPartRequired.setVisible(markLocalPartAsRequired);
add(localPartRequired);

      Label namespaceLabel = new Label(ID_NAMESPACE_LABEL, getString(namespaceLabelKey));
      namespaceLabel.setOutputMarkupId(true);
      namespaceLabel.setOutputMarkupPlaceholderTag(true);
      add(namespaceLabel);

WebMarkupContainer namespaceRequired = new WebMarkupContainer(ID_NAMESPACE_REQUIRED);
namespaceRequired.setVisible(markNamespaceAsRequired);
add(namespaceRequired);

TextField localPart = new TextField<>(ID_LOCAL_PART, localpartModel);
      localPart.setOutputMarkupId(true);
      localPart.setOutputMarkupPlaceholderTag(true);
      localPart.setRequired(isLocalPartRequired());
localPart.add(new UpdateBehavior());
      add(localPart);

      DropDownChoice namespace = new DropDownChoice<>(ID_NAMESPACE, namespaceModel, prepareNamespaceList());
      namespace.setOutputMarkupId(true);
      namespace.setOutputMarkupPlaceholderTag(true);
      namespace.setNullValid(false);
      namespace.setRequired(isNamespaceRequired());
namespace.add(new UpdateBehavior());
      add(namespace);

      Label localPartTooltip = new Label(ID_T_LOCAL_PART);
      localPartTooltip.add(new AttributeAppender("data-original-title", getString(localPartTooltipKey)));
      localPartTooltip.add(new InfoTooltipBehavior());
      localPartTooltip.setOutputMarkupPlaceholderTag(true);
      add(localPartTooltip);

      Label namespaceTooltip = new Label(ID_T_NAMESPACE);
      namespaceTooltip.add(new AttributeAppender("data-original-title", getString(namespaceTooltipKey)));
      namespaceTooltip.add(new InfoTooltipBehavior());
      namespaceTooltip.setOutputMarkupPlaceholderTag(true);
      add(namespaceTooltip);
  }
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:49,代碼來源:QNameEditorPanel.java

示例14: init

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
@SuppressWarnings("serial")
@Override
protected void init()
{
  super.init();
  gridBuilder.newSplitPanel(GridSize.SPAN8);
  fieldset = gridBuilder.newFieldset(getString("label.options"));
  final CalendarPageSupport calendarPageSupport = createCalendarPageSupport();
  calendarPageSupport.addUserSelectPanel(fieldset, new PropertyModel<PFUserDO>(this, "timesheetsUser"), true);
  currentDatePanel = new JodaDatePanel(fieldset.newChildId(), new PropertyModel<DateMidnight>(filter, "startDate")).setAutosubmit(true);
  currentDatePanel.getDateField().setOutputMarkupId(true);
  fieldset.add(currentDatePanel);

  final DropDownChoice<Integer> firstHourDropDownChoice = new DropDownChoice<Integer>(fieldset.getDropDownChoiceId(),
      new PropertyModel<Integer>(filter, "firstHour"), DateTimePanel.getHourOfDayRenderer().getValues(),
      DateTimePanel.getHourOfDayRenderer()) {
    /**
     * @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
     */
    @Override
    protected boolean wantOnSelectionChangedNotifications()
    {
      return true;
    }
  };
  firstHourDropDownChoice.setNullValid(false);
  firstHourDropDownChoice.setRequired(true);
  WicketUtils.addTooltip(firstHourDropDownChoice, getString("calendar.option.firstHour.tooltip"));
  fieldset.add(firstHourDropDownChoice);

  final DivPanel checkBoxPanel = fieldset.addNewCheckBoxButtonDiv();

  calendarPageSupport.addOptions(checkBoxPanel, true, filter);
  checkBoxPanel.add(new CheckBoxButton(checkBoxPanel.newChildId(), new PropertyModel<Boolean>(filter, "slot30"),
      getString("calendar.option.slot30"), true).setTooltip(getString("calendar.option.slot30.tooltip")));

  buttonGroupPanel = new ButtonGroupPanel(fieldset.newChildId());
  fieldset.add(buttonGroupPanel);
  {
    final IconButtonPanel refreshButtonPanel = new IconButtonPanel(buttonGroupPanel.newChildId(), IconType.REFRESH,
        getRefreshIconTooltip()) {
      /**
       * @see org.projectforge.web.wicket.flowlayout.IconButtonPanel#onSubmit()
       */
      @Override
      protected void onSubmit()
      {
        parentPage.refresh();
        setResponsePage(getPage().getClass(), getPage().getPageParameters());
      }
    };
    buttonGroupPanel.addButton(refreshButtonPanel);
    setDefaultButton(refreshButtonPanel.getButton());
  }
  gridBuilder.newSplitPanel(GridSize.SPAN4);
  final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.duration")).suppressLabelForWarning();
  final DivTextPanel durationPanel = new DivTextPanel(fs.newChildId(), new Label(DivTextPanel.WICKET_ID, new Model<String>() {
    @Override
    public String getObject()
    {
      return parentPage.calendarPanel.getTotalTimesheetDuration();
    }
  }));
  durationLabel = durationPanel.getLabel4Ajax();
  fs.add(durationPanel);
  onAfterInit(gridBuilder);
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:68,代碼來源:CalendarForm.java

示例15: addWicketComponents

import org.apache.wicket.markup.html.form.DropDownChoice; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void addWicketComponents() {
	
	ChoiceRenderer<String> typeRenderer = new ChoiceRenderer<String>() {
    	
    	@Override
        public Object getDisplayValue(String chartType) {
            if (chartType == null) {
            	return ChartUtil.CHART_NONE;
            } else if (chartType.equals(ChartUtil.CHART_BAR)) {
            	return getString("chart.bar");
            } else if (chartType.equals(ChartUtil.CHART_NEGATIVE_BAR)) {
            	return getString("chart.negativebar");	
            } else if (chartType.equals(ChartUtil.CHART_BAR_COMBO)) {
            	return getString("chart.barcombo");	
            } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_BAR)) {
            	return getString("chart.horizontalbar");
            } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR)) {
            	return getString("chart.stackedbar");
            } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR_COMBO)) {
            	return getString("chart.stackedbarcombo");
            } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_STACKED_BAR)) {
            	return getString("chart.horizontalstackedbar");
            } else if (chartType.equals(ChartUtil.CHART_PIE)) {
            	return getString("chart.pie");
            } else if (chartType.equals(ChartUtil.CHART_LINE)) {
            	return getString("chart.line");
            } else if (chartType.equals(ChartUtil.CHART_AREA)) {
            	return getString("chart.area");	
            } else if (chartType.equals(ChartUtil.CHART_BUBBLE)) {
            	return getString("chart.bubble");		
            } else {
            	return ChartUtil.CHART_NONE;
            }
        }
        
    };
	
    DropDownChoice exportChoice = new DropDownChoice("chartType", new PropertyModel(runtimeModel, "chartType"), ChartUtil.CHART_TYPES, typeRenderer);
    exportChoice.setRequired(true);
    add(exportChoice);

    TextField<Integer> refreshText = new TextField<Integer>("refreshTime", new PropertyModel(runtimeModel, "refreshTime"));
    refreshText.add(new ZeroRangeValidator(10, 3600));
    refreshText.setRequired(true);
    add(refreshText);
    
    TextField<Integer> timeoutText = new TextField<Integer>("timeout", new PropertyModel(runtimeModel, "timeout"));
    timeoutText.add(new RangeValidator<Integer>(5, 600));
    timeoutText.setLabel(new Model<String>("Timeout"));
    timeoutText.setRequired(true);
    add(timeoutText);
}
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:54,代碼來源:ChartRuntimePanel.java


注:本文中的org.apache.wicket.markup.html.form.DropDownChoice.setRequired方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。