Example usage for org.apache.wicket.model IModel getObject

List of usage examples for org.apache.wicket.model IModel getObject

Introduction

In this page you can find the example usage for org.apache.wicket.model IModel getObject.

Prototype

T getObject();

Source Link

Document

Gets the model object.

Usage

From source file:abid.password.wicket.fields.PasswordTypeField.java

License:Apache License

public PasswordTypeField(String id, IModel<String> model, IModel<PasswordType> selectedChoiceModel) {
    super(id, model);

    PasswordType selectedChoice = selectedChoiceModel.getObject();
    switch (selectedChoice) {
    case EXTENDED:
        selectedForm = new ExtendedPasswordField("group");
        break;//from w w  w  .j  av  a  2  s . c o  m
    case SHIFT:
        selectedForm = new CaesarCipherPasswordField("group");
        break;
    case TIME_LOCK:
        selectedForm = new TimeLockPasswordField("group");
        break;
    case EXTENDED_TIME_LOCK:
        selectedForm = new ExtendedTimeLockPasswordField("group");
        break;
    default:
        selectedForm = new SimplePasswordField("group");
        break;
    }

    add(selectedForm);
}

From source file:at.ac.tuwien.ifs.tita.ui.uihelper.DateTextFieldRenderer.java

License:Apache License

/**
 * {@inheritDoc}//www  .j a v  a  2 s.  c om
 */
@SuppressWarnings("unchecked")
@Override
public Component getRenderComponent(String id, IModel model, SelectableListItem parent, int row, int column) {
    IModel<String> newModel = model;
    newModel.setObject(GlobalUtils.DATEFORMAT.format(model.getObject()));
    return new Label(id, newModel);
}

From source file:au.org.emii.geoserver.extensions.filters.LayerFilterForm.java

License:Open Source License

public LayerFilterForm(final String id, IModel<FilterConfiguration> model) {
    super(id, model);

    add(new ListView<Filter>("layerDataProperties", model.getObject().getFilters()) {
        public void populateItem(final ListItem<Filter> item) {
            final Filter filter = item.getModelObject();
            item.add(new CheckBox("propertyEnabled", new PropertyModel<Boolean>(filter, "enabled")));
            item.add(new Label("propertyName", filter.getName()));
            item.add(new TextField<String>("propertyType", new Model<String>() {
                @Override/* ww  w  . j av  a2  s.  c  o  m*/
                public String getObject() {
                    return filter.getType();
                }

                @Override
                public void setObject(final String value) {
                    filter.setType(value);
                }
            }));
            item.add(new TextField<String>("propertyLabel", new Model<String>() {
                @Override
                public String getObject() {
                    return filter.getLabel();
                }

                @Override
                public void setObject(final String value) {
                    filter.setLabel(value);
                }
            }));
            item.add(new CheckBox("propertyWmsFilter", new Model<Boolean>() {
                @Override
                public Boolean getObject() {
                    return new Boolean(!filter.getVisualised().booleanValue());
                }

                @Override
                public void setObject(Boolean value) {
                    filter.setVisualised(new Boolean(!value.booleanValue()));
                }
            }));
            item.add(new CheckBox("propertyWfsExcluded",
                    new PropertyModel<Boolean>(filter, "excludedFromDownload")));
        }
    });

    add(saveLink());
    add(cancelLink());
}

From source file:au.org.theark.arkcalendar.component.dataentry.AbstractDataEntryPanel.java

License:Open Source License

/**
 * Sets the model on the errorValueLbl/*from   ww  w  .  j  ava  2s  .  c  om*/
 * @param errorDataStringModel
 */
public void setErrorDataValueModel(IModel<String> errorDataStringModel) {
    if (errorDataStringModel != null && errorDataStringModel.getObject() != null
            && !errorDataStringModel.getObject().isEmpty()) {
        errorDataLabelModel = new StringResourceModel(getValidationErrorResourceKey(), this,
                errorDataStringModel);
    } else {
        errorDataLabelModel = new Model<String>("");
    }
    errorValueLbl.setDefaultModel(errorDataLabelModel);
}

From source file:au.org.theark.core.web.component.customfield.dataentry.AbstractDataEntryPanel.java

License:Open Source License

/**
 * Sets the model on the errorValueLbl/*from  w w w  . j  av  a  2 s  .com*/
 * @param errorDataStringModel
 */
public void setErrorDataValueModel(IModel<String> errorDataStringModel) {
    if (errorDataStringModel != null && errorDataStringModel.getObject() != null
            && !errorDataStringModel.getObject().isEmpty()) {
        errorDataLabelModel = new StringResourceModel(getValidationErrorResourceKey(), this, null,
                new Object[] { errorDataStringModel.getObject() });
    } else {
        errorDataLabelModel = new Model<String>("");
    }
    errorValueLbl.setDefaultModel(errorDataLabelModel);
}

