Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setCssClassName

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setCssClassName

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setCssClassName.

Prototype

public ModalWindow setCssClassName(final String cssClassName) 

Source Link

Document

Sets the CSS class name for this window.

Usage

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private ModalWindow generateCreateGameModalWindow(final String id, final Player _player,
        final ModalWindow window) {
    window.setInitialWidth(475);/*from  w  ww .  jav a 2s  .com*/
    window.setInitialHeight(550);
    window.setTitle("Create a match");

    window.setContent(new CreateGameModalWindow(window, window.getContentId(), _player, this));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);

    this.createGameLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget _target) {
            _target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            window.show(_target);
        }
    };

    this.createGameLink.setOutputMarkupId(true).setMarkupId(id);
    this.createGameWindow.setOutputMarkupId(true);

    this.add(this.createGameLink);

    return window;
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private ModalWindow generateJoinGameModalWindow(final String id, final Player _player,
        final ModalWindow window) {
    window.setInitialWidth(475);// w w w  .j a  v a2 s  .  co m
    window.setInitialHeight(430);
    window.setTitle("Join a match");

    window.setContent(
            new JoinGameModalWindow(window, window.getContentId(), _player, this.dataBoxParent, this));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);

    this.joinGameLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget _target) {
            _target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            window.show(_target);
        }
    };

    this.joinGameLink.setOutputMarkupId(true).setMarkupId(id);
    window.setOutputMarkupId(true);

    this.add(this.joinGameLink);

    return window;
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private ModalWindow generateJoinGameWithoutIdModalWindow(final String id, final Player _player,
        final ModalWindow window) {
    window.setInitialWidth(475);//ww  w. jav  a  2  s . c o m
    window.setInitialHeight(500);
    window.setTitle("Join a match without ID");

    window.setContent(
            new JoinGameWithoutIdModalWindow(window, window.getContentId(), _player, this.dataBoxParent, this));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);

    this.joinGameWithoutIdLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget _target) {
            _target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            window.show(_target);
        }
    };

    this.joinGameWithoutIdLink.setOutputMarkupId(true).setMarkupId(id);
    window.setOutputMarkupId(true);

    this.add(this.joinGameWithoutIdLink);

    return window;
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generateRevealTopLibraryCardLink(final String id, final String idModalWindow) {
    final ModalWindow window = new ModalWindow(idModalWindow);
    window.setWindowClosedCallback(new WindowClosedCallback() {
        private static final long serialVersionUID = 1L;

        @Override//from   www . j  a  v  a2s . c om
        public void onClose(final AjaxRequestTarget target) {
            if (HomePage.this.session.getTopCardIndex() > 0L) {
                HomePage.this.session
                        .setTopCardIndex(Long.valueOf(HomePage.this.session.getTopCardIndex() - 1L));
            }

        }
    });
    window.setInitialWidth(500);
    window.setInitialHeight(510);

    final List<MagicCard> allCardsInLibrary = this.persistenceService.getAllCardsInLibraryForDeckAndPlayer(
            this.session.getGameId(), this.session.getPlayer().getId(),
            this.session.getPlayer().getDeck().getDeckId());
    final MagicCard firstCard;

    if (allCardsInLibrary.isEmpty()) {
        firstCard = null;
    } else {
        firstCard = allCardsInLibrary.get(this.session.getTopCardIndex().intValue());
    }

    window.setContent(new RevealTopLibraryCardModalWindow(window.getContentId(), window, firstCard));

    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setOutputMarkupId(true);

    this.revealTopLibraryCardWindow = window;
    this.add(this.revealTopLibraryCardWindow);

    final AjaxLink<Void> revealTopLibraryCardLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("boxing")
        @SuppressFBWarnings({ "PATH_TRAVERSAL_IN", "PATH_TRAVERSAL_IN" })
        @Override
        public void onClick(final AjaxRequestTarget target) {
            final List<MagicCard> _allCardsInLibrary = HomePage.this.persistenceService
                    .getAllCardsInLibraryForDeckAndPlayer(HomePage.this.session.getGameId(),
                            HomePage.this.session.getPlayer().getId(),
                            HomePage.this.session.getPlayer().getDeck().getDeckId());
            if (_allCardsInLibrary.isEmpty()) {
                return;
            }

            final MagicCard _firstCard = _allCardsInLibrary
                    .get(HomePage.this.session.getTopCardIndex().intValue());
            final String topCardName = _firstCard.getBigImageFilename();

            final String cardPath = ResourceBundle.getBundle(HatchetHarryApplication.class.getCanonicalName())
                    .getString("SharedResourceFolder");
            final String cardPathAndName = cardPath.replace("/cards", "") + topCardName;
            final File from = new File(cardPathAndName);
            final File to = new File(cardPath + "topLibraryCard.jpg");

            try {
                Files.copy(from, to);
            } catch (final IOException e) {
                HomePage.LOGGER.error(
                        "could not copy from: " + cardPathAndName + " to: " + cardPath + "topLibraryCard.jpg",
                        e);
            }

            final Long _gameId = HomePage.this.persistenceService
                    .getPlayer(HomePage.this.session.getPlayer().getId()).getGame().getId();
            final RevealTopLibraryCardCometChannel chan = new RevealTopLibraryCardCometChannel(
                    HomePage.this.session.getPlayer().getName(), _firstCard,
                    HomePage.this.session.getTopCardIndex());
            final ConsoleLogStrategy logger = AbstractConsoleLogStrategy.chooseStrategy(
                    ConsoleLogType.REVEAL_TOP_CARD_OF_LIBRARY, null, null, null, _firstCard.getTitle(),
                    HomePage.this.session.getPlayer().getName(), null,
                    HomePage.this.session.getTopCardIndex() + 1L, null, Boolean.FALSE, _gameId);
            final List<BigInteger> allPlayersInGame = HomePage.this.persistenceService
                    .giveAllPlayersFromGame(_gameId);

            EventBusPostService.post(allPlayersInGame, chan, new ConsoleLogCometChannel(logger));
        }
    };

    revealTopLibraryCardLink.setOutputMarkupId(true).setMarkupId(id);
    this.add(revealTopLibraryCardLink);
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generateCreateTokenLink(final String id, final ModalWindow window) {
    window.setInitialWidth(500);/* w  w  w .j av  a 2  s. c om*/
    window.setInitialHeight(510);

    final CreateTokenModalWindow createTokenModalWindow = new CreateTokenModalWindow(window.getContentId(),
            window);
    window.setContent(createTokenModalWindow);
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setTitle("Create a token");
    window.setOutputMarkupId(true);
    this.setCreateTokenModalWindow(window);
    this.add(window);

    final AjaxLink<Void> createTokenLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");

            HomePage.this.createTokenWindow.show(target);
        }
    };

    createTokenLink.setOutputMarkupId(true).setMarkupId(id);
    this.add(createTokenLink);
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generateCountCardsLink(final String id, final ModalWindow window) {
    window.setInitialWidth(740);/*from   w w  w  .  j av a  2 s  . c o  m*/
    window.setInitialHeight(550);

    window.setContent(new CountCardsModalWindow(window.getContentId(), this.session.getGameId()));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setOutputMarkupId(true);
    this.add(window);

    final AjaxLink<Void> countCardsLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            target.prependJavaScript(BattlefieldService.HIDE_MENUS);

            final Long _gameId = HomePage.this.session.getGameId();
            final CountCardsCometChannel cccc = new CountCardsCometChannel(_gameId,
                    HomePage.this.session.getPlayer().getName());

            final List<BigInteger> allPlayersInGame = HomePage.this.persistenceService
                    .giveAllPlayersFromGame(_gameId);
            EventBusPostService.post(allPlayersInGame, cccc);
        }
    };

    countCardsLink.setOutputMarkupId(true);
    this.add(countCardsLink);
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generateLoginLink(final String id, final ModalWindow window) {
    window.setInitialWidth(300);/* ww w  .ja v  a  2s .  c  o m*/
    window.setInitialHeight(200);
    window.setTitle("HatchetHarry login");
    window.setContent(new LoginModalWindow(window.getContentId(), window));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setOutputMarkupId(true);
    window.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean onCloseButtonClicked(final AjaxRequestTarget target) {
            target.appendJavaScript("authenticateUserWithFacebook();");
            return true;
        }
    });
    this.add(window);

    final AjaxLink<Void> loginLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            HomePage.this.loginWindow.show(target);
        }
    };

    loginLink.setOutputMarkupId(true);
    this.add(loginLink);
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generatePreferencesLink(final String id, final ModalWindow window) {
    window.setInitialWidth(630);/*from ww w  .j av a  2s  .  c  o m*/
    window.setInitialHeight(300);
    window.setTitle("User preferences");
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setOutputMarkupId(true);
    this.add(window);

    final AjaxLink<Void> preferencesLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setContent(new UserPreferencesModalWindow(window.getContentId(), window));
            target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            HomePage.this.preferencesWindow.show(target);
        }
    };

    preferencesLink.setOutputMarkupId(true);
    this.add(preferencesLink);
}

