Java Code Examples for org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow#setTitle()

The following examples show how to use org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnhideWidgetCommand.java    From Orienteer with Apache License 2.0 7 votes vote down vote up
@Override
protected void initializeContent(final ModalWindow modal) {
	modal.setTitle(new ResourceModel("command.unhide"));
	modal.setContent(new UnhideWidgetDialog<T>(modal.getContentId()) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onSelectWidget(AbstractWidget<T> widget,
				Optional<AjaxRequestTarget> targetOptional) {
			targetOptional.ifPresent(modal::close);
			widget.setHidden(false);
			DashboardPanel<T> dashboard = getDashboardPanel();
			targetOptional.ifPresent(target -> dashboard.getDashboardSupport().ajaxAddWidget(widget, target));
		}
	});
	modal.setAutoSize(true);
	modal.setMinimalWidth(300);
}
 
Example 2
Source File: AddOArtifactCommand.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void initializeContent(ModalWindow modal) {
    modal.setOutputMarkupPlaceholderTag(true);
    modal.setTitle(new ResourceModel(MODAL_WINDOW_TITLE));

    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override
        public Page createPage() {
            return modalWindowPage;
        }
    });

    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        @Override
        public void onClose(AjaxRequestTarget target) {
            target.add(table);
        }
    });

    modal.setAutoSize(true);
    modal.setMinimalWidth(800);
    modal.setMinimalHeight(600);
    modalWindowPage.setModalWindow(modal);
}
 
Example 3
Source File: AddTabCommand.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeContent(final ModalWindow modal) {
	modal.setTitle(new ResourceModel("command.add.tab"));
	modal.setContent(new AddTabDialog<T>(modal.getContentId()) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onCreateTab(String name, Optional<AjaxRequestTarget> targetOptional) {
			targetOptional.ifPresent(modal::close);
			if(Strings.isEmpty(name)) {
				name = getLocalizer().getString("command.add.tab.modal.defaultname", null);
			}
			
			AbstractWidgetPage<T> page = (AbstractWidgetPage<T>)findPage();
			page.getCurrentDashboard().setModeObject(DisplayMode.VIEW); //Close action on current tab
			page.addTab(name);
			page.selectTab(name, targetOptional);
			send(page, Broadcast.DEPTH, new SwitchDashboardTabEvent(targetOptional));
			page.getCurrentDashboard().setModeObject(DisplayMode.EDIT); //Open action on new tab
			targetOptional.ifPresent(target -> target.add(page.getCurrentDashboardComponent()));
		}
	});
	modal.setAutoSize(true);
	modal.setMinimalWidth(300);
}
 
Example 4
Source File: AddWidgetCommand.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeContent(final ModalWindow modal) {
	modal.setTitle(new ResourceModel("command.add.widget"));
	modal.setContent(new AddWidgetDialog<T>(modal.getContentId()) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onSelectWidgetType(IWidgetType<T> type,
				Optional<AjaxRequestTarget> targetOptional) {
			targetOptional.ifPresent(modal::close);
			DashboardPanel<T> dashboard = getDashboardPanel();
			AbstractWidget<T> widget = dashboard.addWidget(type);
			targetOptional.ifPresent(target-> dashboard.getDashboardSupport().ajaxAddWidget(widget, target));
		}
	});
	modal.setAutoSize(true);
	modal.setMinimalWidth(300);
}
 
Example 5
Source File: WidgetPopupMenuModel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private AjaxLink createEmbedCodeLink(final IModel<Widget> model) {
	AjaxLink<Void> link = new AjaxLink<Void>(MenuPanel.LINK_ID) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			final Widget widget = model.getObject();
			ModalWindow dialog = findParent(BasePage.class).getDialog();

			dialog.setTitle(new StringResourceModel("WidgetPopupMenu.embeddedCode", null).getString());
			dialog.setInitialWidth(550);
			dialog.setUseInitialHeight(false);

			dialog.setContent(new WidgetEmbedCodePanel(dialog.getContentId(), widget.getId()));
			dialog.show(target);
		}
	};
	return link;
}
 
