private void createViewsButtons(ToolBar calendarToolbar) { final ToggleButton oneDay = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.oneDay() + "</b>"); final ToggleButton threeDay = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.threeDay() + "</b>"); final ToggleButton week = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.week() + "</b>"); final ToggleButton month = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.month() + "</b>"); month.toggle(); oneDay.addListener( Events.OnClick, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent ce) { threeDay.toggle(false); week.toggle(false); month.toggle(false); oneDay.toggle(true); calendar.setView(CalendarViews.DAY, 1); } }); threeDay.addListener( Events.OnClick, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent ce) { threeDay.toggle(true); week.toggle(false); month.toggle(false); oneDay.toggle(false); calendar.setView(CalendarViews.DAY, 3); } }); week.addListener( Events.OnClick, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent ce) { threeDay.toggle(false); week.toggle(true); month.toggle(false); oneDay.toggle(false); calendar.setView(CalendarViews.DAY, 7); } }); month.addListener( Events.OnClick, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent ce) { threeDay.toggle(false); week.toggle(false); month.toggle(true); oneDay.toggle(false); calendar.setView(CalendarViews.MONTH); } }); calendarToolbar.add(oneDay); calendarToolbar.add(threeDay); calendarToolbar.add(week); calendarToolbar.add(month); }
private ContentPanel getGeneralSection() { if (generalSectionPanel == null) { final ManagementServiceAsync managementService = Registry.get(PIGE.MANAGEMENT_SERVICE); generalSectionPanel = new ContentPanel(); generalSectionPanel.setHeaderVisible(false); generalSectionPanel.setLayout(new RowLayout(Orientation.VERTICAL)); generalSectionPanel.setBorders(false); ToolBar buttonBar = new ToolBar(); generalSectionPanel.setTopComponent(buttonBar); Button updateConfigsBtn = new Button(messages.update()); updateConfigsBtn.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.saveIcon())); buttonBar.add(updateConfigsBtn); updateConfigsBtn.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent event) { ServerConfigs sc = new ServerConfigs(); sc.setValue( ServerConfigs.ATT_MAINTENANCE_MODE_ACTIVATED, maintenanceModeActivated.toString()); sc.setValue(ServerConfigs.ATT_MAINTENANCE_MODE_INFO, mmInfoArea.getValue()); sc.setValue(ServerConfigs.ATT_EMAIL_ENABLED, emailServiceEnabled.toString()); sc.setValue(ServerConfigs.LOAN_TERM_VERIFICATOR_ENABLED, ltvEnabled.toString()); sc.setValue(ServerConfigs.MAINTENANCE_RECALL_SERVICE_ENABLED, mrsEnabled.toString()); managementService.setConfigurations( sc, new AsyncCallback() { @Override public void onSuccess(Object o) { PIGE.setServerOperationModeStatus(); StatusBar statusBar = Registry.get(AppWidgets.APP_STATUS_BAR); statusBar.setTimedText(messages.updateSuccessful()); } @Override public void onFailure(Throwable caught) { PIGE.handleException(caught); } }); } }); Html generatTitle = new Html(messages.general()); generatTitle.addStyleName("pige-management-section-title"); generalSectionPanel.add(generatTitle, new RowData(1, 25, new Margins(3))); LayoutContainer maintenancePanel = new LayoutContainer(); maintenancePanel.setWidth(1); maintenancePanel.setBorders(false); maintenancePanel.setLayout(new RowLayout(Orientation.VERTICAL)); // Maintenance mode Html maintenanceTitle = new Html(messages.maintenanceMode()); maintenanceTitle.addStyleName("pige-management-topic-title"); maintenancePanel.add(maintenanceTitle, new RowData(1, 20)); Html maintenanceModeText = new Html(messages.maintenanceModeText()); maintenancePanel.add(maintenanceModeText, new RowData(1, -1)); LayoutContainer maintenanceConfigPanel = new LayoutContainer(); maintenanceConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); maintenancePanel.add(maintenanceConfigPanel, new RowData(1, 75)); mmInfoArea = new TextArea(); mmActivatedBtn = new ToggleButton(messages.activated()); mmActivatedBtn.setSize(75, 22); mmActivatedBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); mmActivatedBtn.setToggleGroup("mm-state"); mmDeactivatedBtn = new ToggleButton(messages.deactivated()); mmDeactivatedBtn.setSize(75, 22); mmDeactivatedBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); mmDeactivatedBtn.setToggleGroup("mm-state"); Listener mmButtonListener = new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent event) { if (mmActivatedBtn.isPressed()) { maintenanceModeActivated = Boolean.TRUE; } else { maintenanceModeActivated = Boolean.FALSE; } } }; mmActivatedBtn.addListener(Events.Toggle, mmButtonListener); mmDeactivatedBtn.addListener(Events.Toggle, mmButtonListener); LayoutContainer buttonPanel = new LayoutContainer(); buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL)); buttonPanel.add(mmActivatedBtn); buttonPanel.add(mmDeactivatedBtn); maintenanceConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3))); maintenanceConfigPanel.add(mmInfoArea, new RowData(1, 1)); generalSectionPanel.add(maintenancePanel, new RowData(1, -1, new Margins(5))); // Email LayoutContainer emailServicePanel = new LayoutContainer(); emailServicePanel.setWidth(1); emailServicePanel.setBorders(false); emailServicePanel.setLayout(new RowLayout(Orientation.VERTICAL)); Html emailServiceTitle = new Html(messages.emailService()); emailServiceTitle.addStyleName("pige-management-topic-title"); emailServicePanel.add(emailServiceTitle, new RowData(1, 20)); Html emailServiceText = new Html(messages.emailServiceText()); emailServicePanel.add(emailServiceText, new RowData(1, -1)); LayoutContainer emailServiceConfigPanel = new LayoutContainer(); emailServiceConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); emailServicePanel.add(emailServiceConfigPanel, new RowData(1, 75)); emailEnabledBtn = new ToggleButton(messages.activated()); emailEnabledBtn.setSize(75, 22); emailEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); emailEnabledBtn.setToggleGroup("email-service-state"); emailDisabledBtn = new ToggleButton(messages.deactivated()); emailDisabledBtn.setSize(75, 22); emailDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); emailDisabledBtn.setToggleGroup("email-service-state"); Listener emailServiceButtonListener = new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent event) { if (emailEnabledBtn.isPressed()) { emailServiceEnabled = Boolean.TRUE; } else { emailServiceEnabled = Boolean.FALSE; } } }; emailEnabledBtn.addListener(Events.Toggle, emailServiceButtonListener); emailDisabledBtn.addListener(Events.Toggle, emailServiceButtonListener); buttonPanel = new LayoutContainer(); buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL)); buttonPanel.add(emailEnabledBtn); buttonPanel.add(emailDisabledBtn); emailServiceConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3))); generalSectionPanel.add(emailServicePanel, new RowData(1, -1, new Margins(5))); // Vérificateur d'échéance des emprunts LayoutContainer ltvServicePanel = new LayoutContainer(); ltvServicePanel.setWidth(1); ltvServicePanel.setBorders(false); ltvServicePanel.setLayout(new RowLayout(Orientation.VERTICAL)); Html ltvTitle = new Html(messages.loanTermVerification()); ltvTitle.addStyleName("pige-management-topic-title"); ltvServicePanel.add(ltvTitle, new RowData(1, 20)); Html ltvText = new Html(messages.loanTermVerificationText()); ltvServicePanel.add(ltvText, new RowData(1, -1)); LayoutContainer ltvConfigPanel = new LayoutContainer(); ltvConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); ltvServicePanel.add(ltvConfigPanel, new RowData(1, 75)); ltvEnabledBtn = new ToggleButton(messages.activated()); ltvEnabledBtn.setSize(75, 22); ltvEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); ltvEnabledBtn.setToggleGroup("ltv-state"); ltvDisabledBtn = new ToggleButton(messages.deactivated()); ltvDisabledBtn.setSize(75, 22); ltvDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); ltvDisabledBtn.setToggleGroup("ltv-state"); Listener ltvButtonListener = new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent event) { if (ltvEnabledBtn.isPressed()) { ltvEnabled = Boolean.TRUE; } else { ltvEnabled = Boolean.FALSE; } } }; ltvEnabledBtn.addListener(Events.Toggle, ltvButtonListener); ltvDisabledBtn.addListener(Events.Toggle, ltvButtonListener); buttonPanel = new LayoutContainer(); buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL)); buttonPanel.add(ltvEnabledBtn); buttonPanel.add(ltvDisabledBtn); ltvConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3))); generalSectionPanel.add(ltvServicePanel, new RowData(1, -1, new Margins(5))); // Service de rappel des maintenances. LayoutContainer mrsServicePanel = new LayoutContainer(); mrsServicePanel.setWidth(1); mrsServicePanel.setBorders(false); mrsServicePanel.setLayout(new RowLayout(Orientation.VERTICAL)); Html mrsTitle = new Html(messages.maintenanceRecalLService()); mrsTitle.addStyleName("pige-management-topic-title"); mrsServicePanel.add(mrsTitle, new RowData(1, 20)); Html mrsText = new Html(messages.maintenanceRecalLServiceTxt()); mrsServicePanel.add(mrsText, new RowData(1, -1)); LayoutContainer mrsConfigPanel = new LayoutContainer(); mrsConfigPanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); mrsServicePanel.add(mrsConfigPanel, new RowData(1, 75)); mrsEnabledBtn = new ToggleButton(messages.activated()); mrsEnabledBtn.setSize(75, 22); mrsEnabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); mrsEnabledBtn.setToggleGroup("mrs-state"); mrsDisabledBtn = new ToggleButton(messages.deactivated()); mrsDisabledBtn.setSize(75, 22); mrsDisabledBtn.setStyleAttribute("padding", "0px 0px 0px 0px"); mrsDisabledBtn.setToggleGroup("mrs-state"); Listener mrsButtonListener = new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent event) { if (mrsEnabledBtn.isPressed()) { mrsEnabled = Boolean.TRUE; } else { mrsEnabled = Boolean.FALSE; } } }; mrsEnabledBtn.addListener(Events.Toggle, mrsButtonListener); mrsDisabledBtn.addListener(Events.Toggle, mrsButtonListener); buttonPanel = new LayoutContainer(); buttonPanel.setLayout(new RowLayout(Orientation.VERTICAL)); buttonPanel.add(mrsEnabledBtn); buttonPanel.add(mrsDisabledBtn); mrsConfigPanel.add(buttonPanel, new RowData(100, 1, new Margins(3))); generalSectionPanel.add(mrsServicePanel, new RowData(1, -1, new Margins(5))); } return generalSectionPanel; }