Example usage for org.apache.wicket.markup.html.link ExternalLink setVisible

List of usage examples for org.apache.wicket.markup.html.link ExternalLink setVisible

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.link ExternalLink setVisible.

Prototype

public final Component setVisible(final boolean visible) 

Source Link

Document

Sets whether this component and any children are visible.

Usage

From source file:com.francetelecom.clara.cloud.presentation.designer.services.cfjavaprocessing.LogicalCfJavaProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("cfjavaprocessing-icon",
            new ResourceModel("cfjavaprocessing.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {//www.j  a  va 2s. c om
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.cfjava.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
    groupId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.groupId", null));
    groupId.add(new PropertyValidator<>());
    getServiceForm().add(groupId);

    RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
    artifactId.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.artifactId", null));
    artifactId.add(new PropertyValidator<>());
    getServiceForm().add(artifactId);

    RequiredTextField<String> version = new RequiredTextField<String>("softwareReference.version");
    version.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.version", null));
    version.add(new PropertyValidator<>());
    getServiceForm().add(version);

    RequiredTextField<String> extension = new RequiredTextField<String>("softwareReference.extension");
    if (getServiceForm().getModelObject().getSoftwareReference() == null) {
        getServiceForm().getModelObject().setSoftwareReference(new MavenReference("", "", "", "war"));
    }
    extension.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.extension", null));
    extension.add(new PropertyValidator<>());
    getServiceForm().add(extension);
    /*List<String> extensionList = new ArrayList<String>();
    extensionList.add("jar");
    extensionList.add("war");
    extensionList.add("ear");
    DropDownChoice<String> extension = new DropDownChoice<String>("softwareReference.extension", extensionList);
    extension.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.extension",null));
    extension.add(new PropertyValidator<>());
    getServiceForm().add(extension);*/

    TextField<String> classifier = new TextField<String>("softwareReference.classifier", String.class);
    classifier.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.softwareReference.classifier", null));
    classifier.add(new PropertyValidator<>());
    getServiceForm().add(classifier);

    CheckBox optionalSoftwareReference = new CheckBox("optionalSoftwareReference");
    optionalSoftwareReference.setLabel(
            new StringResourceModel("portal.designer.service.cfjava.optionalSoftwareReference", null));
    getServiceForm().add(optionalSoftwareReference);

    TextField<Integer> minMemoryMbHint = new TextField<Integer>("minMemoryMbHint");
    minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.cfjava.minMemoryMbHint", null));
    minMemoryMbHint.add(new AttributeModifier("class", "small"));
    minMemoryMbHint.add(new PropertyValidator<>());
    getServiceForm().add(minMemoryMbHint);

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.cfjava.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.cfjava.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        /**
        * 
        */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm().add(new CacheActivatedImage("imageHelp.iconUrl", getString("image.help")));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                e.printStackTrace();
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.config.LogicalConfigServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalconfig-icon",
            new ResourceModel("cfconfigservice.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*from  w  w  w  .  ja  va 2s. co m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    ExternalLink onlineHelpLinkOverride = new ExternalLink("onlineHelpLinkOverride", completeHelpUrl);

    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
        onlineHelpLinkOverride.setVisible(false);
    }

    // Creates 2 blocks only for good displaying : Read more... juste after description (not possible with span wicket:id=descriptionLabel).
    WebMarkupContainer descriptionBlock = new WebMarkupContainer("descriptionBlock");
    descriptionBlock.add(onlineHelpLink);
    getServiceForm().add(descriptionBlock);

    WebMarkupContainer overrideDescriptionBlock = new WebMarkupContainer("overrideDescriptionBlock");
    overrideDescriptionBlock.add(onlineHelpLinkOverride);
    getServiceForm().add(overrideDescriptionBlock);

    if (configOverride) {
        descriptionBlock.setVisible(false);
    } else {
        overrideDescriptionBlock.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS    
    RequiredTextField<String> label = new RequiredTextField<>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.config.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> keyPrefix = new TextField<>("keyPrefix", String.class);
    keyPrefix.setConvertEmptyInputStringToNull(false);
    keyPrefix.setLabel(new StringResourceModel("portal.designer.service.config.keyPrefix", null));
    keyPrefix.add(new PropertyValidator<>());
    getServiceForm().add(keyPrefix);

    configSetContent = new CodeMirrorTextArea<>("configSetContent", readOnly && !configOverride);

    configSetContent.setLabel(new StringResourceModel("portal.designer.service.config.configSetContent", null));
    configSetContent.add(new PropertyValidator<>());
    getServiceForm().add(configSetContent);

    configSetContent.add(new ConfigDuplicateKeysValidator());
    configSetContent.add(new ConfigMaxSizeValidator());
    configSetContent.add(new ConfigMaxNumberKeysValidator());
    configSetContent.add(new InvalidCharsetValidator());

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.internalMom.LogicalInternalMomServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalInternalMomIcon",
            new ResourceModel("internalMom-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*  w  ww  .j  av  a2  s  . com*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> serviceLabel = new RequiredTextField<String>("label");
    serviceLabel.setLabel(new StringResourceModel("portal.designer.service.mom.ml.label", null));
    serviceLabel.add(new PropertyValidator<>());
    getServiceForm().add(serviceLabel);

    TextField<String> destinationName = new TextField<String>("destinationName");
    //add help tooltip
    destinationName.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.ml.destinationName.help", null)));
    destinationName.setLabel(new StringResourceModel("portal.designer.service.mom.ml.destinationName", null));
    destinationName.add(new PropertyValidator<>());
    getServiceForm().add(destinationName);

    // Connection factory JNDI Name
    TextField<String> jmsConnectionFactoryJndiName = new TextField<String>("jmsConnectionFactoryJndiName");
    //add help tooltip
    jmsConnectionFactoryJndiName.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.ml.jmsConnectionFactoryJndiName.help", null)));
    jmsConnectionFactoryJndiName.setLabel(
            new StringResourceModel("portal.designer.service.mom.ml.jmsConnectionFactoryJndiName", null));
    jmsConnectionFactoryJndiName.add(new PropertyValidator<>());
    getServiceForm().add(jmsConnectionFactoryJndiName);

    // Non Functionnal attributes
    // Max size Kb
    TextField msgMaxSizeKB = new TextField("msgMaxSizeKB");
    //add help tooltip
    msgMaxSizeKB.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.ml.msgMaxSizeKB.help", null)));
    msgMaxSizeKB.setLabel(new StringResourceModel("portal.designer.service.mom.ml.msgMaxSizeKB", null));
    msgMaxSizeKB.add(new PropertyValidator<>());
    getServiceForm().add(msgMaxSizeKB);

    // destination capacity (nb msg)
    TextField destinationCapacity = new TextField("destinationCapacity");
    //add help tooltip
    destinationCapacity.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.ml.destinationCapacity.help", null)));
    destinationCapacity
            .setLabel(new StringResourceModel("portal.designer.service.mom.ml.destinationCapacity", null));
    destinationCapacity.add(new PropertyValidator<>());
    getServiceForm().add(destinationCapacity);

    // Persistent message used
    CheckBox persistentMessagesUsed = new CheckBox("persistentMessagesUsed");
    persistentMessagesUsed
            .setLabel(new StringResourceModel("portal.designer.service.mom.ml.persistentMessagesUsed", null));
    persistentMessagesUsed.add(new PropertyValidator<>());
    getServiceForm().add(persistentMessagesUsed);

    // High availability
    CheckBox highAvailability = new CheckBox("highAvailability");
    highAvailability.setLabel(new StringResourceModel("portal.designer.service.mom.ml.highAvailability", null));
    highAvailability.setEnabled(false);
    //add help tooltip
    highAvailability.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.ml.highAvailability.help", null)));
    highAvailability.add(new PropertyValidator<>());
    getServiceForm().add(highAvailability);

    // Dead Letter
    // jndi queue name
    deadLetterQueueName = new TextField<String>("deadLetterQueueName", String.class);
    //add help tooltip
    deadLetterQueueName.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.dl.deadLetterQueueName.help", null)));
    deadLetterQueueName.setOutputMarkupId(true);
    deadLetterQueueName.add(new PropertyValidator<>());
    //        deadLetterQueueName.setLabel(new StringResourceModel("portal.designer.service.mom.dl.deadLetterQueueName",null));

    // queue capacity
    deadLetterQueueCapacity = new TextField("deadLetterQueueCapacity");
    //add help tooltip
    deadLetterQueueCapacity.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.dl.deadLetterQueueCapacity.help", null)));
    deadLetterQueueCapacity.setOutputMarkupId(true);
    deadLetterQueueCapacity.add(new PropertyValidator<>());
    //        deadLetterQueueCapacity.setLabel(new StringResourceModel("portal.designer.service.mom.dl.deadLetterQueueCapacity",null));

    // retries before deadqueue
    retriesBeforeMovingToDeadLetterQueue = new TextField("retriesBeforeMovingToDeadLetterQueue");
    //add help tooltip
    retriesBeforeMovingToDeadLetterQueue.add(new AttributeModifier("title", new StringResourceModel(
            "portal.designer.service.mom.dl.retriesBeforeMovingToDeadLetterQueue.help", null)));
    //        retriesBeforeMovingToDeadLetterQueue.setLabel(new StringResourceModel("portal.designer.service.mom.dl.retriesBeforeMovingToDeadLetterQueue",null));
    retriesBeforeMovingToDeadLetterQueue.setOutputMarkupId(true);
    retriesBeforeMovingToDeadLetterQueue.add(new PropertyValidator<>());

    // enable dead letter queue
    hasDeadLetterQueue = new AjaxCheckBox("hasDeadLetterQueue") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            deadLetterQueueName.setEnabled(getModelObject());
            deadLetterQueueCapacity.setEnabled(getModelObject());
            retriesBeforeMovingToDeadLetterQueue.setEnabled(getModelObject());

            target.add(deadLetterQueueName);
            target.add(deadLetterQueueCapacity);
            target.add(retriesBeforeMovingToDeadLetterQueue);
        }
    };
    hasDeadLetterQueue
            .setLabel(new StringResourceModel("portal.designer.service.mom.dl.hasDeadLetterQueue", null));
    hasDeadLetterQueue.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.mom.dl.hasDeadLetterQueue.help", null)));
    getServiceForm().add(hasDeadLetterQueue);

    if (hasDeadLetterQueue.getModelObject() != null) {
        deadLetterQueueName.setEnabled(hasDeadLetterQueue.getModelObject());
        deadLetterQueueCapacity.setEnabled(hasDeadLetterQueue.getModelObject());
        retriesBeforeMovingToDeadLetterQueue.setEnabled(hasDeadLetterQueue.getModelObject());
    }

    getServiceForm().add(retriesBeforeMovingToDeadLetterQueue);
    getServiceForm().add(deadLetterQueueCapacity);
    getServiceForm().add(deadLetterQueueName);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.jeeprocessing.LogicalJeeProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalJeeProcessingPanelIcon",
            new ResourceModel("jeeProcessing-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*w  w  w.ja  v  a 2s .c o m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.jee.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
    groupId.setLabel(new StringResourceModel("portal.designer.service.jee.softwareReference.groupId", null));
    groupId.add(new PropertyValidator<>());
    getServiceForm().add(groupId);

    RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
    artifactId.setLabel(
            new StringResourceModel("portal.designer.service.jee.softwareReference.artifactId", null));
    artifactId.add(new PropertyValidator<>());
    getServiceForm().add(artifactId);

    RequiredTextField version = new RequiredTextField("softwareReference.version");
    version.setLabel(new StringResourceModel("portal.designer.service.jee.softwareReference.version", null));
    version.add(new PropertyValidator<>());
    getServiceForm().add(version);

    TextField classifier = new TextField("softwareReference.classifier", String.class);
    classifier.setLabel(
            new StringResourceModel("portal.designer.service.jee.softwareReference.classifier", null));
    classifier.add(new PropertyValidator<>());
    getServiceForm().add(classifier);

    CheckBox optionalSoftwareReference = new CheckBox("optionalSoftwareReference");
    optionalSoftwareReference
            .setLabel(new StringResourceModel("portal.designer.service.jee.optionalSoftwareReference", null));
    getServiceForm().add(optionalSoftwareReference);

    TextField minMemoryMbHint = new TextField("minMemoryMbHint");
    minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.jee.minMemoryMbHint", null));
    minMemoryMbHint.add(new AttributeModifier("class", "small"));
    minMemoryMbHint.add(new PropertyValidator<>());
    getServiceForm().add(minMemoryMbHint);

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.jee.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.jee.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm()
            .add(new CacheActivatedImage("imageHelp.iconUrl", new ResourceModel("image.help").getObject()));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                logger.info("Exception while getting new icon", e);
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.nodeprocessing.LogicalNodeProcessingServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("nodeprocessingIcon",
            new ResourceModel("nodeprocessing-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*from w  w w.j  ava  2  s . c  o m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    /*RequiredTextField<String> label = new RequiredTextField<String>("label");
     label.setLabel(new StringResourceModel("portal.designer.service.cfjava.label",null));
     label.add(new PropertyValidator<>());
     getServiceForm().add(label);
            
     RequiredTextField<String> groupId = new RequiredTextField<String>("softwareReference.groupId");
     groupId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.groupId",null));
     groupId.add(new PropertyValidator<>());
     getServiceForm().add(groupId);
            
     RequiredTextField<String> artifactId = new RequiredTextField<String>("softwareReference.artifactId");
     artifactId.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.artifactId",null));
     artifactId.add(new PropertyValidator<>());
     getServiceForm().add(artifactId);
            
     RequiredTextField<?> version = new RequiredTextField("softwareReference.version");
     version.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.version",null));
     version.add(new PropertyValidator<>());
     getServiceForm().add(version);
            
     TextField classifier = new TextField("softwareReference.classifier", String.class);
     classifier.setLabel(new StringResourceModel("portal.designer.service.cfjava.softwareReference.classifier",null));
     classifier.add(new PropertyValidator<>());
     getServiceForm().add(classifier);
            
             
     CheckBox optionalSoftwareReference=new CheckBox("optionalSoftwareReference");
     optionalSoftwareReference.setLabel(new StringResourceModel("portal.designer.service.cfjava.optionalSoftwareReference",null));
     getServiceForm().add(optionalSoftwareReference);
             
             
             
     TextField minMemoryMbHint = new TextField("minMemoryMbHint");
     minMemoryMbHint.setLabel(new StringResourceModel("portal.designer.service.cfjava.minMemoryMbHint",null));
     minMemoryMbHint.add(new AttributeModifier("class","small"));
     minMemoryMbHint.add(new PropertyValidator<>());
     getServiceForm().add(minMemoryMbHint);
    */

    //****** Change Icon ******//

    final TextField<String> iconUrl = new TextField<String>("iconUrl");
    iconUrl.setLabel(new StringResourceModel("portal.designer.service.cfjava.iconUrl", null));
    //iconUrl.add(new AttributeModifier("title", new StringResourceModel("portal.designer.service.cfjava.iconUrl.help",null)));
    //Add Wicket validation for URL
    iconUrl.add(new UrlValidator());
    iconUrl.add(new PropertyValidator<>());
    iconUrl.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            // Important, DO NOT DELETE
            // By Calling OnChangeAjaxBehavior, we update iconUrl field model to can push button preview with updated model

        }

        @Override
        protected void onError(AjaxRequestTarget target, RuntimeException e) {
            iconUrl.updateModel(); // The feedback is handle when click on preview button so we need to updateModel when there is an error
        }
    });
    getServiceForm().add(iconUrl);
    getServiceForm().add(new CacheActivatedImage("imageHelp.iconUrl", getString("image.help")));

    WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer");

    final WebMarkupContainer icon = new WebMarkupContainer("icon");
    icon.setOutputMarkupId(true);
    icon.setOutputMarkupPlaceholderTag(true);
    if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
        setDefaultIconAndUpdateFeedBack(icon, null, "");
    } else {
        setCustomIconAndUpdateFeedBack(icon, iconUrl, null);
    }
    imageContainer.add(icon);

    final Label feedback = new Label("feedbackError", new Model<String>(""));
    feedback.setOutputMarkupId(true);
    imageContainer.add(feedback);

    AjaxLink preview = new AjaxLink("preview", new Model()) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            try {

                //If null or empty when click on preview button, clean feedBack and display default image
                if (iconUrl.getModelObject() == null || iconUrl.getModelObject().equals("")) {
                    setDefaultIconAndCleanFeedBack(icon, feedback);
                } // Else try to display custom image
                else {
                    //Construct URL to test integrity of what user typing
                    URL url = new URL(iconUrl.getModelObject().toString());
                    if (iconUrl.getModelObject() != null) {
                        setCustomIconAndUpdateFeedBack(icon, iconUrl, feedback);
                    }
                }
            } catch (MalformedURLException e) {
                setDefaultIconAndUpdateFeedBack(icon, feedback, e.getMessage());
                e.printStackTrace();
            }
            target.add(icon);
            target.add(feedback);
        }
    };
    imageContainer.add(preview);
    getServiceForm().add(imageContainer);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.onlinestorage.LogicalOnlineStorageServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalOnlineStorageServicePanelIcon",
            new ResourceModel("onlineStorage-icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {//from  w  w w .j  a va 2 s .co  m
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.storage.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> serviceName = new TextField<String>("serviceName");
    serviceName.setLabel(new StringResourceModel("portal.designer.service.storage.name", null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

    TextField storageCapacityMb = new TextField("storageCapacityMb");
    storageCapacityMb
            .setLabel(new StringResourceModel("portal.designer.service.storage.storageCapacityMb", null));
    storageCapacityMb.add(new AttributeModifier("class", "small"));
    storageCapacityMb.add(new PropertyValidator<>());
    getServiceForm().add(storageCapacityMb);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.queuereceive.LogicalQueueReceiveServicePanel.java

License:Apache License

public LogicalQueueReceiveServicePanel(String id, IModel<LogicalQueueReceiveService> model, Page parentPage,
        boolean isNew, boolean readOnly, boolean configOverride) {
    super(id, model, parentPage, isNew, readOnly, configOverride);

    getServiceForm().add(new CacheActivatedImage("logicalqueuereceiveServicePanelIcon",
            new ResourceModel("queuereceive.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {//from   ww  w  .java 2 s  . c  om
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.queue_receive.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> serviceName = new TextField<String>("serviceName");
    serviceName.setLabel(new StringResourceModel("portal.designer.service.queue_receive.serviceName", null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

    TextField serviceVersion = new TextField("serviceVersion");
    serviceVersion
            .setLabel(new StringResourceModel("portal.designer.service.queue_receive.serviceVersion", null));
    serviceVersion.add(new PropertyValidator<>());
    getServiceForm().add(serviceVersion);

    TextField<String> jndiQueueName = new TextField<String>("jndiQueueName");
    jndiQueueName
            .setLabel(new StringResourceModel("portal.designer.service.queue_receive.jndiQueueName", null));
    jndiQueueName.add(new AttributeAppender("title",
            new StringResourceModel("portal.designer.service.queue_receive.preferredJNDI", null), " "));
    jndiQueueName.add(new PropertyValidator<>());
    getServiceForm().add(jndiQueueName);

    DropDownChoice<Long> msgMaxSizeKB = new DropDownChoice<Long>("msgMaxSizeKB", Arrays.asList(maxMsgSizeList));
    msgMaxSizeKB.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(msgMaxSizeKB);
    msgMaxSizeKB.setLabel(new StringResourceModel("portal.designer.service.queue_receive.msgMaxSizeKB", null));
    msgMaxSizeKB.add(new PropertyValidator<>());

    DropDownChoice<Long> maxNbMsgPerDay = new DropDownChoice<Long>("maxNbMsgPerDay",
            Arrays.asList(maxNbMsgPerDayList));
    maxNbMsgPerDay.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(maxNbMsgPerDay);
    maxNbMsgPerDay
            .setLabel(new StringResourceModel("portal.designer.service.queue_receive.maxNbMsgPerDay", null));
    maxNbMsgPerDay.add(new PropertyValidator<>());

    DropDownChoice<Long> nbRetentionDay = new DropDownChoice<Long>("nbRetentionDay",
            Arrays.asList(nbRetentionDayList));
    nbRetentionDay.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(nbRetentionDay);
    nbRetentionDay
            .setLabel(new StringResourceModel("portal.designer.service.queue_receive.nbRetentionDay", null));
    nbRetentionDay.add(new PropertyValidator<>());
}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.queuesend.LogicalQueueSendServicePanel.java

License:Apache License

private void initComponents() {

    //       getServiceForm().add(new CacheActivatedImage("logicalqueuesendServicePanelIcon",new ResourceModel("queuesend.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*from   www  .  j a  va  2  s. c o  m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.queue_send.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    List<String> basicatCodeList = new ArrayList<String>();
    DropDownChoice<String> targetBasicatCode = new DropDownChoice<String>("targetBasicatCode", basicatCodeList);
    targetBasicatCode
            .setLabel(new StringResourceModel("portal.designer.service.queue_send.targetBasicatCode", null));
    targetBasicatCode.setEnabled(false);
    targetBasicatCode.add(new PropertyValidator<>());
    getServiceForm().add(targetBasicatCode);

    /* prevent null errors */
    List<String> emptyList = new ArrayList<>();

    targetApplicationName = new DropDownChoice<>("targetApplicationName",
            (applicationNameList != null) ? applicationNameList : emptyList);
    targetApplicationName.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List<String> list = parentPage.getQrsApplicationVersions("cloud",
                    targetApplicationName.getDefaultModelObjectAsString());
            targetApplicationVersion.setChoices(list);
            if (list == null) {
                targetApplicationVersion.warn("no qrs application version found.");
            }
            target.add(targetApplicationVersion);
        }
    });
    //        targetApplicationName.setLabel(new StringResourceModel("portal.designer.service.queue_send.targetApplicationName",null));

    if (applicationNameList == null) {
        targetApplicationName.warn("no qrs application found.");
    }
    targetApplicationName.add(new PropertyValidator<>());
    getServiceForm().add(targetApplicationName);

    targetApplicationVersion = new DropDownChoice<>("targetApplicationVersion",
            (applicationVersionList != null) ? applicationVersionList : emptyList);
    //        targetApplicationVersion.setLabel(new StringResourceModel("portal.designer.service.queue_send.targetApplicationVersion",null));
    targetApplicationVersion.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List list = parentPage.getQrsServices("cloud",
                    targetApplicationName.getDefaultModelObjectAsString(),
                    targetApplicationVersion.getDefaultModelObjectAsString());
            targetServiceName.setChoices(list);
            if (list == null) {
                targetServiceName.warn("no qrs service version found.");
            }
            target.add(targetServiceName);
        }
    });
    targetApplicationVersion.add(new PropertyValidator<>());
    getServiceForm().add(targetApplicationVersion);

    targetServiceName = new DropDownChoice<String>("targetServiceName",
            (serviceNameList != null) ? serviceNameList : emptyList);
    //        targetServiceName.setLabel(new StringResourceModel("portal.designer.service.queue_send.targetServiceName",null));
    targetServiceName.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List list = parentPage.getQrsServicesVersions("cloud",
                    targetApplicationName.getDefaultModelObjectAsString(),
                    targetApplicationVersion.getDefaultModelObjectAsString(),
                    targetServiceName.getDefaultModelObjectAsString());
            targetServiceVersion.setChoices(list);
            if (list == null) {
                targetServiceVersion.warn("no qrs service version found.");
            }
            target.add(targetServiceVersion);
        }
    });
    targetServiceName.add(new PropertyValidator<>());
    getServiceForm().add(targetServiceName);

    targetServiceVersion = new DropDownChoice<String>("targetServiceVersion",
            (serviceVersionList != null) ? serviceVersionList : emptyList);
    //        targetServiceVersion.setLabel(new StringResourceModel("portal.designer.service.queue_send.targetServiceVersion",null));

    //Forces update
    targetServiceVersion.add(defaultDropDownUpdateBehavior());
    targetServiceVersion.add(new PropertyValidator<>());
    getServiceForm().add(targetServiceVersion);

    TextField<String> jndiQueueName = new TextField<String>("jndiQueueName");
    jndiQueueName.setLabel(new StringResourceModel("portal.designer.service.queue_send.jndiQueueName", null));
    jndiQueueName.add(new PropertyValidator<>());
    getServiceForm().add(jndiQueueName);

    DropDownChoice<Long> msgMaxSizeKB = new DropDownChoice<Long>("msgMaxSizeKB", Arrays.asList(maxMsgSizeList));
    msgMaxSizeKB.add(defaultDropDownUpdateBehavior());
    msgMaxSizeKB.add(new PropertyValidator<>());
    getServiceForm().add(msgMaxSizeKB);
    msgMaxSizeKB.setLabel(new StringResourceModel("portal.designer.service.queue_send.msgMaxSizeKB", null));

    DropDownChoice<Long> maxNbMsgPerDay = new DropDownChoice<Long>("maxNbMsgPerDay",
            Arrays.asList(maxNbMsgPerDayList));
    maxNbMsgPerDay.add(defaultDropDownUpdateBehavior());
    maxNbMsgPerDay.add(new PropertyValidator<>());
    getServiceForm().add(maxNbMsgPerDay);
    maxNbMsgPerDay.setLabel(new StringResourceModel("portal.designer.service.queue_send.maxNbMsgPerDay", null));

    DropDownChoice<Long> nbRetentionDay = new DropDownChoice<Long>("nbRetentionDay",
            Arrays.asList(nbRetentionDayList));
    nbRetentionDay.add(defaultDropDownUpdateBehavior());
    nbRetentionDay.add(new PropertyValidator<>());
    getServiceForm().add(nbRetentionDay);
    nbRetentionDay.setLabel(new StringResourceModel("portal.designer.service.queue_send.nbRetentionDay", null));

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.rabbitmq.LogicalRabbitMQServicePanel.java