From source file:org.apache.syncope.client.console.pages.PolicyModalPage.java

License:Apache License

public PolicyModalPage(final PageReference pageRef, final ModalWindow window, final T policyTO) {
    super();/*from w  ww.  j a v a  2  s.  c  o m*/

    final Form<?> form = new Form<>(FORM);
    form.setOutputMarkupId(true);
    add(form);

    final AjaxTextFieldPanel policyid = new AjaxTextFieldPanel("key", "key",
            new PropertyModel<String>(policyTO, "key"));
    policyid.setEnabled(false);
    policyid.setStyleSheet("ui-widget-content ui-corner-all short_fixedsize");
    form.add(policyid);

    final AjaxTextFieldPanel description = new AjaxTextFieldPanel("description", "description",
            new PropertyModel<String>(policyTO, "description"));
    description.addRequiredLabel();
    description.setStyleSheet("ui-widget-content ui-corner-all medium_dynamicsize");
    form.add(description);

    final AjaxDropDownChoicePanel<PolicyType> type = new AjaxDropDownChoicePanel<>("type", "type",
            new PropertyModel<PolicyType>(policyTO, "type"));
    switch (policyTO.getType()) {
    case GLOBAL_ACCOUNT:
    case ACCOUNT:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_ACCOUNT, PolicyType.ACCOUNT }));
        break;

    case GLOBAL_PASSWORD:
    case PASSWORD:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_PASSWORD, PolicyType.PASSWORD }));
        break;

    case GLOBAL_SYNC:
    case SYNC:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_SYNC, PolicyType.SYNC }));

    default:
    }
    type.setChoiceRenderer(new PolicyTypeRenderer());
    type.addRequiredLabel();
    form.add(type);

    // Authentication resources - only for AccountPolicyTO
    Fragment fragment;
    if (policyTO instanceof AccountPolicyTO) {
        fragment = new Fragment("forAccountOnly", "authResourcesFragment", form);

        final List<String> resourceNames = new ArrayList<>();
        for (ResourceTO resource : resourceRestClient.getAll()) {
            resourceNames.add(resource.getKey());
        }
        fragment.add(new AjaxPalettePanel<>("authResources",
                new PropertyModel<List<String>>(policyTO, "resources"), new ListModel<>(resourceNames)));
    } else {
        fragment = new Fragment("forAccountOnly", "emptyFragment", form);
    }
    form.add(fragment);
    //

    final PolicySpec policy = getPolicySpecification(policyTO);

    form.add(new PolicyBeanPanel("panel", policy));

    final ModalWindow mwindow = new ModalWindow("metaEditModalWin");
    mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    mwindow.setInitialHeight(WIN_HEIGHT);
    mwindow.setInitialWidth(WIN_WIDTH);
    mwindow.setCookieName("meta-edit-modal");
    add(mwindow);

    List<IColumn<String, String>> resColumns = new ArrayList<>();
    resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("name", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId,
                final IModel<String> rowModel) {

            cellItem.add(new Label(componentId, rowModel.getObject()));
        }
    });
    resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("actions", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId,
                final IModel<String> model) {

            final String resource = model.getObject();

            final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    mwindow.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ResourceModalPage(PolicyModalPage.this.getPageReference(), mwindow,
                                    resourceRestClient.read(resource), false);
                        }
                    });

                    mwindow.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Resources");

            cellItem.add(panel);
        }
    });
    ISortableDataProvider<String, String> resDataProvider = new SortableDataProvider<String, String>() {

        private static final long serialVersionUID = 8263758912838836438L;

        @Override
        public Iterator<? extends String> iterator(final long first, final long count) {
            return policyTO.getKey() == 0 ? Collections.<String>emptyList().iterator()
                    : policyRestClient.getPolicy(policyTO.getKey()).getUsedByResources()
                            .subList((int) first, (int) first + (int) count).iterator();
        }

        @Override
        public long size() {
            return policyTO.getKey() == 0 ? 0
                    : policyRestClient.getPolicy(policyTO.getKey()).getUsedByResources().size();
        }

        @Override
        public IModel<String> model(final String object) {
            return new Model<>(object);
        }
    };
    final AjaxFallbackDefaultDataTable<String, String> resources = new AjaxFallbackDefaultDataTable<>(
            "resources", resColumns, resDataProvider, 10);
    form.add(resources);

    List<IColumn<GroupTO, String>> groupColumns = new ArrayList<>();
    groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("key", "key"), "key", "key"));
    groupColumns.add(new PropertyColumn<GroupTO, String>(new ResourceModel("name", "name"), "name", "name"));
    groupColumns.add(new AbstractColumn<GroupTO, String>(new StringResourceModel("actions", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<GroupTO>> cellItem, final String componentId,
                final IModel<GroupTO> model) {

            final GroupTO group = model.getObject();

            final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    mwindow.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new GroupModalPage(PolicyModalPage.this.getPageReference(), mwindow, group);
                        }
                    });

                    mwindow.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Groups");

            cellItem.add(panel);
        }
    });
    ISortableDataProvider<GroupTO, String> groupDataProvider = new SortableDataProvider<GroupTO, String>() {

        private static final long serialVersionUID = 8263758912838836438L;

        @Override
        public Iterator<? extends GroupTO> iterator(final long first, final long count) {
            List<GroupTO> groups = new ArrayList<>();

            if (policyTO.getKey() > 0) {
                for (Long groupId : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups()
                        .subList((int) first, (int) first + (int) count)) {

                    groups.add(groupRestClient.read(groupId));
                }
            }

            return groups.iterator();
        }

        @Override
        public long size() {
            return policyTO.getKey() == 0 ? 0
                    : policyRestClient.getPolicy(policyTO.getKey()).getUsedByGroups().size();
        }

        @Override
        public IModel<GroupTO> model(final GroupTO object) {
            return new Model<>(object);
        }
    };
    final AjaxFallbackDefaultDataTable<GroupTO, String> groups = new AjaxFallbackDefaultDataTable<>("groups",
            groupColumns, groupDataProvider, 10);
    form.add(groups);

    mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            target.add(resources);
            target.add(groups);
            if (isModalResult()) {
                info(getString(Constants.OPERATION_SUCCEEDED));
                feedbackPanel.refresh(target);
                setModalResult(false);
            }
        }
    });

    final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            setPolicySpecification(policyTO, policy);

            try {
                if (policyTO.getKey() > 0) {
                    policyRestClient.updatePolicy(policyTO);
                } else {
                    policyRestClient.createPolicy(policyTO);
                }
                ((BasePage) pageRef.getPage()).setModalResult(true);

                window.close(target);
            } catch (Exception e) {
                LOG.error("While creating policy", e);

                error(getString(Constants.ERROR) + ": " + e.getMessage());
                ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
            }
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
            ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
        }
    };
    form.add(submit);

    final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            window.close(target);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
        }
    };
    cancel.setDefaultFormProcessing(false);
    form.add(cancel);
}

