Example usage for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink

List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink.

Prototype

public AjaxLink(final String id) 

Source Link

Document

Construct.

Usage

From source file:com.francetelecom.clara.cloud.presentation.applications.SelectedAppPage.java

License:Apache License

private void createNewReleaseButton() {
    buttonContainer = new WebMarkupContainer("buttonContainer");
    buttonContainer.setOutputMarkupId(true);

    // create link
    newRelease = new AjaxLink("newReleaseLink") {

        @Override/*  w w  w  .  j  a  va 2 s.c o  m*/
        public void onClick(AjaxRequestTarget target) {

            ReleaseCreatePanel releaseCreatePanel = new ReleaseCreatePanel("createReleaseForm", app,
                    manageApplication, manageApplicationRelease, SelectedAppPage.this);

            container.addOrReplace(releaseCreatePanel);
            target.add(container);

            this.setVisible(false);
            target.add(buttonContainer);

        }
    };
    newRelease.setMarkupId("newReleaseLink");
    buttonContainer.add(newRelease);

    buttonContainer.setVisible(app.isEditable());

    add(buttonContainer);
}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerArchitectureMatrixCellButtonPanel.java

License:Apache License

private void initWspInfoBtn() {
    wspLinkDto = null;/*ww w  .  ja va  2 s. c o  m*/
    if (envDetailsDto != null) {
        Map<String, List<LinkDto>> wspInfoDtoList = envDetailsDto.getLinkDtoMap();
        LogicalModelItem service = (LogicalModelItem) getDefaultModelObject();

        if (service instanceof LogicalSoapService) {
            List<LinkDto> linkDtos = wspInfoDtoList.get(service.getName());
            if (linkDtos != null) { // handling the beta status of the service which may be instanciated for demos but doesn't have associated DTOs
                for (LinkDto linkDto : linkDtos) {
                    if (linkDto.getServiceBindings() != null) {
                        wspLinkDto = linkDto;
                    }
                }
            }
        }
    }

    wspInfoSpan = new WebMarkupContainer("wspInfoImg");
    wspInfoBtn = new AjaxLink<Void>("cell-wspInfo") {

        private static final long serialVersionUID = -8840580243026807212L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            logger.debug("WSP Info onClick");
            findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickWspInfo(target);
        }

        @Override
        public boolean isVisible() {
            return wspLinkDto != null;
        }

    };

    Model<String[]> labelModel = new Model<String[]>(new String[] { getModelObject().getLabel() });
    StringResourceModel tooltipValue = new StringResourceModel("portal.designer.matrix.wspInfo.tooltip",
            labelModel);
    wspInfoBtn.add(new AttributeModifier("title", tooltipValue));
    wspInfoSpan.add(new AttributeAppender("class",
            new Model<String>((wspInfoBtn != null) ? "wspInfoImg-enable" : "wspInfoImg-disable"), " "));
    wspInfoBtn.add(wspInfoSpan);
    add(wspInfoBtn);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerArchitectureMatrixCellButtonPanel.java

License:Apache License

