List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setInitialWidth
public ModalWindow setInitialWidth(final int initialWidth)
From source file:org.geoserver.community.css.web.CssDemoPage.java
License:Open Source License
private void doMainLayout() { final Fragment mainContent = new Fragment("main-content", "normal", this); final ModalWindow popup = new ModalWindow("popup"); mainContent.add(popup);//from ww w .j a va2 s .c o m final StyleNameModel styleNameModel = new StyleNameModel(style); final PropertyModel layerNameModel = new PropertyModel(layer, "prefixedName"); mainContent.add(new AjaxLink("create.style", new ParamResourceModel("CssDemoPage.createStyle", this)) { public void onClick(AjaxRequestTarget target) { target.appendJavascript("Wicket.Window.unloadConfirmation = false;"); popup.setInitialHeight(200); popup.setInitialWidth(300); popup.setTitle(new Model("Choose name for new style")); popup.setContent(new StyleNameInput(popup.getContentId(), CssDemoPage.this)); popup.show(target); } }); mainContent.add(new SimpleAjaxLink("change.style", styleNameModel) { public void onClick(AjaxRequestTarget target) { target.appendJavascript("Wicket.Window.unloadConfirmation = false;"); popup.setInitialHeight(400); popup.setInitialWidth(600); popup.setTitle(new Model("Choose style to edit")); popup.setContent(new StyleChooser(popup.getContentId(), CssDemoPage.this)); popup.show(target); } }); mainContent.add(new SimpleAjaxLink("change.layer", layerNameModel) { public void onClick(AjaxRequestTarget target) { target.appendJavascript("Wicket.Window.unloadConfirmation = false;"); popup.setInitialHeight(400); popup.setInitialWidth(600); popup.setTitle(new Model("Choose layer to edit")); popup.setContent(new LayerChooser(popup.getContentId(), CssDemoPage.this)); popup.show(target); } }); mainContent .add(new AjaxLink("associate.styles", new ParamResourceModel("CssDemoPage.associateStyles", this)) { public void onClick(AjaxRequestTarget target) { target.appendJavascript("Wicket.Window.unloadConfirmation = false;"); popup.setInitialHeight(400); popup.setInitialWidth(600); popup.setTitle(new Model("Choose layers to associate")); popup.setContent(new MultipleLayerChooser(popup.getContentId(), CssDemoPage.this)); popup.show(target); } }); ParamResourceModel associateToLayer = new ParamResourceModel("CssDemoPage.associateDefaultStyle", this, styleNameModel, layerNameModel); final SimpleAjaxLink associateDefaultStyle = new SimpleAjaxLink("associate.default.style", new Model(), associateToLayer) { public void onClick(final AjaxRequestTarget linkTarget) { final Component theComponent = this; dialog.setResizable(false); dialog.setHeightUnit("em"); dialog.setWidthUnit("em"); dialog.setInitialHeight(7); dialog.setInitialWidth(50); dialog.showOkCancel(linkTarget, new DialogDelegate() { boolean success = false; @Override protected boolean onSubmit(AjaxRequestTarget target, Component contents) { layer.setDefaultStyle(style); getCatalog().save(layer); theComponent.setEnabled(false); success = true; return true; } @Override public void onClose(AjaxRequestTarget target) { super.onClose(target); target.addComponent(theComponent); if (success) { CssDemoPage.this.info(new ParamResourceModel("CssDemoPage.styleAssociated", CssDemoPage.this, styleNameModel, layerNameModel).getString()); target.addComponent(getFeedbackPanel()); } } @Override protected Component getContents(String id) { ParamResourceModel confirm = new ParamResourceModel("CssDemoPage.confirmAssocation", CssDemoPage.this, styleNameModel.getObject(), layerNameModel.getObject(), layer.getDefaultStyle().getName()); return new Label(id, confirm); } }); } }; associateDefaultStyle.setOutputMarkupId(true); if (layer.getDefaultStyle().equals(style)) { associateDefaultStyle.setEnabled(false); } mainContent.add(associateDefaultStyle); final IModel<String> sldModel = new AbstractReadOnlyModel<String>() { public String getObject() { try { // if file already in css format transform to sld, otherwise load the SLD file if (CssHandler.FORMAT.equals(style.getFormat())) { StyledLayerDescriptor sld = Styles.sld(style.getStyle()); return Styles.string(sld, new SLDHandler(), SLDHandler.VERSION_10, true); } else { File file = findStyleFile(style); if (file != null && file.isFile()) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); StringBuilder builder = new StringBuilder(); char[] line = new char[4096]; int len = 0; while ((len = reader.read(line, 0, 4096)) >= 0) builder.append(line, 0, len); return builder.toString(); } finally { if (reader != null) reader.close(); } } else { return "No SLD file found for this style. One will be generated automatically if you save the CSS."; } } } catch (IOException e) { throw new WicketRuntimeException(e); } } }; final CompoundPropertyModel model = new CompoundPropertyModel<CssDemoPage>(CssDemoPage.this); List<ITab> tabs = new ArrayList<ITab>(); tabs.add(new PanelCachingTab(new AbstractTab(new Model("Generated SLD")) { public Panel getPanel(String id) { SLDPreviewPanel panel = new SLDPreviewPanel(id, sldModel); sldPreview = panel.getLabel(); return panel; } })); tabs.add(new PanelCachingTab(new AbstractTab(new Model("Map")) { public Panel getPanel(String id) { return map = new OpenLayersMapPanel(id, layer, style); } })); if (layer.getResource() instanceof FeatureTypeInfo) { tabs.add(new PanelCachingTab(new AbstractTab(new Model("Data")) { public Panel getPanel(String id) { try { return new DataPanel(id, model, (FeatureTypeInfo) layer.getResource()); } catch (IOException e) { throw new WicketRuntimeException(e); } }; })); } else if (layer.getResource() instanceof CoverageInfo) { tabs.add(new PanelCachingTab(new AbstractTab(new Model("Data")) { public Panel getPanel(String id) { return new BandsPanel(id, (CoverageInfo) layer.getResource()); }; })); } tabs.add(new AbstractTab(new Model("CSS Reference")) { public Panel getPanel(String id) { return new DocsPanel(id); } }); File sldFile = findStyleFile(style); File cssFile = new File(sldFile.getParentFile(), style.getName() + ".css"); mainContent.add(new StylePanel("style.editing", model, CssDemoPage.this, cssFile)); mainContent.add(new AjaxTabbedPanel("context", tabs)); add(mainContent); add(dialog = new GeoServerDialog("dialog")); }
From source file:org.geoserver.qos.web.LayersListModalBuilder.java
License:Open Source License
@Override public WebMarkupContainer build(WebMarkupContainer mainDiv, ModalWindow modalWindow, IModel<LimitedAreaRequestConstraints> model) { WebMarkupContainer layersDiv = new WebMarkupContainer("layersDiv"); layersDiv.setOutputMarkupId(true);/*from w ww . ja va 2s . c om*/ mainDiv.add(layersDiv); final ListView<String> layersListView = new ListView<String>("layersList", new PropertyModel<>(model, "layerNames")) { @Override protected void populateItem(ListItem<String> item) { TextField<String> layerField = new TextField<>("layerName", item.getModel()); layerField.setEnabled(false); item.add(layerField); AjaxSubmitLink deleteLayerLink = new AjaxSubmitLink("deleteLayer") { @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); model.getObject().getLayerNames().remove(item.getModel().getObject()); target.add(mainDiv); } }; item.add(deleteLayerLink); } }; layersDiv.add(layersListView); final AjaxLink addLayerLink = new AjaxLink("addLayer") { @Override public void onClick(AjaxRequestTarget target) { modalWindow.setInitialHeight(375); modalWindow.setInitialWidth(525); modalWindow.setTitle("Choose layer"); WorkspaceInfo wsi = mainDiv.findParent(QosWmsAdminPanel.class).getMainModel().getObject() .getWorkspace(); modalWindow.setContent(new LayerListPanel(modalWindow.getContentId(), wsi) { @Override protected void handleLayer(org.geoserver.catalog.LayerInfo layer, AjaxRequestTarget target) { if (!model.getObject().getLayerNames().contains(model.getObject().getLayerNames())) { model.getObject().getLayerNames().add(layer.prefixedName()); } modalWindow.close(target); target.add(mainDiv); }; }); modalWindow.show(target); } }; layersDiv.add(addLayerLink); return layersDiv; }
From source file:org.geoserver.qos.web.TypesListBuilder.java
License:Open Source License
@Override public WebMarkupContainer build(WebMarkupContainer mainDiv, ModalWindow modalWindow, IModel<WfsAdHocQueryConstraints> model) { WebMarkupContainer layersDiv = new WebMarkupContainer("layersDiv"); layersDiv.setOutputMarkupId(true);//from w w w . j ava 2 s. co m mainDiv.add(layersDiv); final ListView<String> layersListView = new ListView<String>("layersList", new PropertyModel<>(model, "typeNames")) { @Override protected void populateItem(ListItem<String> item) { TextField<String> layerField = new TextField<>("layerName", item.getModel()); layerField.setEnabled(false); item.add(layerField); AjaxSubmitLink deleteLayerLink = new AjaxSubmitLink("deleteLayer") { @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); model.getObject().getTypeNames().remove(item.getModel().getObject()); target.add(mainDiv); } }; item.add(deleteLayerLink); } }; layersDiv.add(layersListView); // Autocomplete add to list: // final AutoCompleteTextField<String> addTypeNameField = // new AutoCompleteTextField<String>("addTypeNameField", new // PropertyModel<>(typeToAdd, "value")) { // @Override // protected Iterator<String> getChoices(String arg0) { // return null; // } // }; final AjaxLink addLayerLink = new AjaxLink("addLayer") { @Override public void onClick(AjaxRequestTarget target) { WorkspaceInfo wsi = mainDiv.findParent(QosWfsAdminPanel.class).getMainModel().getObject() .getWorkspace(); modalWindow.setInitialHeight(375); modalWindow.setInitialWidth(525); modalWindow.setTitle("Choose layer"); modalWindow.setContent(new LayerListPanel(modalWindow.getContentId(), wsi) { @Override protected void handleLayer(org.geoserver.catalog.LayerInfo layer, AjaxRequestTarget target) { if (model.getObject().getTypeNames() == null) { model.getObject().setTypeNames(new ArrayList<>()); } if (!model.getObject().getTypeNames().contains(layer.prefixedName())) { model.getObject().getTypeNames().add(layer.prefixedName()); } modalWindow.close(target); target.add(mainDiv); }; }); modalWindow.show(target); } }; layersDiv.add(addLayerLink); return layersDiv; }
From source file:org.geoserver.solr.SolrConfigurationPanel.java
License:Open Source License
/** * Adds SOLR configuration panel link, configure modal dialog and implements modal callback * /*from w w w .java 2 s. c om*/ * @see {@link SolrConfigurationPage#done} */ public SolrConfigurationPanel(final String panelId, final IModel model) { super(panelId, model); final FeatureTypeInfo fti = (FeatureTypeInfo) model.getObject(); final ModalWindow modal = new ModalWindow("modal"); modal.setInitialWidth(800); modal.setTitle(new ParamResourceModel("modalTitle", SolrConfigurationPanel.this)); modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { @Override public void onClose(AjaxRequestTarget target) { if (_layerInfo != null) { GeoServerApplication app = (GeoServerApplication) getApplication(); FeatureTypeInfo ft = (FeatureTypeInfo) getResourceInfo(); //Override _isNew state, based on resource informations into catalog if (ft.getId() != null && app.getCatalog().getResource(ft.getId(), ResourceInfo.class) != null) { _isNew = false; } else { _isNew = true; } app.getCatalog().getResourcePool().clear(ft); app.getCatalog().getResourcePool().clear(ft.getStore()); setResponsePage(new ResourceConfigurationPage(_layerInfo, _isNew)); } } }); if (fti.getId() == null) { modal.add(new OpenWindowOnLoadBehavior()); } modal.setContent(new SolrConfigurationPage(panelId, model) { @Override void done(AjaxRequestTarget target, ResourceInfo resource) { ResourceConfigurationPage page = (ResourceConfigurationPage) SolrConfigurationPanel.this.getPage(); page.updateResource(resource, target); modal.close(target); } }); add(modal); AjaxLink findLink = new AjaxLink("edit") { @Override public void onClick(AjaxRequestTarget target) { modal.show(target); } }; final Fragment attributePanel = new Fragment("solrPanel", "solrPanelFragment", this); attributePanel.setOutputMarkupId(true); add(attributePanel); attributePanel.add(findLink); }
From source file:org.geoserver.web.data.layergroup.RootLayerEntryPanel.java
License:Open Source License
@SuppressWarnings({ "rawtypes" }) public RootLayerEntryPanel(String id, final Form form, WorkspaceInfo workspace) { super(id);/*from w w w.jav a 2 s . com*/ setOutputMarkupId(true); final TextField<LayerInfo> rootLayerField = new TextField<LayerInfo>("rootLayer") { @Override public IConverter getConverter(Class<?> type) { return form.getConverter(type); } }; rootLayerField.setOutputMarkupId(true); rootLayerField.setRequired(true); add(rootLayerField); // global styles List<StyleInfo> globalStyles = new ArrayList<StyleInfo>(); List<StyleInfo> allStyles = GeoServerApplication.get().getCatalog().getStyles(); for (StyleInfo s : allStyles) { if (s.getWorkspace() == null) { globalStyles.add(s); } } // available styles List<StyleInfo> styles = new ArrayList<StyleInfo>(); styles.addAll(globalStyles); if (workspace != null) { styles.addAll(GeoServerApplication.get().getCatalog().getStylesByWorkspace(workspace)); } DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("rootLayerStyle", styles) { @Override public IConverter getConverter(Class<?> type) { return form.getConverter(type); } }; styleField.setNullValid(true); add(styleField); final ModalWindow popupWindow = new ModalWindow("popup"); add(popupWindow); add(new AjaxLink("add") { @Override public void onClick(AjaxRequestTarget target) { popupWindow.setInitialHeight(375); popupWindow.setInitialWidth(525); popupWindow.setTitle(new ParamResourceModel("chooseLayer", this)); popupWindow.setContent(new LayerListPanel(popupWindow.getContentId()) { @Override protected void handleLayer(LayerInfo layer, AjaxRequestTarget target) { popupWindow.close(target); ((LayerGroupInfo) form.getModelObject()).setRootLayer(layer); target.addComponent(rootLayerField); } }); popupWindow.show(target); } }); }
From source file:org.geoserver.wms.web.data.LayerAttributePanel.java
License:Open Source License
public LayerAttributePanel(String id, AbstractStylePage parent) throws IOException { super(id, parent); //Change layer link PropertyModel<String> layerNameModel = new PropertyModel<String>(parent.getLayerModel(), "prefixedName"); add(new SimpleAjaxLink<String>("changeLayer", layerNameModel) { private static final long serialVersionUID = 7341058018479354596L; public void onClick(AjaxRequestTarget target) { ModalWindow popup = parent.getPopup(); popup.setInitialHeight(400); popup.setInitialWidth(600); popup.setTitle(new Model<String>("Choose layer to edit")); popup.setContent(new LayerChooser(popup.getContentId(), parent)); popup.show(target);/*from w w w . j a v a 2 s . c o m*/ } }); this.setDefaultModel(parent.getLayerModel()); updateAttributePanel(); }
From source file:org.geoserver.wms.web.data.OpenLayersPreviewPanel.java
License:Open Source License
public OpenLayersPreviewPanel(String id, AbstractStylePage parent) { super(id, parent); this.olPreview = new WebMarkupContainer("olPreview").setOutputMarkupId(true); // Change layer link PropertyModel<String> layerNameModel = new PropertyModel<String>(parent.getLayerModel(), "prefixedName"); add(new SimpleAjaxLink<String>("change.layer", layerNameModel) { private static final long serialVersionUID = 7341058018479354596L; public void onClick(AjaxRequestTarget target) { ModalWindow popup = parent.getPopup(); popup.setInitialHeight(400); popup.setInitialWidth(600); popup.setTitle(new Model<String>("Choose layer to edit")); popup.setContent(new LayerChooser(popup.getContentId(), parent)); popup.show(target);// w ww.j av a 2 s .c o m } }); add(olPreview); setOutputMarkupId(true); try { ensureLegendDecoration(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to put legend layout file in the data directory, the legend decoration will not appear", e); } }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.QuestionCategoryOpenAnswerDefinitionPanel.java
License:Open Source License
private ModalWindow createPadModalWindow(String padId) { ModalWindow newPadWindow = new ModalWindow(padId); DataType type = getOpenAnswerDefinition().getDataType(); if (type.equals(DataType.INTEGER) || type.equals(DataType.DECIMAL)) { pad = new NumericPad(newPadWindow.getContentId(), getQuestionModel(), getQuestionCategoryModel(), getOpenAnswerDefinitionModel()) { /**//from w w w . ja v a 2 s .c om * */ private static final long serialVersionUID = 1L; @Override public boolean isRequired() { // is never required because in a array the pad allows deselecting the category when setting a null value return false; } }; newPadWindow.setTitle(new StringResourceModel("NumericPadTitle", pad, null)); newPadWindow.setContent(pad); newPadWindow.setCssClassName("onyx"); newPadWindow.setInitialWidth(288); newPadWindow.setInitialHeight(365); newPadWindow.setResizable(false); // same as cancel newPadWindow.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { private static final long serialVersionUID = 1L; public boolean onCloseButtonClicked(AjaxRequestTarget target) { return true; } }); return newPadWindow; } throw new UnsupportedOperationException("Pad for type " + type + " not supported yet."); }
From source file:org.obiba.onyx.webapp.participant.page.InterviewPage.java
License:Open Source License
public InterviewPage() { super();//from www .j av a 2 s. c om if (activeInterviewService.getParticipant() == null || activeInterviewService.getInterview() == null) { setResponsePage(WebApplication.get().getHomePage()); } else { addOrReplace(new EmptyPanel("header")); // // Modify menu bar. // remove("menuBar"); add(new InterviewMenuBar("menuBar")); final InterviewLogPanel interviewLogPanel; final Dialog interviewLogsDialog; interviewLogPanel = new InterviewLogPanel("content", 338, new LoadableInterviewLogModel()); interviewLogsDialog = DialogBuilder .buildDialog("interviewLogsDialog", new StringResourceModel("Log", this, null), interviewLogPanel) .setOptions(Option.CLOSE_OPTION).setFormCssClass("interview-log-dialog-form").getDialog(); interviewLogsDialog.setHeightUnit("em"); interviewLogsDialog.setWidthUnit("em"); interviewLogsDialog.setInitialHeight(34); interviewLogsDialog.setInitialWidth(59); interviewLogsDialog.setCloseButtonCallback(new CloseButtonCallback() { private static final long serialVersionUID = 1L; public boolean onCloseButtonClicked(AjaxRequestTarget target, Status status) { // Update comment count on interview page once the modal window closes. User may have added comments. updateCommentCount(target); return true; } }); interviewLogPanel.setup(interviewLogsDialog); interviewLogPanel.add(new AttributeModifier("class", true, new Model("interview-log-panel-content"))); interviewLogPanel.setMarkupId("interviewLogPanel"); interviewLogPanel.setOutputMarkupId(true); add(interviewLogsDialog); Participant participant = activeInterviewService.getParticipant(); add(new ParticipantPanel("participant", new DetachableEntityModel(queryService, participant), true)); // Create modal comments window final ModalWindow commentsWindow; add(commentsWindow = new ModalWindow("addCommentsModal")); commentsWindow.setCssClassName("onyx"); commentsWindow.setTitle(new StringResourceModel("CommentsWindow", this, null)); commentsWindow.setHeightUnit("em"); commentsWindow.setWidthUnit("em"); commentsWindow.setInitialHeight(34); commentsWindow.setInitialWidth(50); commentsWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget target) { } }); ViewInterviewLogsLink viewCommentsIconLink = createIconLink("viewCommentsIconLink", interviewLogsDialog, interviewLogPanel, true); add(viewCommentsIconLink); ContextImage commentIcon = createContextImage("commentIcon", "icons/note.png"); viewCommentsIconLink.add(commentIcon); ViewInterviewLogsLink viewLogIconLink = createIconLink("viewLogIconLink", interviewLogsDialog, interviewLogPanel, false); add(viewLogIconLink); ContextImage logIcon = createContextImage("logIcon", "icons/loupe_button.png"); viewLogIconLink.add(logIcon); // Add view interview comments action add(viewComments = new ViewInterviewLogsLink("viewComments", interviewLogsDialog, interviewLogPanel, true) { private static final long serialVersionUID = -5561038138085317724L; @Override public void onClick(AjaxRequestTarget target) { interviewLogPanel.setCommentsOnly(true); // Disable Show All Button target.appendJavascript( "$('[name=showAll]').attr('disabled','true');$('[name=showAll]').css('color','rgba(0, 0, 0, 0.2)');$('[name=showAll]').css('border-color','rgba(0, 0, 0, 0.2)');"); super.onClick(target); } }); add(new ViewInterviewLogsLink("viewLog", interviewLogsDialog, interviewLogPanel, false) { private static final long serialVersionUID = -5561038138085317724L; @Override public void onClick(AjaxRequestTarget target) { interviewLogPanel.setCommentsOnly(false); // Disable Show All Button target.appendJavascript( "$('[name=showAll]').attr('disabled','true');$('[name=showAll]').css('color','rgba(0, 0, 0, 0.2)');$('[name=showAll]').css('border-color','rgba(0, 0, 0, 0.2)');"); super.onClick(target); } }); // Add create interview comments action add(addCommentDialog = createAddCommentDialog()); add(new AjaxLink("addComment") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { addCommentDialog.show(target); } }); // Initialize comments counter updateCommentsCount(); ActiveInterviewModel interviewModel = new ActiveInterviewModel(); kvPanel = new KeyValueDataPanel("interview"); kvPanel.addRow(new StringResourceModel("StartDate", this, null), new PropertyModel(interviewModel, "startDate")); kvPanel.addRow(new StringResourceModel("EndDate", this, null), new PropertyModel(interviewModel, "endDate")); kvPanel.addRow(new StringResourceModel("Status", this, null), new PropertyModel(interviewModel, "status")); add(kvPanel); // Interview cancellation final ActionDefinition cancelInterviewDef = actionDefinitionConfiguration .getActionDefinition(ActionType.STOP, "Interview", null, null); final ActionWindow interviewActionWindow = new ActionWindow("modal") { private static final long serialVersionUID = 1L; @Override public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) { activeInterviewService.setStatus(InterviewStatus.CANCELLED); setResponsePage(InterviewPage.class); } }; add(interviewActionWindow); AjaxLink link = new AjaxLink("cancelInterview") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { Label label = new Label("content", new StringResourceModel("ConfirmCancellationOfInterview", InterviewPage.this, null)); label.add(new AttributeModifier("class", true, new Model("confirmation-dialog-content"))); ConfirmationDialog confirmationDialog = getConfirmationDialog(); confirmationDialog.setContent(label); confirmationDialog .setTitle(new StringResourceModel("ConfirmCancellationOfInterviewTitle", this, null)); confirmationDialog.setYesButtonCallback(new OnYesCallback() { private static final long serialVersionUID = -6691702933562884991L; public void onYesButtonClicked(AjaxRequestTarget target) { interviewActionWindow.show(target, null, cancelInterviewDef); } }); confirmationDialog.show(target); } @Override public boolean isVisible() { InterviewStatus status = activeInterviewService.getInterview().getStatus(); return (status == InterviewStatus.IN_PROGRESS || status == InterviewStatus.COMPLETED); } }; MetaDataRoleAuthorizationStrategy.authorize(link, RENDER, "PARTICIPANT_MANAGER"); add(link); // Interview closing final ActionDefinition closeInterviewDef = actionDefinitionConfiguration .getActionDefinition(ActionType.STOP, "Closed.Interview", null, null); final ActionWindow closeInterviewActionWindow = new ActionWindow("closeModal") { private static final long serialVersionUID = 1L; @Override public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) { activeInterviewService.setStatus(InterviewStatus.CLOSED); setResponsePage(InterviewPage.class); } }; add(closeInterviewActionWindow); AjaxLink closeLink = new AjaxLink("closeInterview") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { Label label = new Label("content", new StringResourceModel("ConfirmClosingOfInterview", InterviewPage.this, null)); label.add(new AttributeModifier("class", true, new Model("confirmation-dialog-content"))); ConfirmationDialog confirmationDialog = getConfirmationDialog(); confirmationDialog.setContent(label); confirmationDialog .setTitle(new StringResourceModel("ConfirmClosingOfInterviewTitle", this, null)); confirmationDialog.setYesButtonCallback(new OnYesCallback() { private static final long serialVersionUID = -6691702933562884991L; public void onYesButtonClicked(AjaxRequestTarget target) { closeInterviewActionWindow.show(target, null, closeInterviewDef); } }); confirmationDialog.show(target); } @Override public boolean isVisible() { InterviewStatus status = activeInterviewService.getInterview().getStatus(); return (status == InterviewStatus.IN_PROGRESS); } }; MetaDataRoleAuthorizationStrategy.authorize(link, RENDER, "PARTICIPANT_MANAGER"); add(closeLink); // Reinstate interview link add(createReinstateInterviewLink()); // Print report link class ReportLink extends AjaxLink { private static final long serialVersionUID = 1L; public ReportLink(String id) { super(id); } @Override public void onClick(AjaxRequestTarget target) { getPrintableReportsDialog().show(target); } } ReportLink printReportLink = new ReportLink("printReport"); printReportLink.add(new Label("reportLabel", new ResourceModel("PrintReport"))); add(printReportLink); add(new StageSelectionPanel("stage-list", getFeedbackWindow()) { private static final long serialVersionUID = 1L; @Override public void onViewComments(AjaxRequestTarget target, String stage) { commentsWindow.setContent(new CommentsModalPanel("content", commentsWindow, stage) { private static final long serialVersionUID = 1L; @Override public void onAddComments(AjaxRequestTarget target) { InterviewPage.this.updateCommentsCount(); target.addComponent(InterviewPage.this.commentsCount); } }); commentsWindow.show(target); } @Override public void onViewLogs(AjaxRequestTarget target, String stage, boolean commentsOnly) { interviewLogPanel.setStageName(stage); interviewLogPanel.setCommentsOnly(commentsOnly); interviewLogPanel.setReadOnly(true); interviewLogPanel.addInterviewLogComponent(); interviewLogsDialog.show(target); } @Override public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) { if (activeInterviewService.getStageExecution(action.getStage()).isFinal()) { setResponsePage(InterviewPage.class); } else { InterviewPage.this.updateCommentsCount(); target.addComponent(InterviewPage.this.commentsCount); } } }); AjaxLink exitLink = new AjaxLink("exitInterview") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { interviewManager.releaseInterview(); setResponsePage(HomePage.class); } }; add(exitLink); } }
From source file:org.onexus.ui.api.utils.panels.HelpMark.java
License:Apache License
public HelpMark(final String panelId, final String title, final String displayLabel, final String helpText) { super(panelId); // Add modal window final ModalWindow modal = new ModalWindow("modalWindowEmbeeded"); modal.setTitle(title);/* ww w . ja v a2 s .c o m*/ modal.setInitialWidth(700); modal.setInitialHeight(500); add(modal); // Add mark label final WebMarkupContainer container = new WebMarkupContainer("displayLabel"); container.add(new Label("label", displayLabel)); add(container); // Add question mark icon Image img = null; container.add(img = new Image("imageHelp", Icons.HELP) { @Override protected boolean shouldAddAntiCacheParameter() { return false; } }); img.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(final AjaxRequestTarget target) { if (modal != null) { modal.setInitialWidth(700); modal.setInitialHeight(500); modal.setContent(new HelpContentPanel(modal.getContentId(), helpText)); modal.show(target); } } }); // Visible only if there is some setVisible(helpText != null); }