List of usage examples for org.apache.wicket.markup.html.panel EmptyPanel EmptyPanel
public EmptyPanel(String id)
From source file:au.org.theark.core.web.component.AbstractDetailModalWindow.java
License:Open Source License
public AbstractDetailModalWindow(String id) { super(id);/*from ww w.ja va 2 s . c om*/ this.title = ""; this.panel = new EmptyPanel("content"); initialise(); initialiseContentPanel(panel); }
From source file:au.org.theark.core.web.component.button.EditModeButtonsPanel.java
License:Open Source License
protected void initialisePanel() { saveButton = new ArkAjaxButton("save") { private static final long serialVersionUID = 1L; @Override/*from ww w. ja va 2s . c o m*/ public boolean isVisible() { // Ark-Security implemented return super.isVisible() && ArkPermissionHelper.isActionPermitted(Constants.SAVE); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // Make sure the button is visible and enabled before allowing it to proceed if (saveButton.isVisible() && saveButton.isEnabled()) { eventHandler.onEditSave(target, form); } else { log.error("Illegal Save button submit: button is not enabled and/or not visible."); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { if (!saveButton.isVisible() || !saveButton.isEnabled()) { log.error("Illegal onError for Save button submit: button is not enabled and/or not visible."); } eventHandler.onEditSaveError(target, form); } }; this.add(saveButton); cancelButton = new ArkAjaxButton("cancel") { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // Make sure the button is visible and enabled before allowing it to proceed if (cancelButton.isVisible() && cancelButton.isEnabled()) { eventHandler.onEditCancel(target, form); } else { log.error("Illegal Cancel button submit: button is not enabled and/or not visible."); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { if (!cancelButton.isVisible() || !cancelButton.isEnabled()) { log.error( "Illegal onError for Cancel button submit: button is not enabled and/or not visible."); } eventHandler.onEditCancelError(target, form); } }; cancelButton.setDefaultFormProcessing(false); this.add(cancelButton); deleteButton = new AjaxDeleteButton(Constants.DELETE, new StringResourceModel("confirmDelete", this, null), new StringResourceModel(Constants.DELETE, this, null)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (deleteButton.isVisible() && deleteButton.isEnabled()) { eventHandler.onEditDelete(target, form); } else { log.error("Illegal Delete button submit: button is not enabled and/or not visible."); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { if (!deleteButton.isVisible() || !deleteButton.isEnabled()) { log.error( "Illegal onError for Delete button submit: button is not enabled and/or not visible."); } eventHandler.onEditDeleteError(target, form); } }; deleteButton.setDefaultFormProcessing(false); this.add(deleteButton); historyButtonPanel = new EmptyPanel("history"); this.addOrReplace(historyButtonPanel); }
From source file:au.org.theark.core.web.component.customfield.CustomFieldContainerPanel.java
License:Open Source License
protected WebMarkupContainer initialiseDetailPanel() { Panel detailPanel = new EmptyPanel("detailPanel"); detailPanel.setOutputMarkupPlaceholderTag(true); // ensure this is // replaceable arkCrudContainerVO.getDetailPanelContainer().add(detailPanel); return arkCrudContainerVO.getDetailPanelContainer(); }
From source file:au.org.theark.core.web.component.customfield.dataentry.CustomDataEditorDataView.java
License:Open Source License
@Override protected void populateItem(Item<T> item) { ICustomFieldData aCustomData = item.getModelObject(); CustomField cf = aCustomData.getCustomFieldDisplay().getCustomField(); CustomFieldDisplay cfd = aCustomData.getCustomFieldDisplay(); // Determine label of component, also used for error messages String labelModel = new String(); if (cf.getFieldLabel() != null) { labelModel = cf.getFieldLabel(); } else {/* ww w .j a va2s. c om*/ // Defaults to name if no fieldLabel labelModel = cf.getName(); } Label fieldLabelLbl = new Label("fieldLabel", labelModel); Panel dataValueEntryPanel; String fieldTypeName = cf.getFieldType().getName(); String encodedValues = cf.getEncodedValues(); Boolean requiredField = aCustomData.getCustomFieldDisplay().getRequired(); if (fieldTypeName.equals(au.org.theark.core.web.component.customfield.Constants.DATE_FIELD_TYPE_NAME)) { if (cf.getDefaultValue() != null && item.getModelObject().getDateDataValue() == null) { try { item.getModelObject().setDateDataValue( new SimpleDateFormat(Constants.DD_MM_YYYY).parse(cf.getDefaultValue())); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } DateDataEntryPanel dateDataEntryPanel = new DateDataEntryPanel("dataValueEntryPanel", new PropertyModel<Date>(item.getModel(), "dateDataValue"), new Model<String>(labelModel)); dateDataEntryPanel.setErrorDataValueModel(new PropertyModel<String>(item.getModel(), "errorDataValue")); dateDataEntryPanel.setUnitsLabelModel( new PropertyModel<String>(item.getModel(), "customFieldDisplay.customField.unitType.name")); if (cf.getMinValue() != null && !cf.getMinValue().isEmpty()) { IConverter<Date> dateConverter = dateDataEntryPanel.getDateConverter(); try { Date minDate = (Date) dateConverter.convertToObject(cf.getMinValue(), getLocale()); dateDataEntryPanel.addValidator(DateValidator.minimum(minDate, Constants.DD_MM_YYYY)); } catch (ConversionException ce) { // This should not occur because it means the data is corrupted on the backend database getLog().error("Unexpected error: customfield.minValue is not in the DD/MM/YYYY date format"); this.error( "An unexpected error occurred loading the field validators from database. Please contact your System Administrator."); getParentContainer().setEnabled(false); } } if (cf.getMaxValue() != null && !cf.getMaxValue().isEmpty()) { IConverter<Date> dateConverter = dateDataEntryPanel.getDateConverter(); try { Date maxDate = (Date) dateConverter.convertToObject(cf.getMaxValue(), getLocale()); dateDataEntryPanel.addValidator(DateValidator.maximum(maxDate, Constants.DD_MM_YYYY)); } catch (ConversionException ce) { // This should not occur because it means the data is corrupted on the backend database getLog().error("Unexpected error: customfield.maxValue is not in the DD/MM/YYYY date format"); this.error( "An unexpected error occurred loading the field validators from database. Please contact your System Administrator."); getParentContainer().setEnabled(false); } } if (requiredField != null && requiredField == true) { dateDataEntryPanel.setRequired(true); } dataValueEntryPanel = dateDataEntryPanel; } else {//ie if its not a date... if (encodedValues != null && !encodedValues.isEmpty()) { // The presence of encodedValues means it should be a DropDownChoice List<String> encodeKeyValueList = Arrays.asList(encodedValues.split(";")); ArrayList<EncodedValueVO> choiceList = new ArrayList<EncodedValueVO>(); for (String keyValue : encodeKeyValueList) { // Only split for the first instance of the '=' (allows the '=' character in the actual value) String[] keyValueArray = keyValue.split("=", 2); EncodedValueVO encodedValueVo = new EncodedValueVO(); encodedValueVo.setKey(keyValueArray[0]); encodedValueVo.setValue(keyValueArray[1]); choiceList.add(encodedValueVo); } ChoiceRenderer<EncodedValueVO> choiceRenderer = new ChoiceRenderer<EncodedValueVO>("value", "key"); if (cfd.getAllowMultiselect()) { CheckGroupDataEntryPanel cgdePanel = new CheckGroupDataEntryPanel("dataValueEntryPanel", new PropertyModel<String>(item.getModel(), "textDataValue"), new Model<String>(labelModel), choiceList, choiceRenderer); cgdePanel.setErrorDataValueModel(new PropertyModel<String>(item.getModel(), "errorDataValue")); cgdePanel.setUnitsLabelModel(new PropertyModel<String>(item.getModel(), "customFieldDisplay.customField.unitType.name")); if (cf.getMissingValue() != null && !cf.getMissingValue().isEmpty()) { cgdePanel.setMissingValue(cf.getMissingValue()); } if (requiredField != null && requiredField == true) { cgdePanel.setRequired(true); } dataValueEntryPanel = cgdePanel; } else { if (cf.getDefaultValue() != null && item.getModelObject().getTextDataValue() == null) { item.getModelObject().setTextDataValue(cf.getDefaultValue()); } DropDownChoiceDataEntryPanel ddcPanel = new DropDownChoiceDataEntryPanel("dataValueEntryPanel", new PropertyModel<String>(item.getModel(), "textDataValue"), new Model<String>(labelModel), choiceList, choiceRenderer); ddcPanel.setErrorDataValueModel(new PropertyModel<String>(item.getModel(), "errorDataValue")); ddcPanel.setUnitsLabelModel(new PropertyModel<String>(item.getModel(), "customFieldDisplay.customField.unitType.name")); if (cf.getMissingValue() != null && !cf.getMissingValue().isEmpty()) { ddcPanel.setMissingValue(cf.getMissingValue()); } if (requiredField != null && requiredField == true) { ddcPanel.setRequired(true); } dataValueEntryPanel = ddcPanel; } } else { if (fieldTypeName .equals(au.org.theark.core.web.component.customfield.Constants.CHARACTER_FIELD_TYPE_NAME)) { // Text data if (cf.getDefaultValue() != null && item.getModelObject().getTextDataValue() == null) { item.getModelObject().setTextDataValue(cf.getDefaultValue()); } TextDataEntryPanel textDataEntryPanel = new TextDataEntryPanel("dataValueEntryPanel", new PropertyModel<String>(item.getModel(), "textDataValue"), new Model<String>(labelModel)); textDataEntryPanel .setErrorDataValueModel(new PropertyModel<String>(item.getModel(), "errorDataValue")); textDataEntryPanel.setUnitsLabelModel(new PropertyModel<String>(item.getModel(), "customFieldDisplay.customField.unitType.name")); textDataEntryPanel.setTextFieldSize(60); if (requiredField != null && requiredField == true) { textDataEntryPanel.setRequired(true); } dataValueEntryPanel = textDataEntryPanel; } else if (fieldTypeName .equals(au.org.theark.core.web.component.customfield.Constants.NUMBER_FIELD_TYPE_NAME)) { // Number data if (cf.getDefaultValue() != null && item.getModelObject().getNumberDataValue() == null) { item.getModelObject().setNumberDataValue(Double.parseDouble(cf.getDefaultValue())); ; } NumberDataEntryPanel numberDataEntryPanel = new NumberDataEntryPanel("dataValueEntryPanel", new PropertyModel<Double>(item.getModel(), "numberDataValue"), new Model<String>(labelModel)); numberDataEntryPanel .setErrorDataValueModel(new PropertyModel<String>(item.getModel(), "errorDataValue")); numberDataEntryPanel.setUnitsLabelModel(new PropertyModel<String>(item.getModel(), "customFieldDisplay.customField.unitType.name")); if (cf.getMinValue() != null && !cf.getMinValue().isEmpty()) { IConverter<Double> doubleConverter = numberDataEntryPanel.getNumberConverter(); try { Double minNumber = (Double) doubleConverter.convertToObject(cf.getMinValue(), getLocale()); numberDataEntryPanel.addValidator(new MinimumValidator<Double>(minNumber)); } catch (ConversionException ce) { // This should not occur because it means the data is corrupted on the backend database getLog().error( "Unexpected error: customfield.maxValue is not in a valid number format"); this.error( "An unexpected error occurred loading the field validators from database. Please contact your System Administrator."); getParentContainer().setEnabled(false); } } if (cf.getMaxValue() != null && !cf.getMaxValue().isEmpty()) { IConverter<Double> doubleConverter = numberDataEntryPanel.getNumberConverter(); try { Double maxNumber = (Double) doubleConverter.convertToObject(cf.getMaxValue(), getLocale()); numberDataEntryPanel.addValidator(new MaximumValidator<Double>(maxNumber)); } catch (ConversionException ce) { // This should not occur because it means the data is corrupted on the backend database getLog().error( "Unexpected error: customfield.maxValue is not in a valid number format"); this.error( "An unexpected error occurred loading the field validators from database. Please contact your System Administrator."); getParentContainer().setEnabled(false); } } if (requiredField != null && requiredField == true) { numberDataEntryPanel.setRequired(true); } dataValueEntryPanel = numberDataEntryPanel; } else { // TODO: Unknown type should display an UnsupportedValueEntryPanel dataValueEntryPanel = new EmptyPanel("dataValueEntryPanel"); } } } item.add(fieldLabelLbl); item.add(dataValueEntryPanel); }
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. */// w w w . ja v a2s.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.customfieldcategory.CustomFieldCategoryContainerPanel.java
License:Open Source License
protected WebMarkupContainer initialiseDetailPanel() { Panel detailPanel = new EmptyPanel("detailPanel"); detailPanel.setOutputMarkupPlaceholderTag(true); // ensure this is replaceable arkCrudContainerVO.getDetailPanelContainer().add(detailPanel); return arkCrudContainerVO.getDetailPanelContainer(); }
From source file:au.org.theark.core.web.component.customfieldupload.CustomFieldUploadContainerPanel.java
License:Open Source License
@Override protected WebMarkupContainer initialiseDetailPanel() { detailPanel = new EmptyPanel("detailPanel"); arkCrudContainerVO.getDetailPanelContainer().add(detailPanel); return arkCrudContainerVO.getDetailPanelContainer(); }
From source file:au.org.theark.core.web.component.tabbedPanel.DynamicTabbedPanel.java
License:Open Source License
/** * sets the selected tab/*from www. ja v a 2 s. c o m*/ * * @param index * index of the tab to select * @return this for chaining */ public DynamicTabbedPanel setSelectedTab(final int index) { if ((index < 0) || ((index >= tabModel.getObject().size()) && (index > 0))) { throw new IndexOutOfBoundsException(); } setDefaultModelObject(index); final Component component; if ((tabModel.getObject().size() == 0) || !isTabVisible(index)) { // no tabs or the currently selected tab is not visible component = new EmptyPanel(TAB_PANEL_ID); } else { // show panel from selected tab ITab tab = tabModel.getObject().get(index); component = tab.getPanel(TAB_PANEL_ID); if (component == null) { throw new WicketRuntimeException("ITab.getPanel() returned null. TabbedPanel [" + getPath() + "] ITab index [" + index + "]"); } } if (!component.getId().equals(TAB_PANEL_ID)) { throw new WicketRuntimeException("ITab.getPanel() returned a panel with invalid id [" + component.getId() + "]. You must always return a panel with id equal to the provided panelId parameter. TabbedPanel [" + getPath() + "] ITab index [" + index + "]"); } addOrReplace(component); return this; }
From source file:au.org.theark.lims.web.component.barcodelabel.form.DetailForm.java
License:Open Source License
public void initialiseDetailForm() { idTxtFld = new TextField<Long>("id"); nameTxtFld = new TextField<String>("name"); nameTxtFld.setEnabled(false);//from ww w . j a v a2s .c o m descriptionTxtArea = new TextArea<String>("description"); versionTxtFld = new TextField<Number>("version"); barcodeLabelTemplateLbl = new Label("barcodeLabelTemplateLbl", "Clone from Barcode Label Template:") { private static final long serialVersionUID = 1L; @Override protected void onBeforeRender() { super.onBeforeRender(); this.setVisible(isNew()); } }; initStudyDdc(); initBarcodeLabelTemplateDdc(); barcodeLabelDataPanel = new EmptyPanel("barcodeLabelDataPanel"); exampleBarcodeDataFile = new TextArea<String>("exampleBarcodeDataFile", new Model<String>("")); exampleBarcodeDataFile.setEnabled(false); exampleBarcodeDataFile.setVisible(isNew()); addDetailFormComponents(); attachValidators(); }
From source file:au.org.theark.lims.web.component.biocollectioncustomdata.BioCollectionCustomDataContainerPanel.java
License:Open Source License
protected WebMarkupContainer initialiseCustomDataEditorWMC() { customDataEditorWMC = new WebMarkupContainer("customDataEditorWMC"); Panel dataEditorPanel;/*from w w w . j a va 2s . c om*/ boolean contextLoaded = prerenderContextCheck(); if (contextLoaded && isActionPermitted()) { dataEditorPanel = new BioCollectionCustomDataEditorPanel("customDataEditorPanel", cpModel, feedbackPanel).initialisePanel(); } else if (!contextLoaded) { dataEditorPanel = new EmptyPanel("customDataEditorPanel"); this.error("A study and LIMS collection in context are required to proceed."); } else { dataEditorPanel = new EmptyPanel("customDataEditorPanel"); this.error("You do not have sufficient permissions to access this function"); } customDataEditorWMC.add(dataEditorPanel); return customDataEditorWMC; }