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

The following examples show how to use org.apache.wicket.markup.html.form.TextField. 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: AnalysisRuntimePanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public AnalysisRuntimePanel(String id, ReportRuntimeModel model) {
	super(id);

	Label label = new Label("analysisLabel", getString("Analysis.run.name"));
	add(label);
	
	TextField<String> analysisText = new TextField<String>("analysisText", new PropertyModel(model, "analysisName"));    	
   	add(analysisText);
   	
   	AjaxLink analysisLink = new AjaxLink("analysisLink") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			// TODO Auto-generated method stub
			
		}
   		
   	}; 
   	add(analysisLink);
}
 
Example #2
Source File: CleanHistorySettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@Override
protected void addComponents(Form<Settings> form) {
	final TextField<String> cronField = new TextField<String>("cleanHistory.cronExpression");
	cronField.setRequired(true);
	form.add(cronField);
	//
	ContextImage cronImage = new ContextImage("cronImage", "images/information.png");
	cronImage.add(new SimpleTooltipBehavior(getString("Settings.synchronizer.cronTooltip")));
	form.add(cronImage);
	//
	System.out.println("settings = " + form.getModelObject());
	final TextField<Integer> daysToKeepField = new TextField<Integer>("cleanHistory.daysToKeep");
	form.add(daysToKeepField);
	//
	final TextField<Integer> daysToDeleteField = new TextField<Integer>("cleanHistory.daysToDelete");
	form.add(daysToDeleteField);
	//
	final CheckBox checkBoxEnable = new CheckBox("cleanHistory.shrinkDataFolder");
	form.add(checkBoxEnable);
	//
	CleanHistorySettings settings = storageService.getSettings().getCleanHistory();
	oldCronExpression = String.valueOf(settings.getCronExpression());
}
 
Example #3
Source File: OClusterMetaPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Component resolveComponent(String id, DisplayMode mode, String critery) {

    if(DisplayMode.EDIT.equals(mode) && !OSecurityHelper.isAllowed(ORule.ResourceGeneric.SCHEMA, null, OrientPermission.UPDATE))
    {
        mode = DisplayMode.VIEW;
    }
    if(DisplayMode.VIEW.equals(mode))
    {
        return new Label(id, getModel());
    }
    else if(DisplayMode.EDIT.equals(mode)) {
        if (OClustersWidget.COMPRESSION.equals(critery)) {
            return new DropDownChoice<String>(id, (IModel<String>)getModel(), COMPRESSIONS);
        }
        else if(OClustersWidget.COUNT.equals(critery) || OClustersWidget.ID.equals(critery)){
            return resolveComponent(id, DisplayMode.VIEW, critery);
        } else {
            return new TextField<V>(id, getModel()).setType(String.class);
        }
    }
    return null;
}
 
