Java Code Examples for org.apache.wicket.markup.html.form.TextField

The following are top voted examples for showing how to use org.apache.wicket.markup.html.form.TextField. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: gitplex-mit   File: NumericPropertyEditor.java   View source code 7 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	input = new TextField<Number>("input", Model.of(getModelObject()));
	input.setType(getPropertyDescriptor().getPropertyClass());
	add(input);

	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
}
 
Example 2
Project: GeoCrawler   File: SeedPage.java   View source code 7 votes vote down vote up
private void addUrlForm() {
  urlForm = new Form<SeedUrl>("urlForm", CompoundPropertyModel.of(Model
      .of(new SeedUrl())));
  urlForm.setOutputMarkupId(true);
  urlForm.add(new TextField<String>("url"));
  urlForm.add(new AjaxSubmitLink("addUrl", urlForm) {
    @Override
    protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
      addSeedUrl();
      urlForm.setModelObject(new SeedUrl());
      target.add(urlForm);
      target.add(seedUrlsTable);
    }
  });
  add(urlForm);
}
 
Example 3
Project: Unicorn   File: LoginPage.java   View source code 7 votes vote down vote up
private void buildMainLayout() {
	this.loginForm = new WarnOnExitForm("loginForm");

	this.emailInput = new TextField<String>("emailInput", Model.of(""));
	this.loginForm.add(this.emailInput);

	this.passwordInput = new PasswordTextField("passwordInput", Model.of(""));
	this.loginForm.add(this.passwordInput);

	this.addLoginButton();
	this.addRegisterLink();

	this.add(this.loginForm);

	this.logoutForm = new Form<Object>("logoutForm");

	this.addLogoutButton();

	this.add(this.logoutForm);

	if (((AuthenticatedSession) Session.get()).getUser() != null) {
		this.loginForm.setVisible(false);
	} else {
		this.logoutForm.setVisible(false);
	}
}
 
Example 4
Project: owsi-core-parent   File: UserSearchPanel.java   View source code 7 votes vote down vote up
public UserSearchPanel(String id, IPageable pageable, AbstractUserDataProvider<User> dataProvider) {
	super(id);
	
	// Quick search
	add(new UserQuickSearchComponent("userQuickSearch"));
	
	// Search form
	Form<Void> form = new PageableSearchForm<Void>("form", pageable);
	
	TextField<String> searchInput = new TextField<String>("searchInput", dataProvider.getNameModel());
	searchInput.setLabel(new ResourceModel("user.portfolio.search.name"));
	searchInput.add(new LabelPlaceholderBehavior());
	form.add(searchInput);
	
	CheckBox active = new CheckBox("includeInactive", dataProvider.getIncludeInactivesModel());
	active.setLabel(new ResourceModel("user.portfolio.search.includeInactive"));
	form.add(active);
	
	add(form);
}
 
Example 5
Project: GeoCrawler   File: SettingsPage.java   View source code 6 votes vote down vote up
public SettingsPage() {
  settingsTable = new WebMarkupContainer("settingsTable");
  settingsTable.setOutputMarkupId(true);
  RefreshingView<NutchConfig> nutchConfig = new RefreshingView<NutchConfig>(
      "settings") {

    @Override
    protected Iterator<IModel<NutchConfig>> getItemModels() {
      return new CpmIteratorAdapter<NutchConfig>(
          convertNutchConfig(nutchService.getNutchConfig(getCurrentInstance()
              .getId())));
    }

    @Override
    protected void populateItem(Item<NutchConfig> item) {
      item.add(new Label("name"));
      item.add(new TextField<String>("value"));
    }
  };
  settingsTable.add(nutchConfig);
  add(settingsTable);
}
 
Example 6
Project: MBaaS   File: CollectionCreatePage.java   View source code 6 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    this.form = new Form<>("form");
    layout.add(this.form);

    this.nameField = new TextField<>("nameField", new PropertyModel<>(this, "name"));
    this.nameField.add(new CollectionNameValidator());
    this.nameField.setRequired(true);
    this.form.add(this.nameField);

    this.nameFeedback = new TextFeedbackPanel("nameFeedback", this.nameField);
    this.form.add(this.nameFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", CollectionBrowsePage.class);
    this.form.add(this.closeButton);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);
}
 