From source file:org.apache.syncope.client.console.pages.ReportModalPage.java

License:Apache License

private void setupProfile() {
    final WebMarkupContainer profile = new WebMarkupContainer("profile");
    profile.setOutputMarkupId(true);//from w w  w .ja  v a 2 s  . co m
    form.add(profile);

    final ModalWindow reportletConfWin = new ModalWindow("reportletConfWin");
    reportletConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    reportletConfWin.setCookieName("reportlet-conf-win-modal");
    reportletConfWin.setInitialHeight(REPORTLET_CONF_WIN_HEIGHT);
    reportletConfWin.setInitialWidth(REPORTLET_CONF_WIN_WIDTH);
    reportletConfWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            int foundIdx = -1;
            if (modalReportletConfOldName != null) {
                for (int i = 0; i < reportTO.getReportletConfs().size() && foundIdx == -1; i++) {
                    if (reportTO.getReportletConfs().get(i).getName().equals(modalReportletConfOldName)) {
                        foundIdx = i;
                    }
                }
            }
            if (modalReportletConf != null) {
                if (foundIdx == -1) {
                    reportTO.getReportletConfs().add(modalReportletConf);
                } else {
                    reportTO.getReportletConfs().set(foundIdx, modalReportletConf);
                }
            }

            target.add(reportlets);
        }
    });
    add(reportletConfWin);

    final Label idLabel = new Label("idLabel", new ResourceModel("key"));
    profile.add(idLabel);

    final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"),
            new PropertyModel<String>(reportTO, "key"));
    key.setEnabled(false);
    profile.add(key);

    final Label nameLabel = new Label("nameLabel", new ResourceModel("name"));
    profile.add(nameLabel);

    final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"),
            new PropertyModel<String>(reportTO, "name"));
    profile.add(name);

    final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"),
            new DateFormatROModel(new PropertyModel<String>(reportTO, "lastExec")));
    lastExec.setEnabled(false);
    profile.add(lastExec);

    final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"),
            new DateFormatROModel(new PropertyModel<String>(reportTO, "nextExec")));
    nextExec.setEnabled(false);
    profile.add(nextExec);

    reportlets = new ListChoice<AbstractReportletConf>("reportletConfs", new Model<AbstractReportletConf>(),
            reportTO.getReportletConfs(), new IChoiceRenderer<ReportletConf>() {

                private static final long serialVersionUID = 1048000918946220007L;

                @Override
                public Object getDisplayValue(final ReportletConf object) {
                    return object.getName();
                }

                @Override
                public String getIdValue(final ReportletConf object, final int index) {
                    return object.getName();
                }
            }) {

        private static final long serialVersionUID = 4022366881854379834L;

        @Override
        protected CharSequence getDefaultChoice(final String selectedValue) {
            return null;
        }
    };

    reportlets.setNullValid(true);
    profile.add(reportlets);
    reportlets.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            target.add(reportlets);
        }
    });

    profile.add(new AjaxLink<Void>(ADD_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    modalReportletConfOldName = null;
                    modalReportletConf = null;
                    return new ReportletConfModalPage(null, reportletConfWin,
                            ReportModalPage.this.getPageReference());
                }
            });
            reportletConfWin.show(target);
        }
    });

    profile.add(new AjaxLink<Void>(EDIT_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        modalReportletConfOldName = reportlets.getModelObject().getName();
                        modalReportletConf = null;
                        return new ReportletConfModalPage(reportlets.getModelObject(), reportletConfWin,
                                ReportModalPage.this.getPageReference());
                    }
                });
                reportletConfWin.show(target);
            }
        }
    });

    profile.add(new AjaxLink<Void>(REMOVE_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            reportTO.getReportletConfs().remove(reportlets.getModelObject());
            reportlets.setModelObject(null);
            target.add(reportlets);
        }

        @Override
        protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
            if (reportlets.getModelObject() != null) {

                super.updateAjaxAttributes(attributes);

                final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

                    private static final long serialVersionUID = 7160235486520935153L;

                    @Override
                    public CharSequence getPrecondition(final Component component) {
                        return "if (!confirm('" + getString("confirmDelete") + "')) {return false;}";
                    }
                };
                attributes.getAjaxCallListeners().add(ajaxCallListener);
            }
        }
    });

    profile.add(new AjaxLink<Void>(UP_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                moveUp(reportlets.getModelObject());
                target.add(reportlets);
            }
        }
    });

    profile.add(new AjaxLink<Void>(DOWN_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                moveDown(reportlets.getModelObject());
                target.add(reportlets);
            }
        }
    });
}