List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setUseInitialHeight
public ModalWindow setUseInitialHeight(final boolean useInitialHeight)
From source file:ro.nextreports.server.web.dashboard.WidgetPopupMenuModel.java
License:Apache License
private AjaxLink createMoveLink(final IModel<Widget> model) { AjaxLink<Void> moveLink = new AjaxLink<Void>(MenuPanel.LINK_ID) { @Override/*ww w.ja va2s . co m*/ public void onClick(AjaxRequestTarget target) { final Widget widget = model.getObject(); ModalWindow dialog = findParent(BasePage.class).getDialog(); dialog.setTitle(new StringResourceModel("WidgetPopupMenu.copyMoveWidget", null).getString()); dialog.setInitialWidth(300); dialog.setUseInitialHeight(false); final Component component = this; dialog.setContent(new SelectDashboardPanel(dialog.getContentId()) { private static final long serialVersionUID = 1L; @Override public void onAction(String toDashboardId, boolean move, AjaxRequestTarget target) { try { int column = dashboardService.getWidgetColumn(widget.getId()); if (move) { dashboardService.moveWidget(DashboardUtil.getSelectedDashboardId(), toDashboardId, widget.getId()); DashboardColumnPanel columnPanel = component.findParent(DashboardPanel.class) .getColumnPanel(column); target.add(component.findParent(DashboardColumnPanel.class)); target.add(columnPanel); } else { dashboardService.copyWidget(DashboardUtil.getSelectedDashboardId(), toDashboardId, widget.getId()); } } catch (NotFoundException e) { e.printStackTrace(); // should never happen } finally { ModalWindow.closeCurrent(target); } } @Override public void onCancel(AjaxRequestTarget target) { ModalWindow.closeCurrent(target); } }); dialog.show(target); } @Override public boolean isVisible() { return hasWritePermission(model.getObject()); } }; return moveLink; }
From source file:ro.nextreports.server.web.pivot.PivotAreaPanel.java
License:Apache License
public PivotAreaPanel(String id, PivotField.Area area) { super(id);//from w w w . ja va 2 s . c o m 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", "label-info")); // } 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); }