Example 7
Project: engerek   File: TextPopupPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
    final TextField input = initTextField();

    input.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            //nothing to do, just update model data
        }
    });
    input.add(new Behavior() {

        @Override
        public void bind(Component component) {
            super.bind(component);

            component.add(AttributeModifier.replace("onkeydown",
                    Model.of("if(event.keyCode == 13) {event.preventDefault();}")));
        }
    });
    input.setOutputMarkupId(true);
    add(input);
}
 
Example 8
Project: engerek   File: TextDetailsPanel.java   View source code 6 votes vote down vote up
public TextDetailsPanel(String id, IModel<T> model, Class clazz){
    super(id);

    final TextField<T> text = new TextField<>(ID_INPUT, model);
    text.setType(clazz);
    add(text);

    Label details = new Label(ID_DETAILS);
    details.add(AttributeModifier.replace("title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return createAssociationTooltip();
        }
    }));
    details.add(new InfoTooltipBehavior(){

        @Override
        public String getDataPlacement(){
            return "bottom";
        }
    });
    add(details);
}
 
Example 9
Project: vlo-curation   File: AllFacetValuesPanel.java   View source code 6 votes vote down vote up
private Form createOptionsForm(String id) {
    final Form options = new AjaxIndicatingForm(id);

    final DropDownChoice<SortParam<FieldValuesOrder>> sortSelect
            = new FieldValueOrderSelector("sort", new PropertyModel<SortParam<FieldValuesOrder>>(valuesProvider, "sort"));
    sortSelect.add(new UpdateOptionsFormBehavior(options));
    options.add(sortSelect);

    final TextField filterField = new TextField<>("filter", new PropertyModel(filterModel, "name"));
    filterField.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(valuesContainer);
        }
    });
    options.add(filterField);

    addOccurenceOptions(options);

    return options;
}
 
Example 10
Project: vlo-curation   File: FacetValuesPanel.java   View source code 6 votes vote down vote up
/**
 * Creates a form with an input bound to the filter model
 *
 * @param id component id
 * @return filter form
 */
private Form createFilterForm(String id) {
    final Form filterForm = new Form(id);
    final TextField<String> filterField = new TextField<>("filterText",
            new PropertyModel<String>(filterModel, "name"));
    // make field update 
    filterField.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            //update values
            target.add(valuesContainer);
        }
    });
    filterForm.add(filterField);
    return filterForm;
}
 
Example 11
Project: vlo-curation   File: BookmarkLinkPanel.java   View source code 6 votes vote down vote up
public BookmarkLinkPanel(String id, IModel<String> linkModel, IModel<String> pageTitleModel) {
    super(id);
    this.linkModel = linkModel;
    this.pageTitleModel = pageTitleModel;

    add(new ExternalLink("link", linkModel)
            .add(new Label("linkText", pageTitleModel)));
    add(new TextField("linkInput", linkModel));

    add(new WebMarkupContainer("bookmarkInstructions") {
        @Override
        protected void onConfigure() {
            setVisible(bookmarkMode);
        }

    });
    add(new WebMarkupContainer("copyInstructions") {
        @Override
        protected void onConfigure() {
            setVisible(copyMode);
        }

    });
}
 
Example 12
Project: singular-server   File: FormPageTest.java   View source code 6 votes vote down vote up
@WithUserDetails("vinicius.nunes")
@Test
public void testLoadDraft() {
    tester = new SingularWicketTester(singularApplication);

    FormPage p = saveDraft();

    RequirementInstance requirement = getRequirementFrom(p);

    ActionContext context = new ActionContext();
    context.setFormName(SPackageFOO.STypeFOO.FULL_NAME);
    context.setFormAction(FormAction.FORM_FILL);
    context.setRequirementId(requirement.getCod());

    FormPage p2 = new FormPage(context);
    tester.startPage(p2);
    tester.assertRenderedPage(FormPage.class);

    TextField<String> t2 = (TextField<String>) new AssertionsWComponent(p2).getSubComponents(TextField.class).first().getTarget();
    assertEquals(SUPER_TESTE_STRING, t2.getDefaultModelObject());
}
 