Example #4
Source File: ReportsITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
private static void createReport(final String name) {
    TESTER.clickLink(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:container:content:add");

    TESTER.assertComponent(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer", Modal.class);

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:name:textField", name);
    formTester.setValue("content:form:view:template:dropDownChoiceField", "0");
    formTester.submit("content:form:buttons:next");

    TESTER.assertComponent(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater"
            + ":0:outer:form:content:form:view:schedule:seconds:textField", TextField.class);

    formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:form:buttons:finish");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:reportsLI:reports");
}
 
Example #5
Source File: EmbeddedCollectionContainsFilterPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public FormComponent<?> createFilterComponent(IModel<?> model) {
    OProperty property = getEntityModel().getObject();
    FormComponent<?> component;
    switch (property.getLinkedType()) {
        case BOOLEAN:
            component = new BooleanFilterPanel(getFilterId(), (IModel<Boolean>) model);
            break;
        case DATE:
            component = new BooleanFilterPanel(getFilterId(), (IModel<Boolean>) model);
            break;
        case DATETIME:
            component = new ODateField(getFilterId(), (IModel<Date>) model);
            break;
        default:
            component = new TextField<>(getFilterId(), model);
    }
    return component;
}
 
Example #6
Source File: MinutelyJobPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public MinutelyJobPanel(String id, SchedulerJob schedulerJob) {
    super(id);
    this.schedulerJob = schedulerJob;

    add(minuteLabel = new Label("minuteLabel", getString("JobPanel.everyMinute")));

    add(hoursLabel = new Label("hoursLabel", getString("hours")));
    add(daysLabel = new Label("daysLabel", getString("days")));
    add(monthsLabel = new Label("monthsLabel", getString("months")));

    minuteText = new TextField<Integer>("minuteText", new PropertyModel<Integer>(schedulerJob, "time.gap"));
    minuteText.setLabel(new Model<String>(getString("JobPanel.everyMinute")));
    minuteText.add(new RangeValidator<Integer>(1, 59));
    add(minuteText);
   
    add(hoursPanel = new IntervalFieldPanel("hoursPanel", new PropertyModel(schedulerJob, "time.hours"), SelectIntervalPanel.HOUR_ENTITY, null));
    add(daysPanel = new IntervalFieldPanel("daysPanel", new PropertyModel(schedulerJob, "time.days"), SelectIntervalPanel.DAY_ENTITY, null));
    add(monthsPanel = new IntervalFieldPanel("monthsPanel", new PropertyModel(schedulerJob, "time.months"), SelectIntervalPanel.MONTH_ENTITY, null));

    setAdvancedType(false);
}
 
Example #7
Source File: AnyObjectsITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Test
public void filteredSearch() {
    TESTER.clickLink("body:realmsLI:realms");

    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");

    TESTER.clickLink(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");

    TESTER.executeAjaxEvent(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:"
            + "content:searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panelPlus:add",
            Constants.ON_CLICK);

    TESTER.assertComponent(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:"
            + "searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panel:container:value:"
            + "textField", TextField.class);
}
 
Example #8
Source File: AdministrationUserSearchPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public AdministrationUserSearchPanel(String id, IPageable pageable, IModel<String> searchTermModel) {
	super(id);
	
	this.pageable = pageable;
	
	this.searchTermModel = searchTermModel;
	
	Form<Void> form = new Form<Void>("form") {
		private static final long serialVersionUID = -584576228542906811L;
		@Override
		protected void onSubmit() {
			// Lors de la soumission d'un formulaire de recherche, on retourne sur la première page
			AdministrationUserSearchPanel.this.pageable.setCurrentPage(0);
			super.onSubmit();
		}
	};
	
	TextField<String> searchInput = new TextField<String>("searchInput", this.searchTermModel);
	form.add(searchInput);
	
	form.add(new SubmitLink("submit"));
	
	add(form);
}
 
Example #9
Source File: JasperSettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@Override
protected void addComponents(Form<Settings> form) {
	
	final TextField<String> homeField = new TextField<String>("jasper.home");
	homeField.setRequired(true);
    form.add(homeField);

	final CheckBox checkBoxD = new CheckBox("jasper.detectCellType");
	form.add(checkBoxD);

	final CheckBox checkBoxW = new CheckBox("jasper.whitePageBackground");
	form.add(checkBoxW);

	final CheckBox checkBoxR = new CheckBox("jasper.removeEmptySpaceBetweenRows");
	form.add(checkBoxR);

}
 
Example #10
Source File: ArtifactNotificationRuleFormPopupPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, ArtifactNotificationRuleFormPopupPanel.class);
	
	ruleForm = new Form<ArtifactNotificationRule>("form", getModel());
	body.add(ruleForm);
	
	TextField<String> regexField = new RequiredTextField<String>("regex", BindingModel.of(ruleForm.getModel(),
			Binding.artifactNotificationRule().regex()));
	regexField.setLabel(new ResourceModel("artifact.rules.field.regex"));
	ruleForm.add(regexField);
	
	ArtifactNotificationRuleTypeDropDownChoice typeField = new ArtifactNotificationRuleTypeDropDownChoice("type",
			BindingModel.of(ruleForm.getModel(), Binding.artifactNotificationRule().type()));
	typeField.setLabel(new ResourceModel("artifact.rules.field.type"));
	typeField.setRequired(true);
	ruleForm.add(typeField);
	
	return body;
}
 
