List of usage examples for org.apache.wicket.feedback FeedbackMessage FeedbackMessage
public FeedbackMessage(final Component reporter, final Serializable message, final int level)
From source file:com.evolveum.midpoint.web.component.input.ExpressionValuePanel.java
License:Apache License
private void initAssociationTargetSearchExpressionPanel() { WebMarkupContainer targetSearchContainer = new WebMarkupContainer(ID_ASSOCIATION_TARGET_SEARCH_CONTAINER); targetSearchContainer.setOutputMarkupId(true); targetSearchContainer.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override/*from w w w .j a v a2s .co m*/ public boolean isVisible() { MapXNode node = ExpressionUtil.getAssociationTargetSearchFilterValuesMap(getModelObject()); return node != null && !node.isEmpty(); } }); add(targetSearchContainer); AjaxLink removeButton = new AjaxLink(ID_DELETE_TARGET_SEARCH_EXP_BUTTON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { ExpressionUtil.removeEvaluatorByName(ExpressionValuePanel.this.getModelObject(), SchemaConstantsGenerated.C_ASSOCIATION_TARGET_SEARCH); target.add(ExpressionValuePanel.this); } }; targetSearchContainer.add(removeButton); TextPanel<String> targetSearchFilterPathInput = new TextPanel<>(ID_TARGET_SEARCH_PATH_INPUT, Model.of(ExpressionUtil.getTargetSearchExpPathValue(getModelObject()))); targetSearchFilterPathInput.setOutputMarkupId(true); targetSearchFilterPathInput.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { String pathValue = targetSearchFilterPathInput.getBaseFormComponent().getValue(); if (getModelObject() == null) { getModel().setObject(new ExpressionType()); } try { ExpressionUtil.updateAssociationTargetSearchPath(getModelObject(), getPrismContext().itemPathParser().asItemPathType(pathValue), getPrismContext()); } catch (Exception ex) { pageBase.getFeedbackPanel().getFeedbackMessages() .add(new FeedbackMessage(ExpressionValuePanel.this, ex.getLocalizedMessage(), 0)); target.add(pageBase.getFeedbackPanel()); } } }); targetSearchContainer.add(targetSearchFilterPathInput); TextPanel<String> targetSearchFilterValueInput = new TextPanel<>(ID_TARGET_SEARCH_VALUE_INPUT, Model.of(ExpressionUtil.getTargetSearchExpValue(getModelObject()))); targetSearchFilterValueInput.setOutputMarkupId(true); targetSearchFilterValueInput.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { String value = targetSearchFilterValueInput.getBaseFormComponent().getValue(); String path = targetSearchFilterPathInput.getBaseFormComponent().getValue(); if (getModelObject() == null) { getModel().setObject(new ExpressionType()); } try { ExpressionUtil.updateAssociationTargetSearchValue(getModelObject(), path, value, pageBase.getPrismContext()); } catch (SchemaException ex) { pageBase.getFeedbackPanel().getFeedbackMessages() .add(new FeedbackMessage(ExpressionValuePanel.this, ex.getErrorTypeMessage(), 0)); target.add(pageBase.getFeedbackPanel()); } } }); targetSearchContainer.add(targetSearchFilterValueInput); }
From source file:org.devproof.portal.core.module.common.model.PortalFeedbackMessagesModel.java
License:Apache License
@Override protected List<FeedbackMessage> processMessages(List<FeedbackMessage> messages) { List<FeedbackMessage> result = new ArrayList<FeedbackMessage>(); for (FeedbackMessage message : messages) { Component reporter = message.getReporter(); if (!hasValidationDisplayBehaviour(reporter)) { result.add(message);/*from w w w . j a v a2 s. c om*/ } } if (result.size() != messages.size()) { result.add(0, new FeedbackMessage(null, component.getString("formErrorHint"), FeedbackMessage.ERROR)); } return result; }
From source file:org.ujorm.wicket.component.form.FeedbackLabel.java
License:Apache License
/** Insert feedback message */ public void setFeedbackMessage(IModel<String> message) { if (message != null) { input.getFeedbackMessages().add(new FeedbackMessage(input, message.getObject(), 0)); } else {/* w ww . ja v a 2 s .c o m*/ input.getFeedbackMessages().clear(); } }
From source file:ro.nextreports.server.web.core.HomePage.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); // obtain a reference to a Push service implementation final IPushService pushService = TimerPushService.get(); ;/*ww w. ja va 2 s .com*/ // instantiate push event handler IPushEventHandler<Message> handler = new AbstractPushEventHandler<Message>() { private static final long serialVersionUID = 1L; @Override public void onEvent(AjaxRequestTarget target, Message event, IPushNode<Message> node, IPushEventContext<Message> context) { int messageType = event.isError() ? JGrowlAjaxBehavior.ERROR_STICKY : JGrowlAjaxBehavior.INFO_STICKY; getSession().getFeedbackMessages().add(new FeedbackMessage(null, event.getText(), messageType)); target.add(growlLabel); boolean autoOpen = storageService.getSettings().isAutoOpen(); String reportsUrl = storageService.getSettings().getReportsUrl(); if (autoOpen && StringUtils.contains(event.getText(), reportsUrl)) { growlBehavior.setAfterOpenJavaScript(getJGrowlAfterOpenJavaScript()); } } }; // install push node into this panel final IPushNode<Message> pushNode = pushService.installNode(this, handler); // push report result initPushReportResult(pushService, pushNode); // push survey initPushSurvey(pushService, pushNode); }
From source file:ro.nextreports.server.web.schedule.ScheduleWizard.java
License:Apache License
@Override public void onFinish() { // a scheduled alarm / indicator / display must have at least an alert if (schedulerJob.getReport().isAlarmType() || schedulerJob.getReport().isIndicatorType() || schedulerJob.getReport().isDisplayType()) { if (schedulerJob.getDestinations().isEmpty()) { error(getString("ActionContributor.Run.destination.error.alert")); return; }/*from w w w. jav a 2 s.c o m*/ } String globalMessage; if (runNow) { globalMessage = getString("ActionContributor.Run.running"); } else { globalMessage = getString("ActionContributor.Run.scheduledMessage"); } schedulerJob.setCreator(SecurityContextHolder.getContext().getAuthentication().getName()); if (ReportConstants.ETL_FORMAT.equals(runtimeModel.getExportType())) { // test to create user node under analysis analysisService.checkAnalysisPath(); } schedulerJob.setRuntimeModel(runtimeModel); if (schedulerJob.getBatchDefinition() != null) { String batchParameter = schedulerJob.getBatchDefinition().getParameter(); if (batchParameter != null) { // batch parameter must not be set as dynamic, if it is dynamic we reset it. schedulerJob.getReportRuntime().resetDynamic(batchParameter); // all children dependent parameters to batch parameter must be dynamic ro.nextreports.engine.Report nextReport = NextUtil.getNextReport(storageService.getSettings(), schedulerJob.getReport()); Map<String, QueryParameter> map = ParameterUtil.getChildDependentParameters(nextReport, batchParameter); schedulerJob.getReportRuntime().setDynamic(new ArrayList<String>(map.keySet())); } } if (!runNow) { schedulerJob.setPath(StorageConstants.SCHEDULER_ROOT + "/" + schedulerJob.getName()); SchedulerUtil.updateSchedulerTime(schedulerJob.getTime()); schedulerJob.getTime().setPath(StorageUtil.createPath(schedulerJob, schedulerJob.getTime().getName())); schedulerJob.getReportRuntime() .setPath(StorageUtil.createPath(schedulerJob, schedulerJob.getReportRuntime().getName())); schedulerJob.setRunNow(false); for (Destination destination : schedulerJob.getDestinations()) { // temporary path created with an UUID if (destination.getPath().indexOf(StorageConstants.PATH_SEPARATOR) == -1) { // add new destination destination.setPath( schedulerJob.getPath() + StorageConstants.PATH_SEPARATOR + StorageConstants.DESTINATIONS + StorageConstants.PATH_SEPARATOR + destination.getName()); } } } if (LOG.isDebugEnabled()) { LOG.debug("job = " + schedulerJob); } try { if (runtimeModel.isSaveTemplate()) { //System.out.println("**** save template : " + runtimeModel.getTemplateName()); // save values template Report report = schedulerJob.getReport(); ReportRuntimeTemplate template = new ReportRuntimeTemplate(); template.setName(runtimeModel.getTemplateName()); template.setReportRuntime(schedulerJob.getReportRuntime()); template.setShortcutType(runtimeModel.getShortcutType()); String path = null; try { if (!StorageUtil.isVersion(report)) { path = storageService.getEntityById(report.getId()).getPath(); } else { String versionId = StorageUtil.getVersionableId(report); path = storageService.getEntityById(versionId).getPath(); } } catch (Exception e) { e.printStackTrace(); LOG.error(e.getMessage(), e); } path += StorageConstants.PATH_SEPARATOR + "templates" + StorageConstants.PATH_SEPARATOR + template.getName(); template.setPath(path); if (LOG.isDebugEnabled()) { LOG.debug("Create values template '" + template.getPath() + "'"); } try { String id = storageService.addEntity(template); schedulerJob.setTemplate((ReportRuntimeTemplate) storageService.getEntityById(id)); } catch (Exception e) { e.printStackTrace(); LOG.error(e.getMessage(), e); } } else { ReportRuntimeTemplate template = templatePanel.getTemplate(); schedulerJob.setTemplate(templatePanel.getTemplate()); } if (edit) { // IMPORTANT : see SchedulerJobModifieddvice storageService.modifyEntity(schedulerJob); } else if (runNow) { schedulerJob.setRunNow(true); reportService.runReport(schedulerJob); //sectionManager.setSelectedSectionId(MonitorSection.ID); } else { // IMPORTANT : see SchedulerJobAddedAdvice storageService.addEntity(schedulerJob); sectionManager.setSelectedSectionId(SchedulerSection.ID); } } catch (Exception e) { e.printStackTrace(); LOG.error(e.getMessage(), e); error(e.getMessage()); } finally { // some values for jasper parameters are updated in run method, so we log here if (LOG.isDebugEnabled()) { LOG.debug(schedulerJob.getReportRuntime().toString()); } } // just put a feedback message to be shown by JGrowl getSession().getFeedbackMessages() .add(new FeedbackMessage(null, globalMessage, JGrowlAjaxBehavior.INFO_FADE)); if (getPage() instanceof ReportsPage) { setResponsePage(ReportsPage.class); } else { setResponsePage(HomePage.class); } }
From source file:sf.wicklet.ext.components.feedback.FeedbackFactory.java
License:Apache License
public void error(final String msg) { feedback.add(new FeedbackMessage(reporter, msg, FeedbackMessage.ERROR)); }
From source file:sf.wicklet.ext.components.feedback.FeedbackFactory.java
License:Apache License
public void warn(final String msg) { feedback.add(new FeedbackMessage(reporter, msg, FeedbackMessage.WARNING)); }
From source file:sf.wicklet.ext.components.feedback.FeedbackFactory.java
License:Apache License
public void info(final String msg) { feedback.add(new FeedbackMessage(reporter, msg, FeedbackMessage.INFO)); }
From source file:sf.wicklet.ext.ui.panels.SimpleFeedbackPanel.java
License:Apache License
public SimpleFeedbackPanel add(final Component reporter, final String msg, final int level) { getFeedbackMessages().add(new FeedbackMessage(reporter, msg, level)); return this; }