Example usage for org.apache.wicket.markup.html.form CheckBox CheckBox

List of usage examples for org.apache.wicket.markup.html.form CheckBox CheckBox

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form CheckBox CheckBox.

Prototype

public CheckBox(final String id) 

Source Link

Usage

From source file:au.org.theark.admin.web.component.module.form.DetailForm.java

License:Open Source License

public void initialiseDetailForm() {
    idTxtFld = new TextField<String>("arkModule.id");
    idTxtFld.setEnabled(false);//from   w  w  w  .  j  ava  2 s .  com

    nameTxtFld = new TextField<String>("arkModule.name") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onBeforeRender() {
            super.onBeforeRender();
            setEnabled(isNew());
        }
    };

    descriptionTxtAreaFld = new TextArea<String>("arkModule.description");

    enabledChkBx = new CheckBox("arkModule.enabled");

    attachValidators();
    addDetailFormComponents();
}

From source file:au.org.theark.admin.web.component.rolePolicy.form.DetailForm.java

License:Open Source License

public void initialiseDetailForm() {
    // Role selection
    initArkRoleDropDown();//from ww w  .ja va 2  s  .  co  m

    // Module selection
    initArkModuleDropDown();

    // Function selection
    initArkFunctionDropDown();

    createChk = new CheckBox("arkCreatePermission");
    readChk = new CheckBox("arkReadPermission");
    updateChk = new CheckBox("arkUpdatePermission");
    deleteChk = new CheckBox("arkDeletePermission");

    attachValidators();
    addDetailFormComponents();
}

From source file:au.org.theark.core.web.component.customfield.form.DetailForm.java

License:Open Source License

/**
 * Call this after the constructor is finished in detail panel.
 *///from  w w w  .j  a v  a 2s . com
public void initialiseDetailForm() {
    fieldIdTxtFld = new TextField<String>(Constants.FIELDVO_CUSTOMFIELD_ID);
    fieldNameTxtFld = new TextField<String>(Constants.FIELDVO_CUSTOMFIELD_NAME);
    fieldNameTxtFld.add(new ArkDefaultFormFocusBehavior());
    fieldDescriptionTxtAreaFld = new TextArea<String>(Constants.FIELDVO_CUSTOMFIELD_DESCRIPTION);
    fieldLabelTxtAreaFld = new TextArea<String>(Constants.FIELDVO_CUSTOMFIELD_FIELD_LABEL);
    //fieldMissingValueTxtFld = new TextField<String>(Constants.FIELDVO_CUSTOMFIELD_MISSING_VALUE);
    fieldDisplayRequiredChkBox = new CheckBox(Constants.FIELDVO_CUSTOMFIELDDISPLAY_REQUIRED);
    fieldAllowMultiselectChkBox = new CheckBox(Constants.FIELDVO_CUSTOMFIELD_ALLOW_MULTISELECT) {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return (fieldEncodedValuesTxtFld.getModelObject() != null);
        }
    };

    if (getModelObject().isUseCustomFieldDisplay()) {
        // TODO: Have not implemented position support right now
        customFieldDisplayPositionPanel = new EmptyPanel("customFieldDisplayPositionPanel");
    } else {
        customFieldDisplayPositionPanel = new EmptyPanel("customFieldDisplayPositionPanel");
    }
    //customfield category order Number.
    customeFieldCategoryOrderNoTxtFld = new TextField<Long>(
            Constants.FIELDVO_CUSTOMFIELD_CUSTOEMFIELDCATEGORY_ORDERNUMBER);
    customeFieldCategoryOrderNoTxtFld.setOutputMarkupId(true);
    customeFieldCategoryOrderNoTxtFld.setEnabled(false);

    // Initialise Drop Down Choices
    initFieldTypeDdc();
    initCustomFieldTypeDdc();
    initCustomeFieldCategoryDdc();
    initUnitTypeDdc();

    // Min and Max Value panels rely on fieldTypeDdc being already established
    minMaxValueEntryWMC = new WebMarkupContainer("minMaxValueEntryWMC");
    minMaxValueEntryWMC.setOutputMarkupPlaceholderTag(true);
    missingValueEntryWMC = new WebMarkupContainer("missingValueEntryWMC");
    missingValueEntryWMC.setOutputMarkupPlaceholderTag(true);

    defaultValueEntryWMC = new WebMarkupContainer("defaultValueEntryWMC");
    defaultValueEntryWMC.setOutputMarkupPlaceholderTag(true);

    // unitType and encodedValues rely on fieldTypeDdc being already established
    fieldEncodedValuesTxtFld = new TextArea<String>(Constants.FIELDVO_CUSTOMFIELD_ENCODED_VALUES);
    fieldEncodedValuesTxtFld.setOutputMarkupId(true);
    fieldEncodedValuesTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(fieldAllowMultiselectChkBox);
        }
    });

    updateEncodedValueFld();
    updateUnitTypeDdc();

    // Have to Edit, before allowing delete
    deleteButton.setEnabled(false);

    //defaultValueTextArea = new TextArea<String>("customField.defaultValue");

    addDetailFormComponents();
    attachValidators();

    initMinMaxValuePnls();

    historyButtonPanel = new HistoryButtonPanel(this, arkCrudContainerVO.getEditButtonContainer(),
            arkCrudContainerVO.getDetailPanelFormContainer());
}