Example #11
Source File: ProjectQueryEditor.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
   	
   	input = new TextField<String>("input", getModel());
       input.add(new ProjectQueryBehavior());
       
	input.setLabel(Model.of(getDescriptor().getDisplayName()));
       
       add(input);
	input.add(new OnTypingDoneBehavior() {

		@Override
		protected void onTypingDone(AjaxRequestTarget target) {
			onPropertyUpdating(target);
		}
		
	});
}
 
Example #12
Source File: UsersITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Test
public void filteredSearch() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    TESTER.clickLink(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");

    TESTER.executeAjaxEvent(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:"
            + "content:searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panelPlus:add",
            Constants.ON_CLICK);

    TESTER.assertComponent(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:"
            + "searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panel:container:value:"
            + "textField", TextField.class);
    TESTER.assertComponent(
            "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:"
            + "searchFormContainer:search:multiValueContainer:innerForm:content:view:1:panel:container:value:"
            + "textField", TextField.class);
}
 
Example #13
Source File: BootstrapFeedbackPopoverTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();

    TextField<String> textField = new TextField<>("input", new Model<String>());

    Form<Void> form = new Form<Void>("form"){
        @Override
        protected void onSubmit() {
            super.onSubmit();
            textField.error("this is an error from textfield with tabs (\t), new lines (\r\n), double quotes (\"hey\")");
            error("this is an error from form");
        }
    };
    BootstrapFeedbackPopover feedback = new BootstrapFeedbackPopover("feedback");

    add(form);
    form.add(feedback);
    feedback.add(textField);
}
 
Example #14
Source File: HRPlanningEditTablePanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
void init(final HRPlanningEntryDO entry)
{
  final boolean deleted = entry.isDeleted();
  final TextField<BigDecimal> unassignedHours = new TextField<BigDecimal>("unassignedHours", new PropertyModel<BigDecimal>(entry,
      "unassignedHours"));
  add(unassignedHours.setEnabled(!deleted));
  final TextField<BigDecimal> mondayHours = new TextField<BigDecimal>("mondayHours", new PropertyModel<BigDecimal>(entry, "mondayHours"));
  add(mondayHours.setEnabled(!deleted));
  final TextField<BigDecimal> tuesdayHours = new TextField<BigDecimal>("tuesdayHours", new PropertyModel<BigDecimal>(entry,
      "tuesdayHours"));
  add(tuesdayHours.setEnabled(!deleted));
  final TextField<BigDecimal> wednesdayHours = new TextField<BigDecimal>("wednesdayHours", new PropertyModel<BigDecimal>(entry,
      "wednesdayHours"));
  add(wednesdayHours.setEnabled(!deleted));
  final TextField<BigDecimal> thursdayHours = new TextField<BigDecimal>("thursdayHours", new PropertyModel<BigDecimal>(entry,
      "thursdayHours"));
  add(thursdayHours.setEnabled(!deleted));
  final TextField<BigDecimal> fridayHours = new TextField<BigDecimal>("fridayHours", new PropertyModel<BigDecimal>(entry, "fridayHours"));
  add(fridayHours.setEnabled(!deleted));
  final TextField<BigDecimal> weekendHours = new TextField<BigDecimal>("weekendHours", new PropertyModel<BigDecimal>(entry,
      "weekendHours"));
  add(weekendHours.setEnabled(!deleted));
}
 
