org.apache.wicket.model.PropertyModel Java Examples

The following examples show how to use org.apache.wicket.model.PropertyModel. 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: 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 #2
Source File: ChainLayerTraitsEditor.java    From webanno with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeForm(Form<ChainLayerTraits> aForm)
{
    aForm.add(new ValidationModeSelect("validationMode", getLayerModel()));
    
    aForm.add(new AnchoringModeSelect("anchoringMode", getLayerModel()));
    
    aForm.add(new OverlapModeSelect("overlapMode", getLayerModel()));
    
    CheckBox linkedListBehavior = new CheckBox("linkedListBehavior");
    linkedListBehavior.setModel(PropertyModel.of(getLayerModel(), "linkedListBehavior"));
    aForm.add(linkedListBehavior);
    
    CheckBox crossSentence = new CheckBox("crossSentence");
    crossSentence.setOutputMarkupPlaceholderTag(true);
    crossSentence.setModel(PropertyModel.of(getLayerModel(), "crossSentence"));
    crossSentence.add(visibleWhen(() -> !isBlank(getLayerModelObject().getType())));
    aForm.add(crossSentence);
    
    TextArea<String> onClickJavascriptAction = new TextArea<String>("onClickJavascriptAction");
    onClickJavascriptAction.setModel(PropertyModel.of(getLayerModel(), "onClickJavascriptAction"));
    onClickJavascriptAction.add(new AttributeModifier("placeholder",
            "alert($PARAM.PID + ' ' + $PARAM.PNAME + ' ' + $PARAM.DOCID + ' ' + "
                    + "$PARAM.DOCNAME + ' ' + $PARAM.fieldname);"));
    aForm.add(onClickJavascriptAction);
}
 
Example #3
Source File: TypeBrowser.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * @param id
 *          The wicket:id component ID of this form.
 */
public AddCriteriaForm(String id) {
  super(id, new CompoundPropertyModel<ElementCrit>(new ElementCrit()));
  List<Element> ptypeElements = fm.safeGetElementsForProductType(type);
  Collections.sort(ptypeElements, new Comparator<Element>() {
    public int compare(Element e1, Element e2) {
      return e1.getElementName().compareTo(e2.getElementName());
    }
  });

  add(new DropDownChoice<Element>("criteria_list", new PropertyModel(
      getDefaultModelObject(), "elem"), new ListModel<Element>(
      ptypeElements), new ChoiceRenderer<Element>("elementName",
      "elementId")));
  add(new TextField<TermQueryCriteria>(
      "criteria_form_add_element_value",
      new PropertyModel<TermQueryCriteria>(getDefaultModelObject(), "value")));
  add(new Button("criteria_elem_add"));
}
 
Example #4
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 #5
Source File: ApplicationModalPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
public ApplicationModalPanel(
        final ApplicationTO application,
        final boolean create,
        final BaseModal<ApplicationTO> modal,
        final PageReference pageRef) {

    super(modal, pageRef);
    this.application = application;
    this.create = create;

    modal.setFormModel(application);

    AjaxTextFieldPanel key = new AjaxTextFieldPanel(
            Constants.KEY_FIELD_NAME,
            Constants.KEY_FIELD_NAME,
            new PropertyModel<>(application, Constants.KEY_FIELD_NAME), false);
    key.setReadOnly(!create);
    key.setRequired(true);
    add(key);

    AjaxTextFieldPanel description = new AjaxTextFieldPanel(
            "description", "description", new PropertyModel<>(application, "description"), false);
    description.setRequired(false);
    add(description);
}
 
Example #6
Source File: GanttChartEditTreeTablePanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
private void addDurationColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject,
    final TaskDO task)
{
  final MinMaxNumberField<BigDecimal> durationField = new MinMaxNumberField<BigDecimal>("duration", new PropertyModel<BigDecimal>(
      ganttObject, "duration"), BigDecimal.ZERO, TaskEditForm.MAX_DURATION_DAYS);
  addColumn(item, durationField, null);
  new RejectSaveLinksFragment("rejectSaveDuration", item, durationField, task, task != null ? NumberFormatter.format(task.getDuration(),
      2) : "") {
    @Override
    protected void onSave()
    {
      task.setDuration(ganttObject.getDuration());
      taskDao.update(task);
    }

    @Override
    protected void onReject()
    {
      ganttObject.setDuration(task.getDuration());
    }
  };
}
 