From source file:au.org.theark.core.web.component.customfieldupload.CustomFieldUploadStep3.java

License:Open Source License

private void initialiseDetailForm() {
    setValidationMessage(containerForm.getModelObject().getValidationMessagesAsString());
    addOrReplace(new MultiLineLabel("multiLineLabel", getValidationMessage()));

    add(downloadValMsgButton);//from  w  ww. j  a  v a2 s .c o m

    updateExistingDataContainer = new WebMarkupContainer("updateExistingDataContainer");
    updateExistingDataContainer.setOutputMarkupId(true);
    updateChkBox = new CheckBox("updateChkBox");
    updateChkBox.setVisible(true);

    containerForm.getModelObject().setUpdateChkBox(false);

    updateChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") {

        private static final long serialVersionUID = -4514605801401294450L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (containerForm.getModelObject().getUpdateChkBox()) {
                wizardForm.getNextButton().setEnabled(true);
            } else {
                wizardForm.getNextButton().setEnabled(false);
            }
            target.add(wizardForm.getWizardButtonContainer());
        }
    });

    updateExistingDataContainer.add(updateChkBox);
    add(updateExistingDataContainer);
}

From source file:au.org.theark.lims.web.component.biospecimenupload.BiospecimenUploadStep3.java

License:Open Source License

private void initialiseDetailForm() {
    setValidationMessage(containerForm.getModelObject().getValidationMessagesAsString());
    addOrReplace(new MultiLineLabel("multiLineLabel", getValidationMessage()));
    add(downloadValMsgButton);//from   w w w  .  j a  v  a2 s .  c  o m

    updateExistingDataContainer = new WebMarkupContainer("updateExistingDataContainer");
    updateExistingDataContainer.setOutputMarkupId(true);
    updateChkBox = new CheckBox("updateChkBox");
    updateChkBox.setVisible(true);

    updateChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") {

        private static final long serialVersionUID = -4514605801401294450L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (containerForm.getModelObject().getUpdateChkBox()) {
                wizardForm.getNextButton().setEnabled(true);
            } else {
                wizardForm.getNextButton().setEnabled(false);
            }
            target.add(wizardForm.getWizardButtonContainer());
        }
    });

    updateExistingDataContainer.add(updateChkBox);
    add(updateExistingDataContainer);
}

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

License:Open Source License