Example #15
Source File: DefaultRegistrationPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    IModel<OrienteerUser> model = getModel();

    Form<?> form = new Form<>("form");

    form.add(new TextField<>("firstName", new PropertyModel<>(model, "firstName")).setRequired(true));
    form.add(new TextField<>("lastName", new PropertyModel<>(model, "lastName")).setRequired(true));
    form.add(createEmailField("email", new PropertyModel<>(model, "email")));

    TextField<String> passwordField = new PasswordTextField("password", passwordModel);
    TextField<String> confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));

    form.add(passwordField);
    form.add(confirmPasswordField);
    form.add(new EqualPasswordInputValidator(passwordField, confirmPasswordField));
    form.add(createRegisterButton("registerButton"));
    form.add(createSocialNetworksPanel("socialNetworks"));

    add(form);
    add(createFeedbackPanel("feedback"));
    setOutputMarkupPlaceholderTag(true);
}
 
Example #16
Source File: SelectDialogPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private Command<ODocument> createSelectAndSearchCommand(OrienteerDataTable<ODocument, String> table, OClassSearchPanel searchPanel) {
	return new AbstractCheckBoxEnabledCommand<ODocument>(new ResourceModel("command.selectAndSearchMode"), table) {
		@Override
		protected void onInitialize() {
			super.onInitialize();
			setBootstrapType(BootstrapType.SUCCESS);
			setIcon(FAIconType.hand_o_right);
			setAutoNotify(false);
		}

		@Override
		protected void performMultiAction(AjaxRequestTarget target, List<ODocument> objects) {
			if (onSelect(target, objects, true)) {
				TextField<String> field = searchPanel.getQueryField();
				resetSelection();
				target.add(getTable());
				target.focusComponent(field);
				target.appendJavaScript(String.format("$('#%s').select()", field.getMarkupId()));
			}
		}
	};
}
 
Example #17
Source File: CreateWorksitePanel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private void resetPanel(AjaxRequestTarget target,
		final TextField<String> siteNameField,
		final Palette<Person> palette, Label formFeedback) {

	siteNameField.setModelObject("");

	// there is quite possibly a better way of doing this
	List<Person> remove = new ArrayList<Person>();
	for (Person person : palette.getModelCollection()) {
		remove.add(person);
	}
	palette.getModelCollection().removeAll(remove);

	formFeedback.setVisible(false);
	
	target.add(siteNameField);
	target.appendJavaScript("$('#" + CreateWorksitePanel.this.getMarkupId()
			+ "').slideUp();");
	target.appendJavaScript("fixWindowVertical();");
}
 
Example #18
Source File: DefineDrillUrlPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public DefineDrillUrlPanel(String id, final DrillDownEntity drillEntity, Entity entity) {
	
	super(id, new CompoundPropertyModel<DrillDownEntity>(drillEntity));

	Label urlLabel = new Label("urlLabel", getString("Url"));		
	add(urlLabel);

	TextField<String> urlField = new TextField<String>("url");		
	add(urlField);
	
	Label infoLabel = new Label("infoLabel", getString("ActionContributor.Drill.url"));		
	add(infoLabel);
	
	Label columnLabel = new Label("columnLabel", getString("ActionContributor.Drill.column"));                    
	add(columnLabel);
                   
       TextField<Integer> columnField = new TextField<Integer>("column");                    
       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);            		   
       	} 
       }

}
 
Example #19
Source File: UrlLinkVisualizer.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel)
{
    switch (mode)
    {
        case VIEW:
            return new ExternalLink(id, (IModel<String>) valueModel,valueModel);
        case EDIT:
            return new TextField<String>(id, (IModel<String>) valueModel);
        default:
            return null;
    }
}
 