Example #7
Source File: OrienteerBasePage.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private WebMarkupContainer createPerspectivesContainer(String id, IModel<ODocument> perspectiveModel,
													   IModel<List<ODocument>> perspectivesModel) {
	return new WebMarkupContainer(id) {
		@Override
		protected void onInitialize() {
			super.onInitialize();
			add(createPerspectivesList("perspectives", perspectivesModel));
			Button perspectiveButton = new Button("perspectiveButton");

			perspectiveButton.add(new FAIcon("icon", new PropertyModel<>(perspectiveModel, "icon")));
			perspectiveButton.add(new Label("name", new ODocumentNameModel(perspectiveModel)));
			add(perspectiveButton);

			setOutputMarkupPlaceholderTag(true);
		}

		@Override
		protected void onConfigure() {
			super.onConfigure();
			List<ODocument> perspectives = perspectivesModel.getObject();
			setVisible(perspectives != null && perspectives.size() > 1);
		}
	};
}
 
Example #8
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 #9
Source File: PrivilegeWizardBuilder.java    From syncope with Apache License 2.0 6 votes vote down vote up
public Profile(final PrivilegeTO privilege) {
    setTitleModel(privilege.getKey() == null
            ? new StringResourceModel("privilege.new")
            : new StringResourceModel("privilege.edit", Model.of(privilege)));

    AjaxTextFieldPanel key = new AjaxTextFieldPanel(
            Constants.KEY_FIELD_NAME,
            Constants.KEY_FIELD_NAME, new PropertyModel<>(privilege, Constants.KEY_FIELD_NAME), false);
    key.setReadOnly(privilege.getKey() != null);
    key.setRequired(true);
    add(key);

    AjaxTextFieldPanel description = new AjaxTextFieldPanel(
            "description", "description", new PropertyModel<>(privilege, "description"), false);
    description.setRequired(false);
    add(description);
}
 
Example #10
Source File: CartPanel.java    From the-app with Apache License 2.0 6 votes vote down vote up
private Component cartView() {
    cartView = new ListView<CartItemInfo>("cart", cartListModel()) {
        @Override
        protected void populateItem(ListItem<CartItemInfo> item) {
            WebMarkupContainer cartItem = new WebMarkupContainer("item");
            cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name")));
            cartItem.add(new IndicatingAjaxLink<Void>("delete") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    IModel<CartItemInfo> model = item.getModel();
                    send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target));
                }
            });
            cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum"))));
            item.add(cartItem);
        }
    };
    cartView.setReuseItems(false);
    cartView.setOutputMarkupId(true);
    return cartView;
}
 
Example #11
Source File: OrienteerBasePage.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize() {
	super.initialize();
	showChangedPerspectiveInfo();

	IModel<ODocument> perspectiveModel = PropertyModel.of(this, "perspective");
	IModel<List<ODocument>> perspectivesModel = new OQueryModel<>("select from " + PerspectivesModule.OPerspective.CLASS_NAME);
	add(createPerspectivesContainer("perspectivesContainer", perspectiveModel, perspectivesModel));
	add(new RecursiveMenuPanel("perspectiveItems", perspectiveModel));

	boolean signedIn = OrientDbWebSession.get().isSignedIn();
	add(new BookmarkablePageLink<>("login", LoginPage.class).setVisible(!signedIn));
	add(new BookmarkablePageLink<>("logout", LogoutPage.class).setVisible(signedIn));

	add(feedbacks = new OrienteerFeedbackPanel("feedbacks"));
	add(new ODocumentPageLink("myProfile", new PropertyModel<>(this, "session.user.document")));
	add(createUsernameLabel("username"));

	add(createSearchForm("searchForm", Model.of()));
}
 