Example 6
Source File: LinkToSocialNetwork.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Command<?> createCommand(String id) {
    IModel<ODocument> model = (IModel<ODocument>) getContext().getDisplayObjectModel();
    IModel<OrienteerUser> userModel = new ODocumentWrapperModel<>(new OrienteerUser(model.getObject()));

    return new AbstractModalWindowCommand<OrienteerUser>(id, getTitleModel(), userModel) {

        @Override
        protected void onInitialize() {
            super.onInitialize();
            applyVisualSettings(this);
            applyBehaviors(this);
        }

        @Override
        protected void onConfigure() {
            super.onConfigure();
            OrienteerUser user = getModelObject();

            setVisible(user.getSocialNetworks().size() < OAuth2Repository.getOAuth2Services().size());
        }

        @Override
        protected void initializeContent(ModalWindow modal) {
            modal.setTitle(getTitleModel());
            modal.setMinimalWidth(520);
            modal.setMinimalHeight(250);
            modal.setContent(new LinkToSocialNetworkPanel(modal.getContentId(), getModel()));
        }

        @Override
        public void onAfterModalSubmit() {
            sendActionPerformed();
        }

    };
}
 
Example 7
Source File: ImportOSchemaCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeContent(ModalWindow modal) {
	modal.setTitle(new ResourceModel("command.import.modal.title"));
	modal.setContent(new ImportDialogPanel(modal.getContentId(), modal) {

		@Override
		public void onImportFinished(AjaxRequestTarget target) {
			sendActionPerformed();
		}
		
	});
}
 
Example 8
Source File: CreateODocumentCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeContent(ModalWindow modal) {
	modal.setTitle(new ResourceModel("dialog.select.class"));
	modal.setAutoSize(true);
	modal.setMinimalWidth(300);
	modal.setContent(new SelectSubOClassDialogPage(modal, classModel) {
		
		@Override
		protected void onSelect(AjaxRequestTarget target, OClass selectedOClass) {
			redirectToCreateODocumentPage(target, selectedOClass);
		}
	});
}
 
Example 9
Source File: ViewUMLCommand.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeContent(ModalWindow modal) {
	modal.setTitle(new ResourceModel("command.viewUml.modal.title"));
	modal.setContent(new ViewUMLDialogPanel(modal.getContentId(), new PropertyModel<String>(this, "uml")));
	modal.setAutoSize(true);
	modal.setMinimalWidth(600);
	modal.setMinimalHeight(400);
}
 
Example 10
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(AjaxRequestTarget target) {
	ModalWindow dialog = findParent(BasePage.class).getDialog();
	dialog.setTitle(getString(title));
	dialog.setInitialWidth(dialogWidth);
	dialog.setUseInitialHeight(false);
	FormContentPanel<Analysis> panel = createPanel();
	FormPanel<Analysis> formPanel = new FormPanel<Analysis>(dialog.getContentId(), panel, true);
	formPanel.add(AttributeModifier.append("class", "analysisForm"));
	dialog.setContent(formPanel);
	dialog.show(target);
}
 
Example 11
Source File: EmbedCodeActionLink.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public void executeAction(AjaxRequestTarget target) {
	Entity entity = getActionContext().getEntity();
	ModalWindow dialog = findParent(BasePage.class).getDialog();

	dialog.setTitle(new StringResourceModel("WidgetPopupMenu.embeddedCode", null).getString());
	dialog.setInitialWidth(550);
	dialog.setUseInitialHeight(false);

	dialog.setContent(new DashboardEmbedCodePanel(dialog.getContentId(), entity.getId()));
	dialog.show(target);
}
 
Example 12
Source File: OpenModalWindowEvent.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(ModalWindow modalWindow) {
    modalWindow.setContent(contentGenerator.apply(modalWindow.getContentId()));
    modalWindow.setTitle(titleModel);
    modalWindow.show(target);
}
 