Example 13
Project: Unicorn   File: ProbabilityEntryPanel.java   View source code 6 votes vote down vote up
public ProbabilityEntryPanel(final String id, final int entryId, final SimulationTreeTableProvider<Object> simulationTreeTableProvider) {
	super(id);
	final Form<Void> form = new Form<Void>("form");

	this.textField = new TextField<String>("textFieldID", Model.of(simulationTreeTableProvider.getProbabilityForEntry(entryId)));
	this.textField.setOutputMarkupPlaceholderTag(true);
	this.textField.setOutputMarkupId(true);
	this.textField.add(new AjaxFormComponentUpdatingBehavior("onchange") {

		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {

			simulationTreeTableProvider.setProbabilityForEntry(ProbabilityEntryPanel.this.textField.getValue(), entryId);
		}
	});

	form.add(this.textField);

	this.add(form);
}
 
Example 14
Project: Unicorn   File: BasicTransformationRuleEditorPanel.java   View source code 6 votes vote down vote up
private void buildTextFields() {
	this.transformationRuleNameTextField = new TextField<String>("transformationRuleNameTextField", new PropertyModel<String>(this, "transformationRuleName"));
	this.transformationRuleNameTextField.setOutputMarkupId(true);
	this.layoutForm.add(this.transformationRuleNameTextField);

	final List<String> eventTypes = EapEventType.getAllTypeNames();
	this.eventTypeDropDownChoice = new DropDownChoice<String>("eventTypeDropDownChoice", new PropertyModel<String>(this, "selectedEventTypeName"), eventTypes);
	this.eventTypeDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			BasicTransformationRuleEditorPanel.this.updateOnChangeOfDropDownChoice(target);
		}
	});
	this.layoutForm.add(this.eventTypeDropDownChoice);

	this.transformationRuleTextArea = new TextArea<String>("transformationRuleTextArea", new PropertyModel<String>(this, "transformationRule"));
	this.transformationRuleTextArea.setOutputMarkupId(true);
	this.layoutForm.add(this.transformationRuleTextArea);
}
 
Example 15
Project: Unicorn   File: RepeatPatternOperatorRangePanel.java   View source code 6 votes vote down vote up
public RepeatPatternOperatorRangePanel(final String id, final PatternOperatorElement element, final AdvancedTransformationRuleEditorPanel panel) {
	super(id);

	this.layoutForm = new Form<Void>("layoutForm");

	final RangeElement rangeElement = element.getRangeElement();

	this.matchCount = rangeElement.getLeftEndpoint();

	this.matchCountInput = new TextField<Integer>("matchCountInput", new PropertyModel<Integer>(this, "matchCount"));
	final OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior() {
		private static final long serialVersionUID = 2251803290291534439L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			rangeElement.setLeftEndpoint(RepeatPatternOperatorRangePanel.this.matchCount);
			target.add(panel.getAttributeTreePanel().getAttributeTreeTable());
		}
	};
	this.matchCountInput.add(onChangeAjaxBehavior);
	this.matchCountInput.setOutputMarkupId(true);
	this.layoutForm.add(this.matchCountInput);

	this.add(this.layoutForm);
}
 
Example 16
Project: Unicorn   File: EventTypeAliasPanel.java   View source code 6 votes vote down vote up
private void buildEventTypeAliasInput() {
	final TextField<String> eventTypeAliasInput = new TextField<String>("eventTypeAliasInput", new PropertyModel<String>(this, "alias"));
	eventTypeAliasInput.setOutputMarkupId(true);

	final OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior() {
		private static final long serialVersionUID = -1427433442511094442L;

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			// TODO: make sure that alias does not already exist somewhere
			EventTypeAliasPanel.this.element.setAlias(EventTypeAliasPanel.this.alias);
			target.add(EventTypeAliasPanel.this.panel.getAttributeTreePanel().getAttributeTreeTable());
		}
	};
	eventTypeAliasInput.add(onChangeAjaxBehavior);

	this.layoutForm.add(eventTypeAliasInput);
}
 