Example #20
Source File: EnduserITCase.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Test
public void mustChangePassword() {
    UserTO mustchangepassword = userService.read("mustchangepassword");
    userService.update(new UserUR.Builder(mustchangepassword.getKey()).
            mustChangePassword(new BooleanReplacePatchItem.Builder().value(Boolean.TRUE).build()).build());

    TESTER.startPage(Login.class);
    doLogin("mustchangepassword", "password123");

    TESTER.assertRenderedPage(MustChangePassword.class);

    final String changePwdForm = "changePassword";
    TESTER.assertComponent(changePwdForm + ":username", TextField.class);
    TESTER.assertComponent(changePwdForm + ":password:passwordField", PasswordTextField.class);
    TESTER.
            assertComponent(changePwdForm + ":confirmPassword:passwordField", PasswordTextField.class);
    TESTER.assertModelValue(changePwdForm + ":username", "mustchangepassword");

    FormTester formTester = TESTER.newFormTester(changePwdForm);

    assertNotNull(formTester);
    // 1. set new password
    formTester.setValue(findComponentById(changePwdForm + ":password", "passwordField"), "password124");
    // 2. confirm password
    formTester.setValue(findComponentById(changePwdForm + ":confirmPassword", "passwordField"),
            "password124");
    // 3. submit form
    TESTER.executeAjaxEvent(changePwdForm + ":submit", Constants.ON_CLICK);

    TESTER.assertRenderedPage(Login.class);
    TESTER.assertComponent("login:username", TextField.class);

    TESTER.cleanupFeedbackMessages();

    doLogin("mustchangepassword", "password124");
    TESTER.assertComponent(WIZARD_FORM + ":view:username:textField", TextField.class);
}
 
Example #21
Source File: TextFieldOrLabelPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param id
 * @param model
 * @param text field to show in read-write-mode.
 * @param readonly If true then a label is shown otherwise the given text field.
 * @see org.apache.wicket.Component#Component(String, IModel)
 */
public TextFieldOrLabelPanel(final String id, final IModel<T> model, final TextField<T> textField, final boolean readonly)
{
  super(id, model);
  if (readonly == true) {
    add(new Label("label", model).setRenderBodyOnly(true));
    add(new Label(INPUT_FIELD_WICKET_ID, "[invisible]").setVisible(false));
  } else {
    add(textField);
    add(new Label("label", "[invisible]").setVisible(false));
  }
}
 
Example #22
Source File: EncryptedFieldPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public EncryptedFieldPanel(
        final String id, final String name, final IModel<String> model, final boolean enableOnChange) {
    super(id, name, model);

    field = new TextField<String>("encryptedField", model) {

        private static final long serialVersionUID = 7545877620091912863L;

        @Override
        protected String[] getInputTypes() {
            return new String[] { "password" };
        }
    };

    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
            }
        });
    }

    add(field.setLabel(new ResourceModel(name, name)).setRequired(false).setOutputMarkupId(true));
}
 
Example #23
Source File: DerSchemaDetails.java    From syncope with Apache License 2.0 5 votes vote down vote up
public DerSchemaDetails(final String id, final DerSchemaTO schemaTO) {
    super(id, schemaTO);

    TextField<String> expression = new TextField<>("expression", new PropertyModel<>(schemaTO, "expression"));
    expression.setRequired(true);
    add(expression);

    add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right));
}
 
Example #24
Source File: IFrameSettingsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
protected void addComponents(Form<Settings> form) {
	
	final TextField<String> keyField = new TextField<String>("iframe.encryptionKey");		
    form.add(keyField);	    

	final CheckBox checkBoxEnable = new CheckBox("iframe.enable");
	form.add(checkBoxEnable);

	final CheckBox checkBoxAuth = new CheckBox("iframe.useAuthentication");
	form.add(checkBoxAuth);	
}
 
Example #25
Source File: AddTabDialog.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public AddTabDialog(String id) {
	super(id);
	Form<T> form = new Form<T>("addTabForm");
	form.add(tabName = new TextField<String>("tabName", Model.of("")));
	form.add(new AjaxButton("addTab") {
		@Override
		protected void onSubmit(AjaxRequestTarget target) {
			onCreateTab(tabName.getModelObject(), Optional.of(target));
			tabName.setModelObject("");
		}
	});
	add(form);
}
 
Example #26
Source File: MySocialNetworkingEdit.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private void validateUrl(TextField<String> urlTextField) {
	String input = urlTextField.getInput();

	if (StringUtils.isNotBlank(input)
			&& !(input.startsWith("http://") || input
					.startsWith("https://"))) {
		urlTextField.setConvertedInput("http://" + input);
	} else {
		urlTextField.setConvertedInput(StringUtils.isBlank(input) ? null : input);
	}
}
 
