use of org.projectforge.web.wicket.flowlayout.DivTextPanel 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.flowlayout.DivTextPanel in project projectforge by micromata.
the class AccountingRecordListForm method onOptionsPanelCreate.
/**
* @see org.projectforge.web.wicket.AbstractListForm#onOptionsPanelCreate(org.projectforge.web.wicket.flowlayout.FieldsetPanel,
* org.projectforge.web.wicket.flowlayout.DivPanel)
*/
@Override
protected void onOptionsPanelCreate(final FieldsetPanel optionsFieldsetPanel, final DivPanel optionsCheckBoxesPanel) {
// DropDownChoices from
final YearListCoiceRenderer yearListChoiceRenderer = new YearListCoiceRenderer(buchungssatzDao.getYears(), false);
final DropDownChoice<Integer> fromYearChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "fromYear"), yearListChoiceRenderer.getYears(), yearListChoiceRenderer);
fromYearChoice.setNullValid(false).setRequired(true);
optionsFieldsetPanel.add(fromYearChoice);
final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
for (int i = 1; i <= 12; i++) {
monthChoiceRenderer.addValue(i, StringHelper.format2DigitNumber(i));
}
final DropDownChoice<Integer> fromMonthChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "fromMonth"), monthChoiceRenderer.getValues(), monthChoiceRenderer);
fromMonthChoice.setNullValid(true);
optionsFieldsetPanel.add(fromMonthChoice);
optionsFieldsetPanel.add(new DivTextPanel(optionsFieldsetPanel.newChildId(), " - "));
// DropDownChoices to
final DropDownChoice<Integer> toYearChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "toYear"), yearListChoiceRenderer.getYears(), yearListChoiceRenderer);
toYearChoice.setNullValid(false).setRequired(true);
optionsFieldsetPanel.add(toYearChoice);
final DropDownChoice<Integer> toMonthChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "toMonth"), monthChoiceRenderer.getValues(), monthChoiceRenderer);
toMonthChoice.setNullValid(true);
optionsFieldsetPanel.add(toMonthChoice);
}
use of org.projectforge.web.wicket.flowlayout.DivTextPanel in project projectforge by micromata.
the class ModalMessageDialog method setMessage.
/**
* Don't use this method for updating messages.
* @param message
* @return this for chaining.
*/
public ModalMessageDialog setMessage(final IModel<String> message) {
this.messageModel = message;
final DivTextPanel textPanel = new DivTextPanel(getMessageComponentId(), message);
gridContentContainer.add(textPanel);
messageComponent = textPanel.getDiv().setOutputMarkupId(true);
return this;
}
use of org.projectforge.web.wicket.flowlayout.DivTextPanel in project projectforge by micromata.
the class PluginListForm method init.
@Override
protected void init() {
super.init();
List<AbstractPlugin> availables = pluginAdminService.getAvailablePlugins();
List<String> activatedPlugins = pluginAdminService.getActivatedPluginsFromConfiguration();
gridBuilder.newFormHeading("Please note: (de)activation of plugins will take effect only after restart!");
for (AbstractPlugin plugin : availables) {
gridBuilder.newGridPanel();
gridBuilder.newSplitPanel(GridSize.SPAN2);
DivPanel section = gridBuilder.getPanel();
DivTextPanel pluginId = new DivTextPanel(section.newChildId(), new Model<String>() {
@Override
public String getObject() {
return plugin.getInfo().getId();
}
});
section.add(pluginId);
gridBuilder.newSplitPanel(GridSize.SPAN8);
section = gridBuilder.getPanel();
pluginId = new DivTextPanel(section.newChildId(), new Model<String>() {
@Override
public String getObject() {
return plugin.getInfo().getDescription();
}
});
section.add(pluginId);
gridBuilder.newSplitPanel(GridSize.SPAN2);
section = gridBuilder.getPanel();
final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>()) {
@Override
public final void onSubmit() {
pluginAdminService.storePluginToBeActivated(plugin.getInfo().getId(), !isActivated(activatedPlugins, plugin));
setResponsePage(new PluginListPage(getPage().getPageParameters()));
}
};
final SingleButtonPanel buttonPanel = new SingleButtonPanel(section.newChildId(), button, isActivated(activatedPlugins, plugin) ? getString("system.pluginAdmin.button.deactivate") : getString("system.pluginAdmin.button.activate"), SingleButtonPanel.DANGER);
if (isActivated(activatedPlugins, plugin)) {
buttonPanel.setClassnames(SingleButtonPanel.SUCCESS);
}
section.add(buttonPanel);
}
}
use of org.projectforge.web.wicket.flowlayout.DivTextPanel in project projectforge by micromata.
the class SqlConsoleForm method init.
@Override
@SuppressWarnings("serial")
protected void init() {
super.init();
gridBuilder.newGridPanel();
{
final FieldsetPanel fs = gridBuilder.newFieldset("SQL");
final MaxLengthTextArea sqlTextArea = new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "sql"), 10000);
sqlTextArea.add(AttributeModifier.append("style", "width: 100%; height: 5em;"));
fs.add(sqlTextArea);
}
{
final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning();
final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>()) {
@Override
public final void onSubmit() {
parentPage.excecute(sql);
}
};
final SingleButtonPanel buttonPanel = new SingleButtonPanel(fs.newChildId(), button, "execute", SingleButtonPanel.DANGER);
fs.add(buttonPanel);
}
gridBuilder.newGridPanel();
final DivPanel section = gridBuilder.getPanel();
final DivTextPanel resultPanel = new DivTextPanel(section.newChildId(), new Model<String>() {
@Override
public String getObject() {
return resultString;
}
});
resultPanel.getLabel().setEscapeModelStrings(false);
section.add(resultPanel);
}
Aggregations