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.syncope.console.pages.Users.java
License:Apache License
public Users(final PageParameters parameters) { super(parameters); // Modal window for editing user attributes final ModalWindow editModalWin = new ModalWindow("editModal"); editModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editModalWin.setInitialHeight(EDIT_MODAL_WIN_HEIGHT); editModalWin.setInitialWidth(EDIT_MODAL_WIN_WIDTH); editModalWin.setCookieName("edit-modal"); add(editModalWin);/*from ww w .j a v a 2s. co m*/ final ResultSetPanel searchResult = new ResultSetPanel("searchResult", true, null, getPageReference()); add(searchResult); final ResultSetPanel listResult = new ResultSetPanel("listResult", false, null, getPageReference()); add(listResult); // create new user final AjaxLink createLink = new IndicatingAjaxLink("createLink") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { editModalWin.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = -7834632442532690940L; @Override public Page createPage() { return new EditUserModalPage(Users.this.getPageReference(), editModalWin, new UserTO()); } }); editModalWin.show(target); } }; MetaDataRoleAuthorizationStrategy.authorize(createLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "create")); add(createLink); setWindowClosedReloadCallback(editModalWin); final Form searchForm = new Form("searchForm"); add(searchForm); final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel"); searchForm.add(searchPanel); searchForm.add(new IndicatingAjaxButton("search", new ResourceModel("search")) { private static final long serialVersionUID = -958724007591692537L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { final NodeCond searchCond = searchPanel.buildSearchCond(); LOG.debug("Node condition " + searchCond); doSearch(target, searchCond, searchResult); Session.get().getFeedbackMessages().clear(); target.add(searchPanel.getSearchFeedback()); } @Override protected void onError(final AjaxRequestTarget target, final Form form) { target.add(searchPanel.getSearchFeedback()); } }); }
From source file:org.ujorm.hotels.gui.booking.BookingEditor.java
License:Apache License
/** Create the editor dialog */ public static BookingEditor create(String componentId, int width, int height) { IModel<Booking> model = Model.of(new Booking()); final ModalWindow modalWindow = new ModalWindow(componentId, model); modalWindow.setCssClassName(ModalWindow.CSS_CLASS_BLUE); final BookingEditor result = new BookingEditor(modalWindow, model); modalWindow.setInitialWidth(width); modalWindow.setInitialHeight(height); modalWindow.setTitle(new LocalizedModel("dialog.booking.title")); //modalWindow.setCookieName("modal-dialog"); return result; }
From source file:org.ujorm.hotels.gui.customer.CustomerEditor.java
License:Apache License
/** Create the editor dialog */ public static CustomerEditor create(String componentId, int width, int height) { IModel<Customer> model = Model.of(new Customer()); final ModalWindow modalWindow = new ModalWindow(componentId, model); modalWindow.setCssClassName(ModalWindow.CSS_CLASS_BLUE); final CustomerEditor result = new CustomerEditor(modalWindow, model); modalWindow.setInitialWidth(width); modalWindow.setInitialHeight(height); modalWindow.setTitle(new LocalizedModel("dialog.edit.title")); //modalWindow.setCookieName("modal-dialog"); return result; }
From source file:org.ujorm.hotels.gui.customer.LoginDialog.java
License:Apache License
/** Create the editor dialog */ public static LoginDialog create(String componentId, int width, int height) { IModel<Customer> model = Model.of(new Customer()); final ModalWindow modalWindow = new ModalWindow(componentId, model); modalWindow.setCssClassName(ModalWindow.CSS_CLASS_BLUE); final LoginDialog result = new LoginDialog(modalWindow, model); modalWindow.setInitialWidth(width); modalWindow.setInitialHeight(height); modalWindow.setTitle(new LocalizedModel("dialog.login.title")); //modalWindow.setCookieName("modal-dialog"); return result; }
From source file:org.ujorm.hotels.gui.hotel.HotelEditor.java
License:Apache License
/** Create the editor dialog */ public static HotelEditor create(String componentId, int width, int height) { IModel<Hotel> model = Model.of(new Hotel()); final ModalWindow modalWindow = new ModalWindow(componentId, model); modalWindow.setCssClassName(ModalWindow.CSS_CLASS_BLUE); final HotelEditor result = new HotelEditor(modalWindow, model); modalWindow.setInitialWidth(width); modalWindow.setInitialHeight(height); modalWindow.setTitle(new LocalizedModel("dialog.edit.title")); //modalWindow.setCookieName("modal-dialog"); return result; }
From source file:org.ujorm.wicket.component.dialog.domestic.MessageDialogPane.java
License:Apache License
/** Create the default message dialog */ public static MessageDialogPane create(String componentId, int width, int height) { IModel<String> model = Model.of(""); final ModalWindow modalWindow = new ModalWindow(componentId, model); modalWindow.setCssClassName(ModalWindow.CSS_CLASS_BLUE); final MessageDialogPane result = new MessageDialogPane(modalWindow, model); modalWindow.setInitialWidth(width); modalWindow.setInitialHeight(height); //modalWindow.setCookieName("modal-dialog"); return result; }
From source file:org.webical.web.pages.ErrorPage.java
License:Open Source License
public void setupNonAccessibleComponents() { //ModelDialog for the detailmessage final ModalWindow modalWindow = new ModalWindow(DETAILED_ERROR_PANEL_ID); //The detailed message final String detailedMessage = getDetailedMessage(); //Link to show the details IndicatingAjaxLink showDetailsLink = new IndicatingAjaxLink(SHOW_DETAILS_LINK_MARKUP_ID) { private static final long serialVersionUID = 1L; @Override/* w w w. j a v a 2s .com*/ public void onClick(AjaxRequestTarget ajaxRequestTarget) { modalWindow.setContent(new DetailPanel(modalWindow.getContentId(), new Model(detailedMessage))); modalWindow.setVisible(true); modalWindow.show(ajaxRequestTarget); } }; if (detailedMessage == null) { showDetailsLink.setEnabled(false); } else { modalWindow.setInitialWidth(700); modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget ajaxRequestTarget) { modalWindow.setContent(new Label(modalWindow.getContentId(), new Model(""))); modalWindow.setVisible(false); ajaxRequestTarget.addComponent(modalWindow); getSession().createAutoPageMap(); } }); } //Add components addOrReplace(modalWindow); addOrReplace(showDetailsLink); }
From source file:ro.nextreports.server.web.core.HeaderPanel.java
License:Apache License
public HeaderPanel(String id) { super(id);//from ww w . j av a2s. c o m final WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer"); imageContainer.setOutputMarkupPlaceholderTag(true); imageContainer.add(new Image("logoImage", new LogoResource())); add(imageContainer); add(new Label("currentUser", NextServerSession.get().getUsername())); add(new Label("realName", NextServerSession.get().getRealName())); final ModalWindow dialog = new ModalWindow("modal"); add(dialog); Link<String> logoutLink = new Link<String>("logout") { private static final long serialVersionUID = 1L; @Override public void onClick() { NextServerSession.get().signOut(); if (CasUtil.isCasUsed()) { setResponsePage(new RedirectPage(CasUtil.getLogoutUrl())); } else { setResponsePage(getApplication().getHomePage()); } } }; add(logoutLink); AjaxLink<String> changePassword = new AjaxLink<String>("changePassord") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { dialog.setTitle(getString("ChangePassword.change")); dialog.setInitialWidth(350); dialog.setUseInitialHeight(false); dialog.setContent(new ChangePasswordPanel(dialog.getContentId()) { private static final long serialVersionUID = 1L; @Override public void onChange(AjaxRequestTarget target) { ModalWindow.closeCurrent(target); try { User loggedUser = securityService.getUserByName(NextServerSession.get().getUsername()); loggedUser.setPassword(passwordEncoder.encodePassword(confirmPassword, null)); storageService.modifyEntity(loggedUser); } catch (Exception e) { e.printStackTrace(); add(new AlertBehavior(e.getMessage())); target.add(this); } } @Override public void onCancel(AjaxRequestTarget target) { ModalWindow.closeCurrent(target); } }); dialog.show(target); } }; add(changePassword); if (NextServerSession.get().isDemo()) { changePassword.setEnabled(false); } }
From source file:ro.nextreports.server.web.core.migration.ExportPanel.java
License:Apache License
@SuppressWarnings("unchecked") public ExportPanel(String id) { super(id);/* w w w . jav a 2s.c o m*/ final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); Form<Void> exportForm = new Form<Void>("exportForm"); add(exportForm); final Model<ArrayList<String>> choiceModel = new Model<ArrayList<String>>(); final ListMultipleChoice listChoice = new ListMultipleChoice("listChoice", choiceModel, new PropertyModel<String>(this, "list")); listChoice.setMaxRows(10); listChoice.setOutputMarkupId(true); exportForm.add(listChoice); AjaxLink addLink = new AjaxLink<Void>("addElement") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { ModalWindow dialog = findParent(BasePage.class).getDialog(); dialog.setTitle(getString("Settings.migration.export.entity.add")); dialog.setInitialWidth(350); dialog.setUseInitialHeight(false); AddEntityPanel addEntityPanel = new AddEntityPanel() { private static final long serialVersionUID = 1L; @Override public void onOk(AjaxRequestTarget target) { Iterator<Entity> entities = getEntities(); if (!entities.hasNext()) { error(getString("Settings.migration.export.entity.select")); target.add(getFeedbackPanel()); return; } while (entities.hasNext()) { Entity entity = entities.next(); String path = entity.getPath(); path = path.substring(StorageConstants.NEXT_SERVER_ROOT.length() + 1); if (!list.contains(path)) { list.add(path); } } ModalWindow.closeCurrent(target); target.add(listChoice); } }; dialog.setContent(new FormPanel<Void>(dialog.getContentId(), addEntityPanel, true) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); setOkButtonValue(getString("add")); } }); dialog.show(target); } }; addLink.add(new SimpleTooltipBehavior(getString("Settings.migration.export.entity.add"))); exportForm.add(addLink); AjaxSubmitLink removeLink = new AjaxSubmitLink("removeElement", exportForm) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { for (String sel : choiceModel.getObject()) { for (Iterator<?> it = list.iterator(); it.hasNext();) { if (sel.equals(it.next())) { it.remove(); } } } if (target != null) { target.add(listChoice); } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(form); } }; removeLink.add(new SimpleTooltipBehavior(getString("Settings.migration.export.entity.remove"))); exportForm.add(removeLink); TextField<String> exportField = new TextField<String>("exportPath", new PropertyModel<String>(this, "exportPath")); exportField.setLabel(new Model<String>(getString("Settings.migration.export.path"))); exportForm.add(exportField); exportForm.add(new AjaxSubmitLink("export") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // we do not use TextField validation with setRequired because we have a submit button (remove entity) // which must work without validation if ((exportPath == null) || "".endsWith(exportPath.trim())) { error(getString("Settings.migration.export.path.select")); target.add(feedbackPanel); return; } NextServerApplication.setMaintenance(true); MigrationObject mo = new MigrationObject(); List<DataSource> dsList = new ArrayList<DataSource>(); List<Report> reportList = new ArrayList<Report>(); List<Chart> chartList = new ArrayList<Chart>(); List<DashboardState> dashboards = new ArrayList<DashboardState>(); mo.setDataSources(dsList); mo.setReports(reportList); mo.setCharts(chartList); mo.setDashboards(dashboards); FileOutputStream fos = null; try { if (list.size() == 0) { error(getString("Settings.migration.export.entity.select")); } else { for (String pathM : list) { populateLists(pathM, mo); } XStream xstream = new XStream(new DomDriver()); SimpleDateFormat sdf = new SimpleDateFormat("dd_MM_yyyy_hh_mm"); fos = new FileOutputStream( exportPath + File.separator + "migration-" + sdf.format(new Date()) + ".xml"); xstream.toXML(mo, fos); info(getString("Settings.migration.export.info")); } } catch (Throwable t) { error(t.getMessage()); } finally { NextServerApplication.setMaintenance(false); if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } target.add(feedbackPanel); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(feedbackPanel); } }); }
From source file:ro.nextreports.server.web.dashboard.DashboardNavigationPanel.java
License:Apache License
private void addToolbar() { ContextImage dashboardImage = new ContextImage("dashboardImage", "images/dashboard_add.png"); dashboardImage.add(new WiQueryAjaxEventBehavior(MouseEvent.CLICK) { private static final long serialVersionUID = 1L; @Override//from www. j av a 2 s . co m protected void onEvent(AjaxRequestTarget target) { ModalWindow dialog = findParent(BasePage.class).getDialog(); dialog.setTitle(getString("DashboardStatistics.title")); dialog.setInitialWidth(300); dialog.setUseInitialHeight(false); dialog.setContent(new DashboardStatisticsPanel(dialog.getContentId())); dialog.show(target); } @Override public JsStatement statement() { return null; } }); dashboardImage.add(new SimpleTooltipBehavior(getString("DashboardStatistics.title"))); add(dashboardImage); add(new AjaxLink<Void>("addDashboard") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { ModalWindow dialog = findParent(BasePage.class).getDialog(); dialog.setTitle(getString("DashboardNavigationPanel.add")); dialog.setInitialWidth(350); dialog.setUseInitialHeight(false); final AddDashboardPanel addDashboardPanel = new AddDashboardPanel(dialog.getContentId()) { private static final long serialVersionUID = 1L; @Override public void onAdd(AjaxRequestTarget target) { ModalWindow.closeCurrent(target); String id; String title = getTitle(); Dashboard dashboard = new DefaultDashboard(title, getColumnCount()); id = dashboardService.addDashboard(dashboard); SectionContext sectionContext = NextServerSession.get() .getSectionContext(DashboardSection.ID); sectionContext.getData().put(SectionContextConstants.SELECTED_DASHBOARD_ID, id); target.add(DashboardNavigationPanel.this.findParent(DashboardBrowserPanel.class)); } @Override public void onCancel(AjaxRequestTarget target) { ModalWindow.closeCurrent(target); } }; dialog.setContent(addDashboardPanel); dialog.show(target); } }); }