Example #27
Source File: SemesterPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SemesterForm(String id, Semester sem) {
     super(id, new CompoundPropertyModel<Semester>(sem));
     add(new RequiredTextField<String>(PROP_EID));
     add(new TextField<String>(PROP_TITLE));
     add(new TextField(PROP_START));
     add(new TextField(PROP_END));
     add(new TextField<String>(PROP_DESC){
    
private static final long serialVersionUID = 1L;

@Override
     	    protected boolean shouldTrimInput() {
     	        return false;
     	    }
     });	        
     add(new CheckBox(PROP_CURRENT));
     
     updateButtonModel = new ResourceModel(LABEL_BUTTON_SAVE);
     addButtonModel = new ResourceModel(LABEL_BUTTON_ADD);	        
     okButton = new Button("okbutton", addButtonModel); 
     add(okButton); 
     
     Button cancelButton = new Button("cancelbutton", new ResourceModel(LABEL_BUTTON_CANCEL)){	        
private static final long serialVersionUID = 1L;

@Override
     	public void onSubmit() {
     		clearForm();
     	}
     	
     	@Override
     	public boolean isVisible() {	        	
     		return updateEID != null; // only show when editing
     	}
     };
     cancelButton.setDefaultFormProcessing(false);
     add(cancelButton);
     
 }
 
Example #28
Source File: CustomerListPage.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
public CustomerListPage() {
	FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
	feedbackPanel.setOutputMarkupId(true);
	add(feedbackPanel);
	
	add(new WebSocketBehavior() {

		@Override
		protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) {
			if (message instanceof CustomerChangedEvent) {
				CustomerChangedEvent event = (CustomerChangedEvent)message;
				info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname());
				handler.add(feedbackPanel);
			}
		}

	});
	
	customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter());
	CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel);
	
	queue(new BookmarkablePageLink<Customer>("create", CustomerCreatePage.class));
	
	queue(new ValidationForm<>("form", customerFilterModel));
	queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id")));
	queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike")));
	queue(new LabeledFormBorder<>(getString("firstname"), new TextField<String>("firstnameLike").add(StringValidator.minimumLength(3))));
	queue(new LabeledFormBorder<>(getString("lastname"), new TextField<String>("lastnameLike").add(StringValidator.minimumLength(3))));
	queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active")));
	queue(cancelButton());
	
	customerDataTable(customerDataProvider);

}
 
Example #29
Source File: EmbeddedCollectionFilterPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public EmbeddedCollectionFilterPanel(String id, IModel<Collection<String>> model, String filterId,
                                     IModel<OProperty> propertyModel, IVisualizer visualizer,
                                     IFilterCriteriaManager manager, boolean isList) {
    super(id, model, filterId, propertyModel, visualizer, manager, Model.of(true));
    this.isList = isList;
    collectionInput = Lists.newArrayList();
    fieldFilter = new TextField<>("filter", Model.<String>of());
    fieldFilter.setOutputMarkupPlaceholderTag(true);
}
 
Example #30
Source File: OrienteerBasePage.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private Form<String> createSearchForm(String id, IModel<String> queryModel) {
	return new Form<String>(id, queryModel) {
		@Override
		protected void onInitialize() {
			super.onInitialize();
			add(new TextField<>("query", queryModel, String.class));
			add(new AjaxButton("search") {});
		}

		@Override
		protected void onConfigure() {
			super.onConfigure();
               OSecurityUser user = OrienteerWebSession.get().getUser();
               if (user != null) {
				OSecurityRole allowedRole = user.checkIfAllowed(OSecurityHelper.FEATURE_RESOURCE, SearchPage.SEARCH_FEATURE,
						OrientPermission.READ.getPermissionFlag());
                   setVisible(allowedRole != null);
               } else {
                   setVisible(false);
               }
           }

		@Override
		protected void onSubmit() {
			setResponsePage(new SearchPage(queryModel));
		}
	};
}