License:Apache License

private void initComponents() {

    getServiceForm().add(new CacheActivatedImage("logicalRabbitMQPanelIcon",
            new ResourceModel("rabbitmq.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {//  w  ww  . jav a  2 s . c o m
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel(
                        "portal.designer.logical.service.online_manual." + getLogicalModelType(), null)
                                .getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> serviceLabel = new RequiredTextField<String>("label");
    serviceLabel.setLabel(new StringResourceModel("portal.designer.service.rabbitmq.service.label", null));
    serviceLabel.add(new PropertyValidator<>());
    getServiceForm().add(serviceLabel);

    // Cloudfoundry rabbitMQ service name
    RequiredTextField<String> serviceName = new RequiredTextField<String>("serviceName");
    //add help tooltip
    serviceName.add(new AttributeModifier("title",
            new StringResourceModel("portal.designer.service.rabbitmq.service.name.help", null)));
    serviceName.setLabel(new StringResourceModel("portal.designer.service.rabbitmq.service.name", null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.relationaldatabase.LogicalRelationalDatabasePanel.java

License:Apache License

private void initComponents() {
    getServiceForm().add(new CacheActivatedImage("logicalRelationnalDatabasePanelIcon",
            new ResourceModel("onlinedatabase.icon").getObject()));
    // Online help link
    String completeHelpUrl = "";
    try {/*  w  ww  .  j  a  v a2 s . c  o m*/
        completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null)
                .getString()
                + new StringResourceModel("portal.designer.logical.service.online_manual.relationaldatabase",
                        null).getString();
    } catch (Exception e) {
        //do nothing
    }
    ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    getServiceForm().add(onlineHelpLink);
    if (completeHelpUrl.isEmpty()) {
        onlineHelpLink.setVisible(false);
    }

    // FUNCTIONNAL PARAMETERS
    final RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.reldb.label", null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> serviceName = new TextField<String>("serviceName");
    serviceName.setLabel(new StringResourceModel("portal.designer.service.reldb.serviceName", null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

    DropDownChoice<LogicalRelationalServiceSqlDialectEnum> sqlVersion = new DropDownChoice<LogicalRelationalServiceSqlDialectEnum>(
            "sqlVersion", Arrays.asList(LogicalRelationalServiceSqlDialectEnum.values()));
    sqlVersion.setLabel(new StringResourceModel("portal.designer.service.reldb.sqlVersion", null));
    sqlVersion.add(new PropertyValidator<>());
    getServiceForm().add(sqlVersion);

    // SLO
    TextField capacityMo = new TextField("capacityMo");
    capacityMo.setLabel(new StringResourceModel("portal.designer.service.reldb.capacityMo", null));
    capacityMo.add(new AttributeModifier("class", "small"));
    capacityMo.add(new PropertyValidator<>());
    getServiceForm().add(capacityMo);
}