private void initDeleteBtn() {

    /** delete icon */
    deleteBtn = new AjaxLink<Void>("cell-delete") {
        private static final long serialVersionUID = -3624723770141461652L;

        @Override//from  w ww .ja va2  s  . c  om
        public void onClick(AjaxRequestTarget target) {
            logger.debug("delete icon onClick");
            findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickDelete(target);
        }

        @Override
        public boolean isVisible() {
            return !readOnly;
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.getAjaxCallListeners().add(new DeleteConfirmationDecorator(
                    getString("portal.designer.service.action.delete.confirm")));
        }
    };

    Model<String[]> labelModel = new Model<String[]>(new String[] { getModelObject().getLabel() });
    StringResourceModel tooltipValue = new StringResourceModel("portal.designer.matrix.delete.tooltip",
            labelModel);
    deleteBtn.add(new AttributeModifier("title", tooltipValue));
    add(deleteBtn);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerArchitectureMatrixCellButtonPanel.java

License:Apache License

private void initEditBtn() {

    /** edit icon */
    editBtn = new AjaxLink<Void>("cell-edit") {
        private static final long serialVersionUID = 9004624464275531600L;

        @Override//from   ww  w.j ava  2  s.com
        public void onClick(AjaxRequestTarget target) {
            logger.debug("edit icon onClick");
            findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickEdit(target);
            // Move the page to the logicalServicesListSelect panel to view edited service
            target.appendJavaScript(
                    "$('html, body').animate({scrollTop: $('#logicalServicesListSelect').offset().top}, 200);");
        }

        @Override
        public boolean isVisible() {
            return !readOnly;
        }

    };

    Model<String[]> labelModel = new Model<String[]>(new String[] { getModelObject().getLabel() });
    StringResourceModel tooltipValue = new StringResourceModel("portal.designer.matrix.edit.tooltip",
            labelModel);
    editBtn.add(new AttributeModifier("title", tooltipValue));
    add(editBtn);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerArchitectureMatrixCellButtonPanel.java

License:Apache License

private void initViewBtn() {

    /** view icon */
    viewBtn = new AjaxLink<Void>("cell-view") {

        private static final long serialVersionUID = 1220079179197689639L;

        @Override/*from   w  ww.j  a  v a2 s  . co  m*/
        public void onClick(AjaxRequestTarget target) {
            logger.debug("view icon onClick");
            findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickView(target);
        }

        @Override
        public boolean isVisible() {
            return readOnly;
        }

    };

    Model<String[]> labelModel = new Model<String[]>(new String[] { getModelObject().getLabel() });
    StringResourceModel tooltipValue = new StringResourceModel("portal.designer.matrix.details.tooltip",
            labelModel);
    viewBtn.add(new AttributeModifier("title", tooltipValue));

    add(viewBtn);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerArchitectureMatrixCellButtonPanel.java

License:Apache License

private void initConfigBtn() {

    /** view icon */
    configBtn = new AjaxLink<Void>("cell-config") {

        private static final long serialVersionUID = 6195327499501053622L;

        @Override// w  w  w  .j av a2 s  .c  o m
        public void onClick(AjaxRequestTarget target) {
            logger.debug("config icon onClick");
            findParent(DesignerArchitectureMatrixCellButtonPanel.class).onClickConfigOverride(target);
        }

        @Override
        public boolean isVisible() {
            return allowOverride && DesignerArchitectureMatrixCellButtonPanel.this
                    .getModelObject() instanceof LogicalConfigService;
        }

    };

    Model<String[]> labelModel = new Model<String[]>(new String[] { getModelObject().getLabel() });
    configBtn.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.matrix.details.tooltip", labelModel)));

    add(configBtn);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerSteppedButtonsPanel.java

License:Apache License

private void initPreviousStepButton() {

    AjaxLink previousButton = new AjaxLink("previousButton") {

        @Override//from   w  w  w  .  j  av  a 2s  . com
        public void onClick(AjaxRequestTarget target) {
            step = parentPage.previousStepProcess();
            parentPage.managePageComponents(target, step, null);
        }

        @Override
        public boolean isVisible() {
            return step != 0;
        }
    };

    add(previousButton);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.panels.DesignerSteppedButtonsPanel.java

License:Apache License

private void initNextStepButton() {

    AjaxLink nextButton = new AjaxLink("nextButton") {

        @Override//from  w  w  w . jav  a 2s .c o  m
        public void onClick(AjaxRequestTarget target) {
            step = parentPage.nextStepProcess();
            parentPage.managePageComponents(target, step, null);
        }

        @Override
        public boolean isVisible() {
            return step != 2; //To change body of overridden methods use File | Settings | File Templates.
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            if (step == 1) {
                attributes.getAjaxCallListeners()
                        .add(new BlockUIDecorator(getString("portal.designer.architecture.validation")));
            }
        }

    };

    add(nextButton);

}

From source file:com.francetelecom.clara.cloud.presentation.environments.EnvironmentDetailsPanel.java

License:Apache License

private void initEnvErrorMessages() {

    String envErrorMsg = getModelObject().getStatusMessage();
    AjaxLink showHideEllipsis = new AjaxLink("env-status-link") {
        @Override//from  w  ww  . j  a  va 2  s. c om
        public void onClick(AjaxRequestTarget target) {
            if (!isAllStatusMessageVisible) {
                target.appendJavaScript("document.getElementById('" + envErrorMsgLabel.getMarkupId()
                        + "').removeAttribute('style',0);");
                isAllStatusMessageVisible = true;
            } else {
                envErrorMsgLabel.add(new AttributeModifier("style", new Model<String>("max-height:50px")));
                isAllStatusMessageVisible = false;
            }
            target.add(envErrorMsgLabel);
        }
    };
    add(showHideEllipsis);

    if ("".equals(envErrorMsg) || envErrorMsg == null) {
        envErrorMsgLabel = new Label("env-activation-error",
                new Model(getString("portal.environment.details.activation.nostatus.msg")));
    } else {
        envErrorMsgLabel = new Label("env-activation-error", getModelObject().getStatusMessage());
    }
    envErrorMsgLabel.setOutputMarkupId(true);
    envErrorMsgLabel.add(new AttributeModifier("title", new Model<String>(envErrorMsg)));
    envErrorMsgLabel.add(new AttributeModifier("style", new Model<String>("max-height:50px")));
    showHideEllipsis.add(envErrorMsgLabel);
    refreshContainer.add(showHideEllipsis);
}

From source file:com.francetelecom.clara.cloud.presentation.environments.EnvironmentDetailsPanel.java

License:Apache License

private void createButtons() {

    buttonContainer = new WebMarkupContainer("buttonContainer");

    editButton = new AjaxLink("releaseModifyLink") {

        @Override/* ww w  .  j  a v a2  s  .  co  m*/
        public void onClick(AjaxRequestTarget target) {

            applyModificationOnComponents(true, target);

        }
    };

    cancelButton = new AjaxLink("releaseCancelLink") {

        @Override
        public void onClick(AjaxRequestTarget target) {

            applyModificationOnComponents(false, target);

        }
    };

    updateButton = new AjaxButton("releaseUpdateLink") {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            parentPage.getManageEnvironment().update(EnvironmentDetailsPanel.this.getModelObject());
            applyModificationOnComponents(false, target);
            target.add(form);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            applyModificationOnComponents(true, target);
            target.add(form);
        }
    };

    cancelButton.add(new Label("cancelLabel", new Model(getString("portal.action.cancel"))));
    editButton.add(new Label("modifyLabel", new Model(getString("portal.action.modify"))));
    updateButton.add(new Label("updateLabel", new Model(getString("portal.action.update"))));

    buttonContainer.add(cancelButton);
    buttonContainer.add(editButton);
    buttonContainer.add(updateButton);

    buttonContainer.setOutputMarkupId(true);
    buttonContainer.setVisible(getModelObject().isEditable());

    envDetailForm.add(buttonContainer);

}