public void initialiseDetailForm() {
    idTxtFld = new TextField<String>("biospecimen.id");
    biospecimenUidTxtFld = new TextField<String>("biospecimen.biospecimenUid");
    biospecimenUidTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 1L;

        @Override// ww  w.  j av a  2  s .  c  om
        protected void onUpdate(AjaxRequestTarget target) {
            // Check BiospecimenUID is unique
            String biospecimenUid = (getComponent().getDefaultModelObject().toString() != null
                    ? getComponent().getDefaultModelObject().toString()
                    : new String());
            Biospecimen biospecimen = iLimsService.getBiospecimenByUid(biospecimenUid,
                    cpModel.getObject().getBiospecimen().getStudy());
            if (biospecimen != null && biospecimen.getId() != null) {
                error("Biospecimen UID must be unique. Please try again.");
                target.focusComponent(getComponent());
            }
            target.add(feedbackPanel);
        }
    });

    parentUidTxtFld = new TextField<String>("biospecimen.parentUid");
    commentsTxtAreaFld = new TextArea<String>("biospecimen.comments");
    sampleDateTxtFld = new DateTextField("biospecimen.sampleDate", au.org.theark.core.Constants.DD_MM_YYYY);
    useCollectionDate = new AjaxLink<Date>("useCollectionDate") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {

            BioCollection selectedBioCollection = cpModel.getObject().getBioCollection();
            cpModel.getObject().getBiospecimen().setSampleDate(selectedBioCollection.getCollectionDate());
            target.add(sampleDateTxtFld);
        }
    };

    sampleTimeTxtFld = new TimeField("biospecimen.sampleTime") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onBeforeRender() {
            this.getDateTextField().setVisibilityAllowed(false);
            super.onBeforeRender();
        }

        @Override
        protected void convertInput() {
            // Slight change to not default to today's date
            Date modelObject = (Date) getDefaultModelObject();
            getDateTextField().setConvertedInput(modelObject != null ? modelObject : null);
            super.convertInput();
        }
    };

    processedDateTxtFld = new DateTextField("biospecimen.processedDate",
            au.org.theark.core.Constants.DD_MM_YYYY);
    processedTimeTxtFld = new TimeField("biospecimen.processedTime") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onBeforeRender() {
            this.getDateTextField().setVisibilityAllowed(false);
            super.onBeforeRender();
        }

        @Override
        protected void convertInput() {
            // Slight change to not default to today's date
            Date modelObject = (Date) getDefaultModelObject();
            getDateTextField().setConvertedInput(modelObject != null ? modelObject : null);
            super.convertInput();
        }
    };

    ArkDatePicker sampleDatePicker = new ArkDatePicker();
    sampleDatePicker.bind(sampleDateTxtFld);
    sampleDateTxtFld.add(sampleDatePicker);

    ArkDatePicker processedDatePicker = new ArkDatePicker();
    processedDatePicker.bind(processedDateTxtFld);
    processedDateTxtFld.add(processedDatePicker);

    quantityTxtFld = new TextField<Double>("biospecimen.quantity") {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public <C> IConverter<C> getConverter(Class<C> type) {
            DoubleConverter doubleConverter = new DoubleConverter();
            NumberFormat numberFormat = NumberFormat.getInstance();
            numberFormat.setMinimumFractionDigits(1);
            numberFormat.setMaximumFractionDigits(10);
            doubleConverter.setNumberFormat(getLocale(), numberFormat);
            return (IConverter<C>) doubleConverter;
        }
    };
    parentQuantityTxtFld = new TextField<Double>("parentBiospecimen.quantity") {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public <C> IConverter<C> getConverter(Class<C> type) {
            DoubleConverter doubleConverter = new DoubleConverter();
            NumberFormat numberFormat = NumberFormat.getInstance();
            numberFormat.setMinimumFractionDigits(1);
            numberFormat.setMaximumFractionDigits(10);
            doubleConverter.setNumberFormat(getLocale(), numberFormat);
            return (IConverter<C>) doubleConverter;
        }
    };
    parentQuantityTxtFld.setVisible(cpModel.getObject().getBiospecimenProcessing()
            .equalsIgnoreCase(au.org.theark.lims.web.Constants.BIOSPECIMEN_PROCESSING_PROCESSING));
    parentQuantityTxtFld.setOutputMarkupId(true);

    quantityTxtFld.setEnabled(false);
    bioTransactionQuantityTxtFld = new TextField<Double>("bioTransaction.quantity") {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public <C> IConverter<C> getConverter(Class<C> type) {
            DoubleConverter doubleConverter = new DoubleConverter();
            NumberFormat numberFormat = NumberFormat.getInstance();
            numberFormat.setMinimumFractionDigits(1);
            numberFormat.setMaximumFractionDigits(10);
            doubleConverter.setNumberFormat(getLocale(), numberFormat);
            return (IConverter<C>) doubleConverter;
        }
    };
    bioTransactionQuantityTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(amountLbl);
        }
    });

    concentrationTxtFld = new TextField<Number>("biospecimen.concentration");
    concentrationTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(amountLbl);
        }
    });
    amountLbl = new Label("biospecimen.amount", new Model<Number>() {
        private static final long serialVersionUID = 1L;

        @Override
        public Number getObject() {
            Number concentration = ((concentrationTxtFld.getModelObject() == null) ? 0
                    : concentrationTxtFld.getModelObject());
            Number quantity = null;
            if (bioTransactionQuantityTxtFld.isVisible()) {
                quantity = ((bioTransactionQuantityTxtFld.getModelObject() == null) ? 0
                        : bioTransactionQuantityTxtFld.getModelObject());
            } else {
                quantity = ((quantityTxtFld.getModelObject() == null) ? 0 : quantityTxtFld.getModelObject());
            }
            Number amount = (concentration.doubleValue() * quantity.doubleValue());
            return amount;
        }
    });
    amountLbl.setOutputMarkupPlaceholderTag(true);

    setQuantityLabel();
    initSampleTypeDdc();
    initBioCollectionDdc();
    initUnitDdc();
    initTreatmentTypeDdc();
    initGradeDdc();
    initStoredInDdc();
    initAnticoagDdc();
    initStatusDdc();
    initQualityDdc();
    initBiospecimenProtocol();
    purity = new TextField<Number>("biospecimen.purity");

    barcodedChkBox = new CheckBox("biospecimen.barcoded");
    barcodedChkBox.setVisible(true);
    barcodedChkBox.setEnabled(false);

    initialiseBarcodeImage();

    initialiseBiospecimenCFDataEntry();
    initialiseBioTransactionListPanel();
    initialiseBiospecimenLocationPanel();
    initialiseBiospecimenButtonsPanel();
    initDeleteModelWindow();

    attachValidators();
    addComponents();

    // Focus on Sample Type
    sampleTypeDdc.add(new ArkDefaultFormFocusBehavior());
}