Example #12
Source File: FileSelectorPanel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public FileSelectorPanel(String id, String siteId, IModel model, boolean showDefaultBaseFoldersOnly) {
	super(id, model);
	this.siteId = siteId;
	this.showDefaultBaseFoldersOnly = showDefaultBaseFoldersOnly;
	
	// selected files
	HiddenField selectedFiles = new HiddenField("selectedFiles", new PropertyModel(this, "selectedFiles"));
	add(selectedFiles);
	
	// hover div (for disabling control)
	WebMarkupContainer containerHover = new WebMarkupContainer("containerHover");
	if(isEnabled()) {
		containerHover.add(new AttributeModifier("style", new Model("display: block")));
	}else{
		containerHover.add(new AttributeModifier("style", new Model("display: none")));
	}
	add(containerHover);
	
	add(ajaxResourcesLoader);
}
 
Example #13
Source File: DomainWizardBuilder.java    From syncope with Apache License 2.0 6 votes vote down vote up
public KeymasterConfParams(final Domain domain) {
    JsonEditorPanel keymasterConfParams = new JsonEditorPanel(
            null, new PropertyModel<>(domain, "keymasterConfParams"), false, pageRef);
    keymasterConfParams.setOutputMarkupPlaceholderTag(true);
    keymasterConfParams.setVisible(false);
    add(keymasterConfParams);

    AjaxCheckBoxPanel defaultKeymasterConfParams = new AjaxCheckBoxPanel(
            "defaultKeymasterConfParams", "defaultKeymasterConfParams", Model.of(true), true);
    defaultKeymasterConfParams.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -6139318907146065915L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            keymasterConfParams.setVisible(
                    !BooleanUtils.toBoolean(defaultKeymasterConfParams.getField().getConvertedInput()));
            target.add(keymasterConfParams);
        }
    });
    add(defaultKeymasterConfParams);
}
 
Example #14
Source File: CalendarPageSupport.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
private void addCheckBox(final DivPanel checkBoxDivPanel, final ICalendarFilter filter, final String property, final String labelKey,
    final String tooltipKey, final boolean autoSubmit)
{
  final CheckBoxButton checkBoxButton = new CheckBoxButton(checkBoxDivPanel.newChildId(), new PropertyModel<Boolean>(filter, property),
      checkBoxDivPanel.getString(labelKey), autoSubmit);
  if (autoSubmit == false) {
    checkBoxButton.getCheckBox().add(new OnChangeAjaxBehavior() {
      @Override
      protected void onUpdate(final AjaxRequestTarget target)
      {
        // Do nothing (the model object is updated).
      }
    });
  }
  if (tooltipKey != null) {
    checkBoxButton.setTooltip(checkBoxDivPanel.getString(tooltipKey));
  }
  checkBoxDivPanel.add(checkBoxButton);
}
 
Example #15
Source File: GanttChartEditTreeTablePanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
private void addTitleColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject,
    final TaskDO task)
{
  final AjaxRequiredMaxLengthEditableLabel titleField = new AjaxRequiredMaxLengthEditableLabel("title", new PropertyModel<String>(
      ganttObject, "title"), HibernateUtils.getPropertyLength(TaskDO.class.getName(), "title"));
  titleField.setOutputMarkupId(true);
  // final RequiredMaxLengthTextField titleField = new RequiredMaxLengthTextField("title", new PropertyModel<String>(ganttObject,
  // "title"),
  // HibernateUtils.getPropertyLength(TaskDO.class.getName(), "title"));
  addColumn(item, titleField, null);
  new RejectSaveLinksFragment("rejectSaveTitle", item, titleField, task, task != null ? task.getTitle() : "") {
    @Override
    protected void onSave()
    {
      task.setTitle(ganttObject.getTitle());
      taskDao.update(task);
    }

    @Override
    protected void onReject()
    {
      ganttObject.setTitle(task.getTitle());
    }
  };
}
 