Example 17
Project: Unicorn   File: FlexConditionInputPanel.java   View source code 6 votes vote down vote up
public FlexConditionInputPanel(final String id) {
	super(id);

	this.conditionAttributeSelect = new DropDownChoice<String>("conditionAttributeSelect", new PropertyModel<String>(this, "selectedConditionAttribute"), new ArrayList<String>());
	this.conditionAttributeSelect.setOutputMarkupId(true);
	this.conditionAttributeSelect.add(new AjaxFormComponentUpdatingBehavior("onChange") {

		@Override
		protected void onUpdate(final AjaxRequestTarget target) {
			// collect all attributes
			final Set<Serializable> attributes = new HashSet<Serializable>();
			for (final EapEventType eventType : FlexConditionInputPanel.this.selectedEventTypes) {
				attributes.addAll(eventType.findAttributeValues(FlexConditionInputPanel.this.selectedConditionAttribute));
			}
		}
	});
	this.add(this.conditionAttributeSelect);

	this.conditionValueInput = new TextField("conditionValueInput", new PropertyModel<String>(this, "selectedConditionValue"));
	this.conditionValueInput.setOutputMarkupId(true);
	this.add(this.conditionValueInput);
}
 
Example 18
Project: directory-fortress-commander   File: LoginPage.java   View source code 6 votes vote down vote up
public LoginPageForm( String id )
{
    super( id );
    HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
    Principal principal = servletReq.getUserPrincipal();
    if ( principal != null )
    {
        LOG.info( "user already logged in, route to launch page instead" );
        setResponsePage( LaunchPage.class );
    }
    add( new Button( "login" ) );
    TextField userId = new TextField( "userId", new PropertyModel<String>( this, "userId" ) );
    add( userId );
    PasswordTextField pw = new PasswordTextField( "pswdField", new PropertyModel<String>( this, "pswdField" ) );
    pw.setRequired( false );
    add( pw );
}
 
Example 19
Project: owsi-core-parent   File: AddUserPopupPanel.java   View source code 6 votes vote down vote up
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, AddUserPopupPanel.class);
	
	addUserForm = new Form<User>("addUserForm", getModel());
	body.add(addUserForm);
	
	TextField<String> userName = new RequiredTextField<String>("userName", BindingModel.of(addUserForm.getModel(), Bindings.user().userName()));
	userName.setLabel(new ResourceModel("widgets.modal.user.userName"));
	addUserForm.add(userName);
	
	TextField<String> firstName = new RequiredTextField<String>("firstName", BindingModel.of(addUserForm.getModel(), Bindings.user().firstName()));
	firstName.setLabel(new ResourceModel("widgets.modal.user.firstName"));
	addUserForm.add(firstName);
	
	TextField<String> lastName = new RequiredTextField<String>("lastName", BindingModel.of(addUserForm.getModel(), Bindings.user().lastName()));
	lastName.setLabel(new ResourceModel("widgets.modal.user.lastName"));
	addUserForm.add(lastName);
	
	EmailTextField email = new EmailTextField("email", BindingModel.of(addUserForm.getModel(), Bindings.user().email()));
	email.setRequired(true);
	email.setLabel(new ResourceModel("widgets.modal.user.email"));
	addUserForm.add(email);
	
	return body;
}
 
Example 20
Project: oldSyncopeIdM   File: AjaxNumberFieldPanel.java   View source code 6 votes vote down vote up
public AjaxNumberFieldPanel(
        final String id,
        final String name,
        final IModel<Number> model,
        final Class reference,
        final boolean active) {

    super(id, name, model, active);

    field = new TextField<Number>("numberField", model, reference);

    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
            }
        });
    }
}
 