Example 13
Source File: PivotAreaPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public PivotAreaPanel(String id, PivotField.Area area) {
		super(id);

		this.area = area;
		
		add(new Label("name", getString("pivot." + area.getName()).toUpperCase()));

		final ModalWindow modal = new ModalWindow("modal");
		modal.setTitle(getString("pivot.aggregator"));		
		add(modal);
		
		WebMarkupContainer fieldsContainer = new WebMarkupContainer("fieldsContainer");
		fieldsContainer.setOutputMarkupId(true);
		fieldsContainer.setMarkupId("area-" + area.getName() + "-" + getSession().nextSequenceValue());
		add(fieldsContainer);
		
		values = new ListView<PivotField>("values") {

			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(ListItem<PivotField> item) {
				final IModel<PivotField> itemModel = item.getModel();
				PivotField pivotField = itemModel.getObject();
				String title = pivotField.getTitle();
				if (pivotField.getArea().equals(PivotField.Area.DATA)) {
					title += " (" + pivotField.getAggregator().getFunction().toUpperCase() + ")"; 
				}
				Label valueLabel = new Label("value", title);
				if (pivotField.isNumber()) {
					valueLabel.add(AttributeModifier.append("class", "aggregator"));
//				} else {
//					valueLabel.add(AttributeModifier.append("class", "label-important"));
				}
				if (item.getModelObject().getArea().equals(PivotField.Area.DATA)) {
					valueLabel.add(new AjaxEventBehavior("onclick") {
	
						private static final long serialVersionUID = 1L;
	
						protected void onEvent(AjaxRequestTarget target) {
							final AggregatorPanel panel = new AggregatorPanel(modal.getContentId(), itemModel);
							modal.setUseInitialHeight(false);
							modal.setInitialWidth(200);							
							modal.setContent(panel);							
							/*
							modal.setWindowClosedCallback(new WindowClosedCallback() {
								
								private static final long serialVersionUID = 1L;

								public void onClose(AjaxRequestTarget target) {
									if (panel.isOkPressed()) {
										System.out.println(">>> " + itemModel.getObject().getAggregator());
									}
								}
								
							});
							*/
							modal.show(target);
						}
						
					});
					valueLabel.add(AttributeModifier.append("style", "cursor: pointer;"));
				}
				item.add(valueLabel);				
				item.setOutputMarkupId(true);
				item.setMarkupId("field-" + pivotField.getIndex());
			}
		};
		values.setOutputMarkupPlaceholderTag(true);
		fieldsContainer.add(values);

		// add dnd support
//		addSortableBehavior();
		
		setOutputMarkupId(true);
	}
 
Example 14
Source File: InnerReportsPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private void click(InnerReport ir, AjaxRequestTarget target) {
	final ModalWindow dialog = findParent(BasePage.class).getDialog();
       dialog.setTitle(getString("Section.Audit.innerReports." + ir.toString()));
       int width = 500;                       
       
       FormContentPanel panel;
       if (ir.toString().equals(InnerReport.RIGHTS.toString())) {
		panel = new RightsPanel() {
			@Override
			public void onOk(AjaxRequestTarget target) {											
				TableData data = getResults(getAuditRights());					
				displayResults(dialog, InnerReport.RIGHTS.toString(), data, getLinkColumns(), getTitle(), target);
			}
		};
       } else if (ir.toString().equals(InnerReport.RUN.toString())) {
       		width = 350;
			panel = new RunPanel() {
				@Override
				public void onOk(AjaxRequestTarget target) {												
					TableData data = getResults(getAuditRun());							
					displayResults(dialog, InnerReport.RUN.toString(), data, getLinkColumns(), getTitle(), target);
				}
			};	
       } else if (ir.toString().equals(InnerReport.LIST.toString())) {
       	width = 250;
		panel = new ListPanel() {
			@Override
			public void onOk(AjaxRequestTarget target) {											
				TableData data = getResults(getAuditList());						
				displayResults(dialog, InnerReport.LIST.toString(), data, null, getTitle(), target);
			}
		};			
       } else {
       	panel = new FormContentPanel(FormPanel.CONTENT_ID);
       }
       dialog.setInitialWidth(width);
       dialog.setUseInitialHeight(false);
       dialog.setContent(new FormPanel(dialog.getContentId(), panel, true));        
       dialog.show(target);

}