Example #16
Source File: ScriptEditForm.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
protected void addShowBackupScriptDialog()
{
  showBackupScriptDialog = new ModalDialog(parentPage.newModalDialogId()) {
    @Override
    public void init()
    {
      setTitle(getString("scripting.scriptBackup"));
      init(new Form<String>(getFormId()));
      {
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("scripting.scriptBackup")).setLabelSide(false);
        final AceEditorPanel scriptBackup = new AceEditorPanel(fs.newChildId(), new PropertyModel<String>(data, "scriptBackupAsString"));
        fs.add(scriptBackup);
      }
    }
  };
  showBackupScriptDialog.setBigWindow().setOutputMarkupId(true);
  parentPage.add(showBackupScriptDialog);
  showBackupScriptDialog.init();

}
 
Example #17
Source File: AbstractAuxClasses.java    From syncope with Apache License 2.0 5 votes vote down vote up
public <T extends AnyTO> AbstractAuxClasses(final AnyWrapper<T> modelObject, final List<String> anyTypeClasses) {
    super();
    setOutputMarkupId(true);

    List<AnyTypeClassTO> allAnyTypeClasses = listAnyTypecClasses();

    List<String> choices = new ArrayList<>();
    for (AnyTypeClassTO aux : allAnyTypeClasses) {
        if (!anyTypeClasses.contains(aux.getKey())) {
            choices.add(aux.getKey());
        }
    }
    Collections.sort(choices);
    add(new AjaxPalettePanel.Builder<String>().setAllowOrder(true).build("auxClasses",
            new PropertyModel<>(modelObject.getInnerObject(), "auxClasses"),
            new ListModel<>(choices)).hideLabel().setOutputMarkupId(true));

    // ------------------
    // insert changed label if needed
    // ------------------
    if (modelObject instanceof UserWrapper
            && UserWrapper.class.cast(modelObject).getPreviousUserTO() != null
            && !ListUtils.isEqualList(
                    modelObject.getInnerObject().getAuxClasses(),
                    UserWrapper.class.cast(modelObject).getPreviousUserTO().getAuxClasses())) {
        add(new LabelInfo("changed", StringUtils.EMPTY));
    } else {
        add(new Label("changed", StringUtils.EMPTY));
    }
    // ------------------
}
 
Example #18
Source File: NotificationWizardBuilder.java    From syncope with Apache License 2.0 5 votes vote down vote up
public Details(final NotificationWrapper modelObject) {
    NotificationTO notificationTO = modelObject.getInnerObject();
    boolean createFlag = notificationTO.getKey() == null;

    AjaxTextFieldPanel sender = new AjaxTextFieldPanel("sender", getString("sender"),
            new PropertyModel<>(notificationTO, "sender"));
    sender.addRequiredLabel();
    sender.addValidator(EmailAddressValidator.getInstance());
    add(sender);

    AjaxTextFieldPanel subject = new AjaxTextFieldPanel("subject", getString("subject"),
            new PropertyModel<>(notificationTO, "subject"));
    subject.addRequiredLabel();
    add(subject);

    AjaxDropDownChoicePanel<String> template = new AjaxDropDownChoicePanel<>(
            "template", getString("template"),
            new PropertyModel<>(notificationTO, "template"));
    template.setChoices(restClient.listTemplates().stream().
            map(EntityTO::getKey).collect(Collectors.toList()));

    template.addRequiredLabel();
    add(template);

    AjaxDropDownChoicePanel<TraceLevel> traceLevel = new AjaxDropDownChoicePanel<>(
            "traceLevel", getString("traceLevel"),
            new PropertyModel<>(notificationTO, "traceLevel"));
    traceLevel.setChoices(List.of(TraceLevel.values()));
    traceLevel.addRequiredLabel();
    add(traceLevel);

    final AjaxCheckBoxPanel isActive = new AjaxCheckBoxPanel("isActive",
            getString("isActive"), new PropertyModel<>(notificationTO, "active"));
    if (createFlag) {
        isActive.getField().setDefaultModelObject(Boolean.TRUE);
    }
    add(isActive);
}
 