From source file:au.org.theark.phenotypic.web.component.phenodatadictionary.form.DetailForm.java

License:Open Source License

/**
 * Call this after the constructor is finished in detail panel.
 *//* w w w .ja v a 2  s . co m*/
public void initialiseDetailForm() {
    Long sessionModuleId = (Long) SecurityUtils.getSubject().getSession()
            .getAttribute(au.org.theark.core.Constants.ARK_MODULE_KEY);
    arkModule = iArkCommonService.getArkModuleById(sessionModuleId);
    fieldIdTxtFld = new TextField<String>(Constants.FIELDVO_PHENODATASET_ID);
    fieldNameTxtFld = new TextField<String>(Constants.FIELDVO_PHENODATASET_NAME);
    fieldNameTxtFld.add(new ArkDefaultFormFocusBehavior());
    fieldDescriptionTxtAreaFld = new TextArea<String>(Constants.FIELDVO_PHENODATASET_DESCRIPTION);
    fieldLabelTxtAreaFld = new TextArea<String>(Constants.FIELDVO_PHENODATASET_FIELD_LABEL);
    //fieldMissingValueTxtFld = new TextField<String>(Constants.FIELDVO_CUSTOMFIELD_MISSING_VALUE);
    fieldDisplayRequiredChkBox = new CheckBox(Constants.FIELDVO_PHENODATASET_REQUIRED);
    fieldAllowMultiselectChkBox = new CheckBox(Constants.FIELDVO_PHENODATASET_ALLOW_MULTIPLE_SELECTION) {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return (fieldEncodedValuesTxtFld.getModelObject() != null);
        }
    };

    /*if (getModelObject().isUsePhenoDataSetFieldDisplay()) {
       // TODO: Have not implemented position support right now
       phenoDataSetDisplayPositionPanel = new EmptyPanel("phenoDataSetFieldDisplayPositionPanel");
    }*/
    //   else {
    phenoDataSetDisplayPositionPanel = new EmptyPanel("phenoDataSetFieldDisplayPositionPanel");
    //}

    // Initialise Drop Down Choices
    initFieldTypeDdc();
    initUnitTypeDdc();

    // Min and Max Value panels rely on fieldTypeDdc being already established
    minMaxValueEntryWMC = new WebMarkupContainer("minMaxValueEntryWMC");
    minMaxValueEntryWMC.setOutputMarkupPlaceholderTag(true);
    missingValueEntryWMC = new WebMarkupContainer("missingValueEntryWMC");
    missingValueEntryWMC.setOutputMarkupPlaceholderTag(true);

    defaultValueEntryWMC = new WebMarkupContainer("defaultValueEntryWMC");
    defaultValueEntryWMC.setOutputMarkupPlaceholderTag(true);

    // unitType and encodedValues rely on fieldTypeDdc being already established
    fieldEncodedValuesTxtFld = new TextArea<String>(Constants.FIELDVO_PHENODATASET_ENCODED_VALUES);
    fieldEncodedValuesTxtFld.setOutputMarkupId(true);
    fieldEncodedValuesTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(fieldAllowMultiselectChkBox);
        }
    });

    updateEncodedValueFld();
    updateUnitTypeDdc();

    // Have to Edit, before allowing delete
    deleteButton.setEnabled(false);

    //defaultValueTextArea = new TextArea<String>(Constants.FIELDVO_PHENODATASET_DEFAULT_VALUE);

    addDetailFormComponents();
    attachValidators();

    initMinMaxValuePnls();

    historyButtonPanel = new HistoryButtonPanel(this, arkCrudContainerVO.getEditButtonContainer(),
            arkCrudContainerVO.getDetailPanelFormContainer());
}

