use of org.projectforge.web.wicket.components.SingleButtonPanel 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.components.SingleButtonPanel in project projectforge by micromata.
the class IHKForm method showMissingDescriptionList.
void showMissingDescriptionList(List<TimesheetDO> missingDescriptionList) {
gridBuilder.newSplitPanel(GridSize.COL66);
DateFormat date = new SimpleDateFormat("dd.MM.yyyy");
DateFormat time = new SimpleDateFormat("HH:mm");
for (TimesheetDO ts : missingDescriptionList) {
String label = getString("plugins.ihk.nodescriptionfound");
if (ts.getKost2() != null) {
if (ts.getKost2().getDescription() != null) {
label = ts.getKost2().getDescription();
} else if (ts.getKost2().getDisplayName() != null) {
label = ts.getKost2().getDisplayName();
}
}
final FieldsetPanel fs = gridBuilder.newFieldset(label);
fs.add(new DivTextPanel(fs.newChildId(), date.format(ts.getStartTime().getTime()) + " " + time.format(ts.getStartTime().getTime()) + " - " + time.format(ts.getStopTime().getTime())));
Button editButton = new Button(SingleButtonPanel.WICKET_ID, new Model("edit")) {
@Override
public void onSubmit() {
parentPage.edit(ts);
}
};
fs.add(new SingleButtonPanel(fs.newChildId(), editButton, getString("plugins.ihk.edit"), SingleButtonPanel.CANCEL));
}
// Download anyway button
final FieldsetPanel downloadPanel = gridBuilder.newFieldset("");
Button downloadButton = new Button(SingleButtonPanel.WICKET_ID, new Model("download")) {
@Override
public void onSubmit() {
parentPage.export(true);
}
};
downloadPanel.add(new SingleButtonPanel(downloadPanel.newChildId(), downloadButton, getString("plugins.ihk.downloadAnyway"), SingleButtonPanel.DEFAULT_SUBMIT));
}
use of org.projectforge.web.wicket.components.SingleButtonPanel in project projectforge by micromata.
the class AccessEditForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
gridBuilder.newGridPanel();
{
// Task
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId");
fs.add(taskSelectPanel.setRequired(true));
taskSelectPanel.init();
}
{
// Group
final FieldsetPanel fs = gridBuilder.newFieldset(getString("group")).suppressLabelForWarning();
groupSelectPanel = new NewGroupSelectPanel(fs.newChildId(), new PropertyModel<GroupDO>(data, "group"), parentPage, "groupId");
fs.add(groupSelectPanel.setRequired(true));
groupSelectPanel.init();
}
{
// Option recursive
gridBuilder.newFieldset(getString("recursive")).addCheckBox(new PropertyModel<Boolean>(data, "recursive"), null).setTooltip(getString("access.recursive.help"));
}
{
// Access entries table
final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.accessTable")).suppressLabelForWarning();
final AccessEditTablePanel accessEditTablePanel = new AccessEditTablePanel(fs.newChildId(), data);
fs.add(accessEditTablePanel);
accessEditTablePanel.init();
}
{
// Templates
final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.templates")).suppressLabelForWarning();
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("clear")) {
@Override
public final void onSubmit() {
data.clear();
}
}, getString("access.templates.clear"), SingleButtonPanel.NORMAL));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("guest")) {
@Override
public final void onSubmit() {
data.guest();
}
}, getString("access.templates.guest"), SingleButtonPanel.NORMAL));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("employee")) {
@Override
public final void onSubmit() {
data.employee();
}
}, getString("access.templates.employee"), SingleButtonPanel.NORMAL));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("leader")) {
@Override
public final void onSubmit() {
data.leader();
}
}, getString("access.templates.leader"), SingleButtonPanel.NORMAL));
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("administrator")) {
@Override
public final void onSubmit() {
data.administrator();
}
}, getString("access.templates.administrator"), SingleButtonPanel.DANGER));
}
{
// Description
final FieldsetPanel fs = gridBuilder.newFieldset(getString("description"));
fs.add(new MaxLengthTextArea(fs.getTextAreaId(), new PropertyModel<String>(data, "description")), true);
}
}
use of org.projectforge.web.wicket.components.SingleButtonPanel in project projectforge by micromata.
the class MonthlyEmployeeReportForm method init.
@SuppressWarnings("serial")
@Override
protected void init() {
super.init();
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.user"));
if (accessChecker.hasLoggedInUserAccessToTimesheetsOfOtherUsers()) {
final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(filter, "user"), parentPage, "user");
userSelectPanel.setRequired(true);
fs.add(userSelectPanel);
userSelectPanel.init();
} else {
filter.setUser(ThreadLocalUserContext.getUser());
fs.add(new DivTextPanel(fs.newChildId(), filter.getUser().getFullname()));
}
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("calendar.month"));
yearChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "year"), new ArrayList<Integer>()) {
/**
* @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
*/
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
};
yearChoice.setNullValid(false).setRequired(true);
fs.add(yearChoice);
// DropDownChoice months
final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
for (int month = 1; month <= 12; month++) {
monthChoiceRenderer.addValue(month, StringHelper.format2DigitNumber(month));
}
monthChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "month"), monthChoiceRenderer.getValues(), monthChoiceRenderer) {
/**
* @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
*/
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
};
monthChoice.setNullValid(false).setRequired(true);
fs.add(monthChoice);
final QuickSelectMonthPanel quickSelectPanel = new QuickSelectMonthPanel(fs.newChildId(), new Model<LocalDate>() {
/**
* @see org.apache.wicket.model.Model#getObject()
*/
@Override
public LocalDate getObject() {
Integer year = filter.getYear();
Integer month = filter.getMonth();
PFDateTime date;
if (year == null || month == null) {
date = PFDateTime.now().getBeginOfMonth();
} else {
date = PFDateTime.withDate(filter.getYear(), PFDayUtils.validateMonthValue(filter.getMonth()), 1);
}
return date.getLocalDate();
}
/**
* @see org.apache.wicket.model.Model#setObject(java.io.Serializable)
*/
@Override
public void setObject(final LocalDate object) {
if (object != null) {
setDate(object);
}
}
}, parentPage, "quickSelect");
fs.add(quickSelectPanel);
quickSelectPanel.init();
}
{
final Button showButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("show"));
final SingleButtonPanel showButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), showButton, getString("show"), SingleButtonPanel.DEFAULT_SUBMIT);
actionButtons.add(showButtonPanel);
setDefaultButton(showButton);
}
}
use of org.projectforge.web.wicket.components.SingleButtonPanel 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);
}
});
}
Aggregations