Example #19
Source File: PollAttendeePage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
private TextField<String> getNewEMailField(final String wicketId)
{
  existingMailAddresses = new ArrayList<String>();
  if (model.getPollAttendeeList() != null) {
    for (final PollAttendeeDO attendee : model.getPollAttendeeList()) {
      if (attendee.getEmail() != null) {
        emailList += attendee.getEmail() + "; ";
        existingMailAddresses.add(attendee.getEmail());
      }
    }
  }
  final PropertyModel<String> mailModel = new PropertyModel<String>(this, "emailList");
  final TextField<String> eMailField = new TextField<String>(wicketId, mailModel);
  return eMailField;
}
 
Example #20
Source File: AbstractImportForm.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @return this for chaining.
 */
@SuppressWarnings("serial")
protected AbstractImportForm<F, P, S> addImportFilterRadio(final GridBuilder gridBuilder)
{
  final FieldsetPanel fs = new FieldsetPanel(gridBuilder.getPanel(), getString("filter")) {
    /**
     * @see org.apache.wicket.Component#isVisible()
     */
    @Override
    public boolean isVisible()
    {
      return storagePanel.isVisible();
    }
  };
  final DivPanel radioGroupPanel = fs.addNewRadioBoxButtonDiv();
  final RadioGroupPanel<String> radioGroup = new RadioGroupPanel<String>(radioGroupPanel.newChildId(), "filterType",
      new PropertyModel<String>(importFilter, "listType")) {
    /**
     * @see org.projectforge.web.wicket.flowlayout.RadioGroupPanel#wantOnSelectionChangedNotifications()
     */
    @Override
    protected boolean wantOnSelectionChangedNotifications()
    {
      return true;
    }
  };
  radioGroupPanel.add(radioGroup);
  fs.setLabelFor(radioGroup.getRadioGroup());
  radioGroup.add(new Model<String>("all"), getString("filter.all"));
  radioGroup.add(new Model<String>("modified"), getString("modified"));
  radioGroup.add(new Model<String>("faulty"), getString("filter.faulty"));
  return this;
}
 
Example #21
Source File: BirtManagementPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void populateItem(ListItem<BirtReportParameterDefinition> item) {
	String name = item.getModelObject().getName();
	item.add(new Label("parameterName",name));
	String defaultValue = item.getModelObject().getDefaultValue();
	Object value = reportPanel.getParameter(name);
	if (Strings.isNullOrEmpty((String) value)){
		reportPanel.setParameter(name, defaultValue);
	}
	item.add(new TextField<>("parameterInput",new PropertyModel<>(reportPanel,"config.parameters["+name+"]"))
			.add(new AjaxFormComponentUpdatingBehavior("change"){

				/**
				 * 
				 */
				private static final long serialVersionUID = 1L;

				@Override
				protected void onUpdate(AjaxRequestTarget target) {
					try {
						reportPanel.setCurrentPage(0);
						reportPanel.updateReportCache();
				        target.add(reportPanel);
				        target.add(pager);
					} catch (EngineException e) {
						String message = e.getMessage();
						error("Cannot update report cache:"+message);
						LOG.error("Can't update report cache", e);
					}
				}
				
	}));
}
 
Example #22
Source File: Command.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
/**
 * We are initializing link in onInitialize() because of some links we need to know a structure
 */
@Override
protected void onInitialize() {
	super.onInitialize();
	link = newLink("command");
    link.setOutputMarkupId(true);
    link.add(new AttributeAppender("class", new PropertyModel<String>(this, "btnCssClass"), " "));
    link.add(new Label("label", labelModel).setRenderBodyOnly(true));
    link.add(new FAIcon("icon", new PropertyModel<String>(this, "icon")));
    link.add(DISABLED_LINK_BEHAVIOR);
    add(link);
}
 