From source file:au.org.theark.phenotypic.web.component.phenodataupload.PhenoDataUploadStep1.java

License:Open Source License

public void initialiseDetailForm() {
    fileUploadField = new FileUploadField(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FILENAME);
    phenoCollectionDescription = new TextField<String>(
            au.org.theark.phenotypic.web.Constants.PHENOCOLLECTION_DESCRIPTION);
    initialiseDropDownChoices();/*from ww  w  .j av  a  2 s . c o  m*/
    initQuestionnaireDdc();
    initTemplatePanel();
    initDownloadButton(PHENO_TEMPLATE_CELLS, "");
    overwriteExistingCheckBox = new CheckBox("updateChkBox");
    attachValidators();
    addComponents();
}

From source file:au.org.theark.phenotypic.web.component.phenofielduploader.PhenoDataSetCategoryFieldUploadStep3.java

License:Open Source License

private void initialiseDetailForm() {
    setValidationMessage(containerForm.getModelObject().getValidationMessagesAsString());
    addOrReplace(new MultiLineLabel("multiLineLabel", getValidationMessage()));
    add(downloadValMsgButton);/*from  w  w  w  .java2s.c o  m*/
    updateExistingDataContainer = new WebMarkupContainer("updateExistingDataContainer");
    updateExistingDataContainer.setOutputMarkupId(true);
    updateChkBox = new CheckBox("updateChkBox");
    updateChkBox.setVisible(true);
    containerForm.getModelObject().setUpdateChkBox(false);
    updateChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") {
        private static final long serialVersionUID = -4514605801401294450L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (containerForm.getModelObject().getUpdateChkBox()) {
                wizardForm.getNextButton().setEnabled(true);
            } else {
                wizardForm.getNextButton().setEnabled(false);
            }
            target.add(wizardForm.getWizardButtonContainer());
        }
    });
    updateExistingDataContainer.add(updateChkBox);
    add(updateExistingDataContainer);
}

From source file:au.org.theark.report.web.component.dataextraction.form.DetailForm.java

License:Open Source License

private void initIncludeGeno() {
    includeGenoChkBox = new CheckBox(Constants.SEARCH_INCLUDE_GENO);
    includeGenoChkBox.setVisible(false);
}