Example 21
Project: openmeetings   File: OAuthForm.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	add(new RequiredTextField<String>("name").setLabel(Model.of(getString("165"))));
	add(new TextField<String>("iconUrl").setLabel(Model.of(getString("1575"))));
	add(new RequiredTextField<String>("clientId").setLabel(Model.of(getString("1576"))));
	add(new RequiredTextField<String>("clientSecret").setLabel(Model.of(getString("1577"))));
	add(redirectUriText = (TextField<String>) new TextField<>("redirectUri", Model.of("")).setLabel(Model.of(getString("1587"))));
	add(new RequiredTextField<String>("requestKeyUrl").setLabel(Model.of(getString("1578"))));
	add(new RequiredTextField<String>("requestTokenUrl").setLabel(Model.of(getString("1579"))));
	add(new RequiredTextField<String>("requestTokenAttributes").setLabel(Model.of(getString("1586"))));
	add(new RequiredTextField<String>("requestInfoUrl").setLabel(Model.of(getString("1580"))));
	add(new RequiredTextField<String>("loginParamName").setLabel(Model.of(getString("1582"))));
	add(new RequiredTextField<String>("emailParamName").setLabel(Model.of(getString("1583"))));
	add(new TextField<String>("firstnameParamName").setLabel(Model.of(getString("1584"))));
	add(new TextField<String>("lastnameParamName").setLabel(Model.of(getString("1585"))));
	super.onInitialize();
}
 
Example 22
Project: openmeetings   File: LdapForm.java   View source code 6 votes vote down vote up
public LdapForm(String id, WebMarkupContainer listContainer, final LdapConfig ldapConfig) {
	super(id, new CompoundPropertyModel<>(ldapConfig));
	setOutputMarkupId(true);
	this.listContainer = listContainer;

	add(new CheckBox("active"));
	add(new DateLabel("inserted"));
	add(new Label("insertedby.login"));
	add(new DateLabel("updated"));
	add(new Label("updatedby.login"));
	add(new CheckBox("addDomainToUserName"));
	add(new TextField<String>("domain"));
	add(new TextArea<String>("comment"));

	// attach an ajax validation behavior to all form component's keydown
	// event and throttle it down to once per second
	add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND));
}
 
Example 23
Project: webanno   File: TagEditorPanel.java   View source code 6 votes vote down vote up
public TagEditorPanel(String aId, IModel<TagSet> aTagSet, IModel<Tag> aTag)
{
    super(aId, aTag);
    
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    
    selectedTagSet = aTagSet;
    selectedTag = aTag;
    
    Form<Tag> form = new Form<>("form", CompoundPropertyModel.of(aTag));
    add(form);
    
    form.add(new TextField<String>("name")
            .add(new TagExistsValidator())
            .setRequired(true));
    form.add(new TextArea<String>("description"));
    
    form.add(new LambdaAjaxButton<>("save", this::actionSave));
    form.add(new LambdaAjaxLink("delete", this::actionDelete)
            .onConfigure(_this -> _this.setVisible(form.getModelObject().getId() != 0)));
    form.add(new LambdaAjaxLink("cancel", this::actionCancel));
}
 
Example 24
Project: artifactory   File: LdapCreateUpdatePanel.java   View source code 6 votes vote down vote up
private void addTestConnectionFields() {
    TitledBorder borderTest = new TitledBorder("borderTest");
    form.add(borderTest);
    borderTest.add(new TextField<>("testUsername", new PropertyModel<String>(this, "testUsername")));
    borderTest.add(new HelpBubble("testUsername.help", "Username to test the LDAP connection"));

    PasswordTextField testPasswordField = new PasswordTextField(
            "testPassword", new PropertyModel<String>(this, "testPassword"));
    testPasswordField.setRequired(false);
    testPasswordField.setResetPassword(false);
    borderTest.add(testPasswordField);
    borderTest.add(new HelpBubble("testPassword.help", "Password to test the LDAP connection"));

    // Test connection button
    borderTest.add(createTestConnectionButton());
}
 