Example #23
Source File: EmployeeSalaryListForm.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.projectforge.web.wicket.AbstractListForm#onOptionsPanelCreate(org.projectforge.web.wicket.flowlayout.FieldsetPanel,
 *      org.projectforge.web.wicket.flowlayout.DivPanel)
 */
@Override
protected void onOptionsPanelCreate(final FieldsetPanel optionsFieldsetPanel, final DivPanel optionsCheckBoxesPanel)
{
  final YearListCoiceRenderer yearListChoiceRenderer = new YearListCoiceRenderer(employeeSalaryDao.getYears(), true);
  optionsFieldsetPanel.addDropDownChoice(new PropertyModel<Integer>(this, "year"), yearListChoiceRenderer.getYears(),
      yearListChoiceRenderer, true).setNullValid(false);
  // DropDownChoice months
  final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
  for (int i = 0; i <= 11; i++) {
    monthChoiceRenderer.addValue(i, StringHelper.format2DigitNumber(i + 1));
  }
  optionsFieldsetPanel.addDropDownChoice(new PropertyModel<Integer>(this, "month"), monthChoiceRenderer.getValues(), monthChoiceRenderer,
      true).setNullValid(true);
}
 
Example #24
Source File: MaxLenfthTextFieldTest.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void maxLength()
{
  PropertyModel<String> model = new PropertyModel<String>(new PFUserDO(), "username");
  assertInteger(255, MaxLengthTextField.getMaxLength(model));
  assertInteger(255, MaxLengthTextField.getMaxLength(model, 300));
  assertInteger(100, MaxLengthTextField.getMaxLength(model, 100));

  model = new PropertyModel<String>(new BaseSearchFilter(), "searchString");
  Assert.assertNull(MaxLengthTextField.getMaxLength(model));
  assertInteger(100, MaxLengthTextField.getMaxLength(model, 100));

  Assert.assertNull(MaxLengthTextField.getMaxLength(Model.of("test")));
  assertInteger(100, MaxLengthTextField.getMaxLength(Model.of("test"), 100));
}
 
Example #25
Source File: CountryModel.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
public CountryModel(final PropertyModel propertyModel, final List<Country> countryList) {
    this.propertyModel = propertyModel;
    final String singleSelectedKey = (String) propertyModel.getObject();
    if (StringUtils.isNotBlank(singleSelectedKey)) {
        for (Country c : countryList) {
            if (singleSelectedKey.equals(c.getCountryCode())) {
                country = c;
                break;
            }
        }
    }

}
 
Example #26
Source File: DomainWizardBuilder.java    From syncope with Apache License 2.0 5 votes vote down vote up
public AdminCredentials(final Domain domain) {
    AjaxDropDownChoicePanel<CipherAlgorithm> adminCipherAlgorithm = new AjaxDropDownChoicePanel<>(
            "adminCipherAlgorithm", "adminCipherAlgorithm",
            new PropertyModel<>(domain, "adminCipherAlgorithm"), false);
    adminCipherAlgorithm.setChoices(List.of(CipherAlgorithm.values()));
    adminCipherAlgorithm.addRequiredLabel();
    adminCipherAlgorithm.setNullValid(false);
    add(adminCipherAlgorithm);

    EncryptedFieldPanel adminPassword = new EncryptedFieldPanel(
            "adminPassword", "adminPassword", new PropertyModel<>(domain, "adminPassword"), false);
    adminPassword.setRequired(true);
    add(adminPassword);
}
 
