@Override public void onBeforeRender() { final ReportStorage reportStorage = parentPage.getReportStorage(); final Report currentReport = reportStorage != null ? reportStorage.getCurrentReport() : null; final String reportPathHeading = getReportPath(currentReport); if (reportPathHeading != null) { reportPathPanel.setVisible(true); } else { reportPathPanel.setVisible(false); } super.onBeforeRender(); }
@Override @SuppressWarnings("serial") protected void init() { super.init(); gridBuilder.newGridPanel(); reportPathPanel = gridBuilder.getPanel(); reportPathPanel.add( new Heading1Panel( reportPathPanel.newChildId(), new Model<String>() { /** @see org.apache.wicket.model.Model#getObject() */ @Override public String getObject() { return reportPathHeading; } })); gridBuilder.newGridPanel(); { final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xsl, *.jrxml"); fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID); fs.add( new DivTextPanel( fs.newChildId(), new Model<String>() { @Override public String getObject() { final ReportScriptingStorage storage = getReportScriptingStorage(); return storage != null ? storage.getLastAddedFilename() : ""; } })); fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField)); final Button uploadButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("upload")) { @Override public final void onSubmit() { parentPage.upload(); } }; fs.add( new SingleButtonPanel( fs.newChildId(), uploadButton, getString("upload"), SingleButtonPanel.NORMAL)); } { final FieldsetPanel fs = gridBuilder.newFieldset(getString("label.groovyScript")); final AceEditorPanel textArea = new AceEditorPanel(fs.newChildId(), new PropertyModel<String>(this, "groovyScript")); fs.add(textArea); } { final FieldsetPanel fs = gridBuilder.newFieldset(getString("label.groovy.result")).suppressLabelForWarning(); final DivTextPanel groovyResultPanel = new DivTextPanel( fs.newChildId(), new Model<String>() { /** @see org.apache.wicket.model.Model#getObject() */ @Override public String getObject() { final GroovyResult groovyResult = parentPage.groovyResult; final StringBuffer buf = new StringBuffer(); buf.append(groovyResult.getResultAsHtmlString()); if (groovyResult.getResult() != null && StringUtils.isNotEmpty(groovyResult.getOutput()) == true) { buf.append("<br/>\n"); buf.append(HtmlHelper.escapeXml(groovyResult.getOutput())); } return buf.toString(); } }) { /** @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { final GroovyResult groovyResult = parentPage.groovyResult; return (groovyResult != null && groovyResult.hasResult() == true); } }; groovyResultPanel.getLabel().setEscapeModelStrings(false); fs.add(groovyResultPanel); } { final Button executeButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("execute")) { @Override public final void onSubmit() { parentPage.execute(); } }; final SingleButtonPanel executeButtonPanel = new SingleButtonPanel( actionButtons.newChildId(), executeButton, getString("execute"), SingleButtonPanel.DEFAULT_SUBMIT); actionButtons.add(executeButtonPanel); setDefaultButton(executeButton); } }
@Override @SuppressWarnings("serial") protected void init() { super.init(); gridBuilder.newSplitPanel(GridSize.COL50); gridBuilder.newFormHeading(getString("system.admin.group.title.alertMessage")); { final FieldsetPanel fs = gridBuilder.newFieldset(getString("system.admin.group.title.alertMessage")); alertMessage = WicketApplication.getAlertMessage(); fs.add( new MaxLengthTextArea( TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "alertMessage"), 1000)) .setAutogrow(); } { final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning(); fs.add( new MyButtonPanel(fs.newChildId(), "setAlertMessage") { @Override public void onSubmit() { parentPage.setAlertMessage(); } }.getButtonPanel()); fs.add( new MyButtonPanel(fs.newChildId(), "clearAlertMessage") { @Override public void onSubmit() { parentPage.clearAlertMessage(); } /** @see org.projectforge.web.admin.AdminForm.MyButtonPanel#isVisible() */ @Override public boolean isVisible() { return StringUtils.isNotBlank(alertMessage); } }.getButtonPanel()); } { final FieldsetPanel fs = gridBuilder .newFieldset(getString("system.admin.alertMessage.copyAndPaste.title")) .suppressLabelForWarning(); fs.add( new DivTextPanel( fs.newChildId(), PFUserContext.getLocalizedMessage( "system.admin.alertMessage.copyAndPaste.text", AppVersion.NUMBER))); } gridBuilder.newSplitPanel(GridSize.COL50); { final FieldsetPanel fs = gridBuilder.newFieldset( getString("system.admin.reindex.newestEntries"), getString("system.admin.reindex.newestEntries.subtitle")); fs.add( new MinMaxNumberField<Integer>( InputPanel.WICKET_ID, new PropertyModel<Integer>(this, "reindexNewestNEntries"), 0, Integer.MAX_VALUE)); fs.addHelpIcon(getString("system.admin.reindex.newestEntries.tooltip")); } { final FieldsetPanel fs = gridBuilder.newFieldset(getString("system.admin.reindex.fromDate")); final DatePanel datePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(this, "reindexFromDate")); fs.add(datePanel); fs.addHelpIcon( new Model<String>() { @Override public String getObject() { return getString("system.admin.reindex.fromDate.tooltip") + (reindexFromDate != null ? " (" + DateHelper.formatAsUTC(reindexFromDate) + ")" : ""); } }); fs.add( new MyButtonPanel(fs.newChildId(), "reindex") { @Override public void onSubmit() { parentPage.reindex(); } }.getButtonPanel()); } gridBuilder.newGridPanel(); { final FieldsetPanel fs = gridBuilder.newFieldset(getString("system.admin.group.title.misc.logEntries")); final MaxLengthTextArea logEntries = new MaxLengthTextArea( TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "logEntries"), 10000); logEntries.add(AttributeModifier.append("style", "width: 100%; height: 20em;")); fs.add(logEntries); fs.addHelpIcon(getString("system.admin.button.formatLogEntries.textarea.tooltip")); } { final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning(); fs.add( new MyButtonPanel(fs.newChildId(), "formatLogEntries") { @Override public void onSubmit() { parentPage.formatLogEntries(); } }.getButtonPanel()); } gridBuilder.newGridPanel(); final DivPanel section = gridBuilder.getPanel(); final DivTextPanel logMessages = new DivTextPanel( section.newChildId(), new Model<String>() { @Override public String getObject() { return formattedLogEntries; } }); logMessages.getLabel().setEscapeModelStrings(false); section.add(logMessages); }