Example 25
Project: artifactory   File: HttpRepoAdvancedPanel.java   View source code 6 votes vote down vote up
private void addCacheFields() {
    WebMarkupContainer cacheBorder = new WebMarkupContainer("cacheBorder");
    cacheBorder.add(new TitledBorderBehavior("fieldset-border", "Cache"));
    add(cacheBorder);

    // unusedArtifactsCleanupPeriodHours
    final TextField<Integer> unusedCleanupTextField = new TextField<>("unusedArtifactsCleanupPeriodHours",
            Integer.class);
    unusedCleanupTextField.add(new MinimumValidator<>(0)).setRequired(true);
    unusedCleanupTextField.setOutputMarkupId(true);
    cacheBorder.add(unusedCleanupTextField);
    cacheBorder.add(new SchemaHelpBubble("unusedArtifactsCleanupPeriodHours.help"));

    addDurationField(cacheBorder, "retrievalCachePeriodSecs");
    addDurationField(cacheBorder, "assumedOfflinePeriodSecs");
    addDurationField(cacheBorder, "missedRetrievalCachePeriodSecs");
}
 
Example 26
Project: superfly   File: SSOLoginPasswordPage.java   View source code 6 votes vote down vote up
public SSOLoginPasswordPage() {
    final SSOLoginData loginData = SSOUtils.getSsoLoginData(this);
    if (loginData == null) {
        RequestCycle.get().setResponsePage(new SSOLoginErrorPage(new Model<String>("No login data found")));
    }

    final LoginBean loginBean = new LoginBean();
    Form<Void> form = new Form<Void>("form") {
        @Override
        protected void onSubmit() {
            doOnSubmit(loginBean, loginData);
        }
    };
    add(form);
    form.add(new TextField<String>("username", new PropertyModel<String>(loginBean, "username")));
    form.add(new PasswordTextField("password", new PropertyModel<String>(loginBean, "password")));

    errorMessageLabel = new Label("message", errorMessageModel);
    errorMessageLabel.setVisible(StringUtils.hasLength(errorMessageModel.getObject()));
    form.add(errorMessageLabel);
}
 
Example 27
Project: ansible-docker-talk   File: NewPersonForm.java   View source code 5 votes vote down vote up
public NewPersonForm(String id, IModel<Person> model) {
    super(id, model);
    add(new TextField<String>("firstName"));
    add(new TextField<String>("lastName"));
     add(new TextField<String>("jobTitle"));
    add(new Button("submitButton"));

}
 
Example 28
Project: gitplex-mit   File: TagPatternEditor.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
   	
   	input = new TextField<String>("input", getModel());
   	
   	input.add(new TagPatternAssistBehavior(new AbstractReadOnlyModel<Project>() {

		@Override
		public Project getObject() {
			return ((ProjectPage) getPage()).getProject();
		}
   		
   	}));
       
       add(input);
       
	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
       
}
 
Example 29
Project: gitplex-mit   File: BranchPatternEditor.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
   	
   	input = new TextField<String>("input", getModel());
   	input.add(new BranchPatternAssistBehavior(new AbstractReadOnlyModel<Project>() {

		@Override
		public Project getObject() {
			return ((ProjectPage)getPage()).getProject();
		}
   		
   	}));
       
       add(input);
       
	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
       
}
 
Example 30
Project: gitplex-mit   File: PathPatternEditor.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
   	
   	input = new TextField<String>("input", getModel());
       input.add(new PathPatternAssistBehavior(new AbstractReadOnlyModel<Project>() {

		@Override
		public Project getObject() {
			return ((ProjectPage) getPage()).getProject();
		}
   		
   	}));
       
       add(input);
       
	add(new AttributeAppender("class", new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			if (hasErrors(true))
				return " has-error";
			else
				return "";
		}
		
	}));
       
}
 
Example 31
Project: openNaEF   File: VrfSearchPage.java   View source code 5 votes vote down vote up
private TextField<String> addTextField(String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName), String.class);
    this.form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 32
Project: openNaEF   File: VplsSearchPage.java   View source code 5 votes vote down vote up
private TextField<String> addTextField(String id, String attributeName, AbstractValidator<String> validator) {
    TextField<String> tf = new TextField<String>(id, new PropertyModel<String>(this, attributeName), String.class);
    this.form.add(tf);
    if (validator != null) {
        tf.add(validator);
    }
    return tf;
}
 
Example 33
Project: GeoCrawler   File: SeedPage.java   View source code 5 votes vote down vote up
private void addBaseForm() {
  Form<SeedList> form = new Form<SeedList>("seedList", getModel()) {
    @Override
    protected void onSubmit() {
      seedListService.save(getModelObject());
      setResponsePage(SeedListsPage.class);
    }
  };
  form.add(new TextField<String>("name"));
  add(form);
}
 