Example #27
Source File: DashboardStatisticsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public DashboardStatisticsPanel(String id) {			
super(id, new StatisticsModel());
	
add(new Label("dashboardNo", new PropertyModel(getModel(), "dashboardNo")));
add(new Label("linkNo", new PropertyModel(getModel(), "linkNo")));
add(new Label("widgetNo", new PropertyModel(getModel(), "widgetNo")));
add(new Label("tableNo", new PropertyModel(getModel(), "tableNo")));
add(new Label("chartNo", new PropertyModel(getModel(), "chartNo")));
add(new Label("alarmNo", new PropertyModel(getModel(), "alarmNo")));
add(new Label("indicatorNo", new PropertyModel(getModel(), "indicatorNo")));
add(new Label("displayNo", new PropertyModel(getModel(), "displayNo")));
add(new Label("drillDownNo", new PropertyModel(getModel(), "drillDownNo")));
add(new Label("pivotNo", new PropertyModel(getModel(), "pivotNo")));
}
 
Example #28
Source File: NextRuntimePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
  public void addWicketComponents() {    	        	    	
  	
      final DropDownChoice<String> exportChoice = new DropDownChoice<String>("exportType", new PropertyModel<String>(runtimeModel, "exportType"), typeList,
      		new ChoiceRenderer<String>() {
			@Override
			public Object getDisplayValue(String name) {
				if (name.equals(ReportConstants.ETL_FORMAT)) {
					return getString("Analysis.source");
				} else {
					return name;
				}
			}
});
      exportChoice.add(new AjaxFormComponentUpdatingBehavior("onChange") {
          @Override
          protected void onUpdate(AjaxRequestTarget target) {
              String format = (String) getFormComponent().getConvertedInput();
              if (ReportConstants.ETL_FORMAT.equals(format)) {
			System.out.println("***** ETL selected");
			//analysisPanel.setVisible(true);
		} else {
			System.out.println("***** " + format);
			//analysisPanel.setVisible(false);
		}
              //target.add(analysisPanel);
          }
      });
	
      exportChoice.setRequired(true);
      add(exportChoice);
      
      if (report.isAlarmType() || report.isIndicatorType() || report.isDisplayType()) {
      	exportChoice.setEnabled(false);
      } else {
      	exportChoice.setRequired(true);
      }
      
      
  }
 
Example #29
Source File: RelationLayerTraitsEditor.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeForm(Form<RelationLayerTraits> aForm)
{
    aForm.add(new ValidationModeSelect("validationMode", getLayerModel()));
    
    OverlapModeSelect overlapMode = new OverlapModeSelect("overlapMode", getLayerModel());
    // Not configurable for layers that attach to tokens (currently that is the only layer on
    // which we use the attach feature)
    overlapMode.add(enabledWhen(() -> getLayerModelObject().getAttachFeature() == null));
    aForm.add(overlapMode);
    
    aForm.add(new ColoringRulesConfigurationPanel("coloringRules",
            getLayerModel(), getTraitsModel().bind("coloringRules.rules")));
    
    CheckBox crossSentence = new CheckBox("crossSentence");
    crossSentence.setOutputMarkupPlaceholderTag(true);
    crossSentence.setModel(PropertyModel.of(getLayerModel(), "crossSentence"));
    // Not configurable for layers that attach to tokens (currently that is the only layer on
    // which we use the attach feature)
    crossSentence.add(enabledWhen(() -> getLayerModelObject().getAttachFeature() == null));
    aForm.add(crossSentence);

    TextArea<String> onClickJavascriptAction = new TextArea<String>("onClickJavascriptAction");
    onClickJavascriptAction.setModel(PropertyModel.of(getLayerModel(), "onClickJavascriptAction"));
    onClickJavascriptAction.add(new AttributeModifier("placeholder",
            "alert($PARAM.PID + ' ' + $PARAM.PNAME + ' ' + $PARAM.DOCID + ' ' + "
                    + "$PARAM.DOCNAME + ' ' + $PARAM.fieldname);"));
    aForm.add(onClickJavascriptAction);
}
 
Example #30
Source File: FavoritesChoicePanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public FavoritesChoicePanel(final String componentId, final UserPrefArea userPrefArea, final Integer tabIndex, final String cssClass)
{
  super(componentId);
  this.userPrefArea = userPrefArea;
  this.tabIndex = tabIndex;
  this.cssClass = cssClass;
  setModel(new PropertyModel<String>(this, "dummy"));
}