当前位置: 首页>>代码示例>>Java>>正文


Java AutoCompleteTextField类代码示例

本文整理汇总了Java中org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextField类的具体用法?Java AutoCompleteTextField怎么用?Java AutoCompleteTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AutoCompleteTextField类属于org.apache.wicket.extensions.ajax.markup.html.autocomplete包,在下文中一共展示了AutoCompleteTextField类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTeamNameAutoCompleteField

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
private AutoCompleteTextField<Team> getTeamNameAutoCompleteField() {
	AutoCompleteTextField<Team> field = new IndicatingAjaxAutoCompleteTextField<Team>("add.teamName", Model.of((Team) null),
			Team.class, getAutocompleteRenderer(), WebConstants.getDefaultAutoCompleteSettings()) {

				@Override
				protected Iterator<Team> getChoices(String input) {
					return getPotentialTeams(input);
				}

				@Override
				public <Team> IConverter<Team> getConverter(Class<Team> type) {
					return (IConverter<Team>) getAutocompleteConverter();
				}
			};
	field.setRequired(true);
	return field;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:18,代码来源:UserEditPage.java

示例2: initTextField

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
private TextField initTextField() {
//        IModel data = new PropertyModel(getModel(), SearchValue.F_VALUE);

        if (lookup == null) {
            return new TextField(ID_TEXT_INPUT, new PropertyModel(getModel(), SearchValue.F_VALUE));
        }
        
        LookupPropertyModel<String> lookupPropertyModel = new LookupPropertyModel<String>(getModel(), SearchValue.F_VALUE, lookup.asObjectable()) {
        	
        	private static final long serialVersionUID = 1L;

			@Override
        	public boolean isSupportsDisplayName() {
        		return true;
        	}
        };

        AutoCompleteSettings settings = new AutoCompleteSettings();
        settings.setShowListOnEmptyInput(true);

        return new AutoCompleteTextField<String>(ID_TEXT_INPUT, lookupPropertyModel, settings) {

        	private static final long serialVersionUID = 1L;
            @Override
            protected Iterator<String> getChoices(String input) {
                return prepareAutoCompleteList(input).iterator();
            }

            
            
        };
    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:33,代码来源:TextPopupPanel.java

示例3: checkInputValue

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
public void checkInputValue(AutoCompleteTextField input, AjaxRequestTarget target, LookupPropertyModel model){
    if (input.getInput() == null || input.getInput().trim().equals("")){
        model.setObject(input.getInput());
    }
    if (getIterator(input.getInput()).hasNext() && getIterator(input.getInput()).next() instanceof String) {
        Iterator<String> lookupTableValuesIterator = (Iterator<String>) getIterator(input.getInput());

        String value = input.getInput();
        boolean isValueExist = false;
        String existingValue = "";
        if (value != null) {
            if (value.trim().equals("")) {
                isValueExist = true;
            } else {
                while (lookupTableValuesIterator.hasNext()) {
                    String lookupTableValue = lookupTableValuesIterator.next();
                    if (value.trim().equalsIgnoreCase(lookupTableValue)) {
                        isValueExist = true;
                        existingValue = lookupTableValue;
                        break;
                    }
                }
            }
        }
        if (isValueExist) {
            input.setModelValue(new String[]{existingValue});
            updateFeedbackPanel(input, false, target);
        } else {
            updateFeedbackPanel(input, true, target);
        }
    }
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:33,代码来源:AutoCompleteTextPanel.java

示例4: initTextField

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
private TextField initTextField() {
//        IModel data = new PropertyModel(getModel(), SearchValue.F_VALUE);

        if (lookup == null) {
            return new TextField(ID_TEXT_INPUT, new PropertyModel(getModel(), SearchValue.F_VALUE));
        }

        LookupPropertyModel<String> lookupPropertyModel = new LookupPropertyModel<String>(getModel(), SearchValue.F_VALUE, lookup.asObjectable()) {

        	private static final long serialVersionUID = 1L;

			@Override
        	public boolean isSupportsDisplayName() {
        		return true;
        	}
        };

        AutoCompleteSettings settings = new AutoCompleteSettings();
        settings.setShowListOnEmptyInput(true);

        return new AutoCompleteTextField<String>(ID_TEXT_INPUT, lookupPropertyModel, settings) {

        	private static final long serialVersionUID = 1L;
            @Override
            protected Iterator<String> getChoices(String input) {
                return prepareAutoCompleteList(input).iterator();
            }



        };
    }
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:33,代码来源:TextPopupPanel.java

示例5: AjaxTextFieldPanel

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
public AjaxTextFieldPanel(
        final String id,
        final String name,
        final IModel<String> model,
        final boolean active) {

    super(id, name, model, active);

    field = new AutoCompleteTextField<String>("textField", model) {

        private static final long serialVersionUID = -6648767303091874219L;

        @Override
        protected Iterator<String> getChoices(String input) {
            final Pattern pattern = Pattern.compile(
                    Pattern.quote(input) + ".*",
                    Pattern.CASE_INSENSITIVE);

            final List<String> result = new ArrayList<String>();

            for (String choice : choices) {
                if (pattern.matcher(choice).matches()) {
                    result.add(choice);
                }
            }

            return result.iterator();
        }
    };

    add(field.setLabel(new Model(name)).setOutputMarkupId(true));

    if (active) {
        field.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID =
                    -1107858522700306810L;

            @Override
            protected void onUpdate(AjaxRequestTarget art) {
                // nothing to do
            }
        });
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:46,代码来源:AjaxTextFieldPanel.java

示例6: AssociationFieldAutoCompleteTextField

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
public AssociationFieldAutoCompleteTextField(String id, IModel<Topic> model, final RoleFieldModel valueFieldModel) {
  super(id);
      
  AutoCompleteSettings opts = new AutoCompleteSettings();
  opts.setCssClassName("ontopoly-autocompleter");
  opts.setAdjustInputWidth(false);
  opts.setPreselect(true);
  
  this.textField = new AutoCompleteTextField<Topic>("autoComplete", model, Topic.class, new AbstractAutoCompleteRenderer<Topic>() {
      @Override
      protected String getTextValue(Topic o) {
        return TOPIC_CONVERTER.convertToString(o);
      }
      @Override
      protected void renderChoice(Topic o, Response response, String criteria) {
        response.write(o.getName());
      }}, opts) {

    @Override
    public IConverter getConverter(Class<?> type) {
      if (Topic.class.equals(type)) {
        return new TopicConverter();
      } else {
        return super.getConverter(type);
      }
    }
  
    @Override
    protected Iterator<Topic> getChoices(String input) {
      List<Topic> result = new ArrayList<Topic>(valueFieldModel.getRoleField().searchAllowedPlayers(input));
      filterPlayers(result);
      Collections.sort(result, TopicComparator.INSTANCE);
      return result.iterator();
    }
    
    @Override
    protected void onModelChanged() {
  	super.onModelChanged();
      Topic topic = getModelObject();
      if (topic != null) {
        AssociationFieldAutoCompleteTextField.this.onTopicSelected(topic);
      }
    }
  };    
  add(textField);
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:47,代码来源:AssociationFieldAutoCompleteTextField.java

示例7: getTextField

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
protected AutoCompleteTextField<Topic> getTextField() {
  return textField;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:4,代码来源:AssociationFieldAutoCompleteTextField.java

示例8: AjaxTextFieldPanel

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
public AjaxTextFieldPanel(
        final String id, final String name, final IModel<String> model, final boolean enableOnChange) {
    super(id, name, model);

    questionMarkJexlHelp = Constants.getJEXLPopover(this, TooltipConfig.Placement.right);
    add(questionMarkJexlHelp.setVisible(false));

    final AutoCompleteSettings settings = new AutoCompleteSettings();
    settings.setShowCompleteListOnFocusGain(true);
    settings.setShowListOnEmptyInput(true);
    settings.setCssClassName("custom-autocomplete-box");

    field = new AutoCompleteTextField<String>("textField", model, settings) {

        private static final long serialVersionUID = -6648767303091874219L;

        @Override
        protected Iterator<String> getChoices(final String input) {
            return AjaxTextFieldPanel.this.getChoices(input);
        }

        @Override
        protected AutoCompleteBehavior<String> newAutoCompleteBehavior(
                final IAutoCompleteRenderer<String> renderer, final AutoCompleteSettings settings) {
            return new IndicatorAutoCompleteBehavior<String>(renderer, settings) {

                private static final long serialVersionUID = 1070808433195962931L;

                @Override
                protected Iterator<String> getChoices(final String input) {
                    return AjaxTextFieldPanel.this.getChoices(input);
                }
            };
        }
    };
    add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true));

    if (enableOnChange && !isReadOnly()) {
        field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                // nothing to do
            }
        });
    }
}
 
开发者ID:apache,项目名称:syncope,代码行数:50,代码来源:AjaxTextFieldPanel.java

示例9: updateFeedbackPanel

import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; //导入依赖的package包/类
protected void updateFeedbackPanel(AutoCompleteTextField input, boolean isError, AjaxRequestTarget target){

    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:4,代码来源:AutoCompleteTextPanel.java


注:本文中的org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。