From source file:au.org.theark.core.web.component.tabbedPanel.DynamicTabbedPanel.java

License:Open Source License

public DynamicTabbedPanel(final String id, final IModel<List<ITab>> tabModel) {
    super(id, new Model<Integer>(-1));
    this.tabModel = tabModel;

    final IModel<Integer> tabCount = new AbstractReadOnlyModel<Integer>() {
        private static final long serialVersionUID = 1L;

        @Override/*ww  w.  j a  va2 s  .co  m*/
        public Integer getObject() {
            return tabModel.getObject().size();
        }
    };

    WebMarkupContainer tabsContainer = newTabsContainer("tabs-container");
    add(tabsContainer);

    // add the loop used to generate tab names
    tabsContainer.add(new Loop("tabs", tabCount) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final LoopItem item) {
            final int index = item.getIndex();
            final ITab tab = tabModel.getObject().get(index);

            final WebMarkupContainer titleLink = newLink("link", index);

            titleLink.add(newTitle("title", tab.getTitle(), index));
            item.add(titleLink);
        }

        @Override
        protected LoopItem newItem(final int iteration) {
            return newTabContainer(iteration);
        }

        public boolean isVisible() {
            return tabCount.getObject() > 0;
        }
    });
}

From source file:au.org.theark.lims.util.barcode.DataMatrixBarcodeImage.java

License:Open Source License

/**
 * Create a new DataMatrixBarcode of the specified barcodeString
 * //from   w w w.j  ava  2  s.c om
 * @param id
 * @param barcodeString
 */
public DataMatrixBarcodeImage(String id, final IModel<String> barcodeStringModel) {
    super(id);
    setOutputMarkupPlaceholderTag(true);
    setImageResource(getDataMatrixBarcodeImageResource(barcodeStringModel));
    setVisible(!barcodeStringModel.getObject().isEmpty());
}

From source file:au.org.theark.lims.util.barcode.DataMatrixBarcodeImage.java

License:Open Source License

/**
 * @return Gets shared image component//from  w  ww .  j  a  v  a 2s .c  o m
 */
public static DynamicImageResource getDataMatrixBarcodeImageResource(final IModel<String> barcodeStringModel) {
    return new DynamicImageResource() {

        private static final long serialVersionUID = 1L;

        @Override
        protected byte[] getImageData(Attributes attributes) {
            String barcodeString = barcodeStringModel.getObject();
            final BufferedImage image = generateBufferedImage(barcodeString);
            return toImageData(image);
        }
    };
}

From source file:au.org.theark.lims.web.component.biospecimen.form.BiospecimenListForm.java

License:Open Source License

private void onBatchAliquot(AjaxRequestTarget target, IModel<Biospecimen> iModel) {
    IModel model = new Model<BatchBiospecimenAliquotsVO>(new BatchBiospecimenAliquotsVO(iModel.getObject()));
    // handles for auto-gen biospecimenUid or manual entry
    modalContentPanel = new BatchAliquotBiospecimenPanel("content", feedbackPanel, model, modalWindow);

    // Set the modalWindow title and content
    modalWindow.setTitle("Batch Aliquot Biospecimens");
    modalWindow.setContent(modalContentPanel);
    modalWindow.show(target);//from w  w  w .j  a  v a2s  .c o  m
    // refresh the feedback messages
    target.add(feedbackPanel);
}

From source file:au.org.theark.lims.web.component.button.brady.biospecimen.PrintBiospecimenStrawLabelButton.java

License:Open Source License

/**
 * Construct an ajax button to send the specified barcodeString to a Brady BPP 11 printer<br>
 * <b>NOTE:</b> Assumes there is an applet on the page with the name "jZebra"
 * //from  w ww .  j a v a2s  .c o  m
 * @param id
 * @param iModel
 *           the Biospecimen model
 * @param numberModel
 *           the model defining the number of barcodes to print
 */
public PrintBiospecimenStrawLabelButton(String id, final IModel<?> iModel, final IModel<?> numberModel) {
    super(id);
    setOutputMarkupPlaceholderTag(true);
    this.biospecimen = (Biospecimen) iModel.getObject();
    this.numberModel = numberModel;
    this.barcodesToPrint = (Number) numberModel.getObject();

    barcodeLabel = new BarcodeLabel();
    barcodeLabel.setStudy(biospecimen.getStudy());
    barcodeLabel.setName("straw barcode");
    barcodeLabel = iLimsAdminService.searchBarcodeLabel(barcodeLabel);
}