use of org.projectforge.web.wicket.flowlayout.FileUploadPanel in project projectforge by micromata.
the class EmployeeBillingImportForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
gridBuilder.newGridPanel();
// Date DropDowns
final FieldsetPanel fsMonthYear = gridBuilder.newFieldset(I18nHelper.getLocalizedMessage("plugins.eed.listcare.yearmonth"));
dropDownMonth = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedMonth"), EEDHelper.MONTH_INTEGERS));
fsMonthYear.add(dropDownMonth);
dropDownYear = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedYear"), eedHelper.getDropDownYears()));
fsMonthYear.add(dropDownYear);
// upload buttons
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xls");
fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID) {
@Override
public final void onSubmit() {
final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0).getTime();
storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
final boolean success = parentPage.doImport(dateToSelectAttrRow);
if (success) {
setDateDropDownsEnabled(false);
}
}
}, getString("upload"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
addClearButton(fs);
}
addImportFilterRadio(gridBuilder);
// preview of the imported data
gridBuilder.newGridPanel();
final DivPanel panel = gridBuilder.getPanel();
storagePanel = new EmployeeBillingImportStoragePanel(panel.newChildId(), parentPage, importFilter);
final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0).getTime();
storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
panel.add(storagePanel);
}
use of org.projectforge.web.wicket.flowlayout.FileUploadPanel in project projectforge by micromata.
the class AddressImportForm method onInitialize.
/**
* @see org.apache.wicket.Component#onInitialize()
*/
@Override
protected void onInitialize() {
super.onInitialize();
gridBuilder.newSplitPanel(GridSize.COL50);
final FieldsetPanel newFieldset = gridBuilder.newFieldset(getString("address.book.vCardImport.fileUploadPanel"));
final FileUploadField uploadField = new FileUploadField(FileUploadPanel.WICKET_ID, new PropertyModel<List<FileUpload>>(this, "uploads"));
newFieldset.add(new FileUploadPanel(newFieldset.newChildId(), uploadField));
}
use of org.projectforge.web.wicket.flowlayout.FileUploadPanel in project projectforge by micromata.
the class DatevImportForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
this.setOutputMarkupId(true);
Bytes maxSize = Bytes.valueOf(configurationService.getMaxFileSizeDatev());
this.setMaxSize(maxSize);
gridBuilder.newGridPanel();
String hint = I18nHelper.getLocalizedMessage("finance.datev.upload.hint", NumberHelper.formatBytes(maxSize.bytes()));
final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), hint);
fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uploadAccounts")) {
@Override
public final void onSubmit() {
parentPage.importAccountList();
}
}, getString("finance.datev.uploadAccountList"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uploadRecords")) {
@Override
public final void onSubmit() {
parentPage.importAccountRecords();
}
}, getString("finance.datev.uploadAccountingRecords"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
addClearButton(fs);
addImportFilterRadio(gridBuilder);
// Statistics
new BusinessAssessment4Fieldset(gridBuilder) {
/**
* @see org.projectforge.web.fibu.BusinessAssessment4Fieldset#getBusinessAssessment()
*/
@Override
protected BusinessAssessment getBusinessAssessment() {
return storagePanel.businessAssessment;
}
@Override
public boolean isVisible() {
return storagePanel.businessAssessment != null;
}
};
gridBuilder.newGridPanel();
final DivPanel panel = gridBuilder.getPanel();
storagePanel = new DatevImportStoragePanel(panel.newChildId(), parentPage, importFilter);
panel.add(storagePanel);
this.fileUploadField.add(new FileFieldSizeCheckBehavior() {
@Override
protected void onSubmit(final AjaxRequestTarget target, final FileList fileList) {
// return form to remove errors
target.add(DatevImportForm.this.feedbackPanel);
}
@Override
protected void addErrorMsg(AjaxRequestTarget target, FileList fileList) {
DatevImportForm.this.addError("common.uploadpanel.filetolarge", NumberHelper.formatBytes(maxSize.bytes()));
}
@Override
protected void onError(final AjaxRequestTarget target, final FileList fileList) {
// clear input field to avoid uploading the image
DatevImportForm.this.fileUploadField.clearInput();
// return form
target.add(DatevImportForm.this);
}
});
}
use of org.projectforge.web.wicket.flowlayout.FileUploadPanel in project projectforge by micromata.
the class ReportObjectivesForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
add(new IFormValidator() {
@Override
public FormComponent<?>[] getDependentFormComponents() {
return dependentFormComponents;
}
@Override
public void validate(final Form<?> form) {
final Date fromDate = fromDatePanel.getConvertedInput();
final Date toDate = toDatePanel.getConvertedInput();
if (toDate != null && fromDate != null && fromDate.after(toDate)) {
toDatePanel.getDateField().error(getString("fibu.buchungssatz.error.invalidTimeperiod"));
}
}
});
filter = getFilter();
gridBuilder.newGridPanel();
{
final FieldsetPanel fs = new FieldsetPanel(gridBuilder.getPanel(), getString("file"), "*.xml") {
@Override
public boolean isVisible() {
return parentPage.getReportStorage() == null;
}
};
fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<>("import")) {
@Override
public final void onSubmit() {
parentPage.importReportObjectivs();
}
}, getString("import"), SingleButtonPanel.NORMAL));
}
{
final FieldsetPanel fs = new FieldsetPanel(gridBuilder.getPanel(), getString("timePeriod")) {
@Override
public boolean isVisible() {
return reportObjectivesPanel.isVisible();
}
};
fs.add(fromDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<>(filter, "fromDate"), DatePanelSettings.get().withRequired(true)));
dependentFormComponents[0] = fromDatePanel;
fs.add(new DivTextPanel(fs.newChildId(), " - "));
fs.add(toDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<>(filter, "toDate"), DatePanelSettings.get()));
dependentFormComponents[1] = toDatePanel;
final Button createReportButton = new Button(SingleButtonPanel.WICKET_ID, new Model<>("createReport")) {
@Override
public final void onSubmit() {
parentPage.createReport();
}
};
setDefaultButton(createReportButton);
fs.add(new SingleButtonPanel(fs.newChildId(), createReportButton, getString("fibu.kost.reporting.createReport"), SingleButtonPanel.DEFAULT_SUBMIT));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<>("clear")) {
@Override
public final void onSubmit() {
parentPage.clear();
}
}, getString("fibu.kost.reporting.clearStorage"), SingleButtonPanel.RESET));
}
final DivPanel panel = gridBuilder.getPanel();
panel.add(reportObjectivesPanel = new ReportObjectivesPanel(panel.newChildId(), parentPage));
}
use of org.projectforge.web.wicket.flowlayout.FileUploadPanel in project projectforge by micromata.
the class EmployeeSalaryImportForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
gridBuilder.newGridPanel();
// Date DropDowns
final FieldsetPanel fsMonthYear = gridBuilder.newFieldset(I18nHelper.getLocalizedMessage("plugins.eed.listcare.yearmonth"));
dropDownMonth = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedMonth"), EEDHelper.MONTH_INTEGERS));
dropDownMonth.setRequired(true);
fsMonthYear.add(dropDownMonth);
dropDownYear = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedYear"), eedHelper.getDropDownYears()));
dropDownYear.setRequired(true);
fsMonthYear.add(dropDownYear);
// upload buttons
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xls");
fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID) {
@Override
public final void onSubmit() {
final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0).getTime();
storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
final boolean success = parentPage.doImport(dateToSelectAttrRow);
if (success) {
setDateDropDownsEnabled(false);
}
}
}, getString("upload"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
addClearButton(fs);
}
addImportFilterRadio(gridBuilder);
// preview of the imported data
gridBuilder.newGridPanel();
final DivPanel panel = gridBuilder.getPanel();
storagePanel = new EmployeeSalaryImportStoragePanel(panel.newChildId(), parentPage, importFilter);
final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, (selectedMonth != null ? selectedMonth : PFDateTime.now().getMonthValue()) - 1, 1, 0, 0).getTime();
storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
panel.add(storagePanel);
}
Aggregations