Example 34
Project: coling2016-marketing-blunders   File: HomePage.java   View source code 5 votes vote down vote up
protected void handleSearch() {
	StatelessForm<Void> form = new StatelessForm<Void>("searchForm"){
		@Override
		protected void onSubmit() {
			PageParameters parameters = new PageParameters();
			parameters.add("search", search);
			setResponsePage(SearchPage.class, parameters);
		}
	};
 	form.add(new TextField<Void>("search"));
 	add(form.setDefaultModel(new CompoundPropertyModel<ApplicationPageBase>(this)));
}
 
Example 35
Project: MBaaS   File: StringPanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<String> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    field.add(StringValidator.maximumLength(255));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 36
Project: MBaaS   File: DoublePanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Double> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.add(RangeValidator.range(Double.MIN_VALUE, Double.MAX_VALUE));
    field.setType(Double.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 37
Project: MBaaS   File: CharacterPanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Character> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name), Character.class);
    field.add(AttributeModifier.replace("maxlength", "1"));
    field.setType(Character.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 38
Project: MBaaS   File: LongPanel.java   View source code 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Long> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    field.setType(Long.class);
    field.add(RangeValidator.range(Long.MIN_VALUE, Long.MAX_VALUE));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 39
Project: MBaaS   File: RoleCreatePage.java   View source code 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    this.form = new Form<>("form");
    layout.add(this.form);

    this.pageField = new Select2MultipleChoice<>("pageField", new PropertyModel<>(this, "cmsPage"), new PagesChoiceProvider());
    this.form.add(this.pageField);
    this.pageFeedback = new TextFeedbackPanel("pageFeedback", this.pageField);
    this.form.add(this.pageFeedback);

    this.restField = new Select2MultipleChoice<>("restField", new PropertyModel<>(this, "rest"), new RestsChoiceProvider());
    this.form.add(this.restField);
    this.restFeedback = new TextFeedbackPanel("restFeedback", this.restField);
    this.form.add(this.restFeedback);

    this.nameField = new TextField<>("nameField", new PropertyModel<>(this, "name"));
    this.nameField.setRequired(true);
    this.form.add(this.nameField);
    this.nameFeedback = new TextFeedbackPanel("nameFeedback", this.nameField);
    this.form.add(this.nameFeedback);

    this.descriptionField = new TextField<>("descriptionField", new PropertyModel<>(this, "description"));
    this.descriptionField.setRequired(true);
    this.form.add(this.descriptionField);
    this.descriptionFeedback = new TextFeedbackPanel("descriptionFeedback", this.descriptionField);
    this.form.add(this.descriptionFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.closeButton = new BookmarkablePageLink<>("closeButton", RoleBrowsePage.class);
    this.form.add(this.closeButton);
}
 
Example 40
Project: MBaaS   File: SectionCreatePage.java   View source code 5 votes vote down vote up
@Override
protected void doInitialize(Border layout) {
    add(layout);

    this.form = new Form<>("form");
    layout.add(this.form);

    this.titleField = new TextField<>("titleField", new PropertyModel<>(this, "title"));
    this.titleField.setRequired(true);
    this.titleField.add(new SectionTitleValidator());
    this.form.add(this.titleField);
    this.titleFeedback = new TextFeedbackPanel("titleFeedback", this.titleField);
    this.form.add(this.titleFeedback);

    this.saveButton = new Button("saveButton");
    this.saveButton.setOnSubmit(this::saveButtonOnSubmit);
    this.form.add(this.saveButton);

    this.orderField = new TextField<>("orderField", new PropertyModel<>(this, "order"));
    this.orderField.setRequired(true);
    this.form.add(this.orderField);
    this.orderFeedback = new TextFeedbackPanel("orderFeedback", this.orderField);
    this.form.add(this.orderFeedback);

    this.closeButton = new BookmarkablePageLink<>("closeButton", SectionBrowsePage.class);
    this.form.add(this.closeButton);
}