Example usage for com.jgoodies.binding PresentationModel PresentationModel

List of usage examples for com.jgoodies.binding PresentationModel PresentationModel

Introduction

In this page you can find the example usage for com.jgoodies.binding PresentationModel PresentationModel.

Prototype

public PresentationModel(ValueModel beanChannel) 

Source Link

Document

Constructs a PresentationModel on the given bean channel.

Usage

From source file:com.brainflow.application.presentation.ColorGradientEditor.java

private void initGUI() {
    colorComboOne = new ColorComboBox();
    colorComboOne.setSelectedColor(colorOne);

    colorComboTwo = new ColorComboBox();
    colorComboTwo.setSelectedColor(colorTwo);

    choiceModel = new PresentationModel(this);
    ValueModel gradientValue = choiceModel.getModel(ColorGradientEditor.GRADIENT_SETTING_PROPERTY);
    oneColorButton = BasicComponentFactory.createRadioButton(gradientValue,
            ColorGradientEditor.ONE_COLOR_GRADIENT, "One Color");
    twoColorButton = BasicComponentFactory.createRadioButton(gradientValue,
            ColorGradientEditor.TWO_COLOR_GRADIENT, "Two Color");

    initBindings();// w  w  w. j  a v  a 2s . c o  m
    initLayout();

}

From source file:com.eviware.soapui.impl.rest.panels.resource.RestParamsTable.java

License:EUPL

private JComponent buildDetails() {
    paramDetailsModel = new PresentationModel<RestParamProperty>(null);
    detailsForm = new SimpleBindingForm(paramDetailsModel);

    detailsForm.addSpace(5);//  w w  w. j a  v  a2 s . co m
    detailsForm.appendCheckBox("required", "Required", "Sets if parameter is required");

    List<QName> types = new ArrayList<QName>();
    for (SchemaType type : XmlBeans.getBuiltinTypeSystem().globalTypes()) {
        types.add(type.getName());
    }

    detailsForm.appendComboBox("type", "Type", types.toArray(), "The type of the parameter");
    StringListFormComponent optionsFormComponent = new StringListFormComponent(
            "Available values for this Parameter");
    //TODO: Consider removing hardcoded size
    optionsFormComponent.setPreferredSize(new Dimension(350, 100));
    detailsForm.appendComponent("options", "Options", optionsFormComponent);
    detailsForm.appendTextField("description", "Description", "A short description of the parameter");
    detailsForm.appendCheckBox("disableUrlEncoding", "Disable Encoding",
            "Disables URL-Encoding of the parameter value");

    detailsForm.addSpace(5);

    detailsForm.setEnabled(false);

    return new JScrollPane(detailsForm.getPanel());
}

From source file:com.eviware.soapui.impl.wsdl.mock.dispatch.QueryMatchMockOperationDispatcher.java

License:EUPL

protected Component buildQueryDetailComponent() {
    queryDetailFormPresentationModel = new PresentationModel<Query>(null);
    detailForm = new SimpleBindingForm(queryDetailFormPresentationModel);

    detailForm.setDefaultTextAreaRows(5);
    detailForm.setDefaultTextAreaColumns(50);

    detailForm.append(buildQueryToolbar());
    detailForm.appendTextArea("query", "XPath", "The XPath to query in the request");
    detailForm.appendTextArea("match", "Expected Value", "The value to match");
    JComboBox comboBox = detailForm.appendComboBox("response", "Dispatch to", new MockResponsesComboBoxModel(),
            "The MockResponse to dispatch to");
    UISupport.setFixedSize(comboBox, 150, 20);
    detailForm.appendCheckBox("disabled", "Disabled", "Disables this Query");

    return new JScrollPane(detailForm.getPanel());
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.crypto.MerlinCrypto.java

License:Open Source License

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<MerlinCrypto>(this));

    form.appendTextField("keystore", "Keystore", "The keystore file");
    form.appendPasswordField("password", "Password", "The keystore password");
    form.appendComboBox("type", "Type", new String[] { "JKS", "PKCS12" }, "The keystore type");

    form.addRightComponent(validateButton = new JButton("Validate"));

    validateButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNullOrEmpty(getPassword())) {
                UISupport.showErrorMessage("Missing password");
                return;
            }// www . j  av  a  2 s .  com

            try {
                Crypto crypto = getCrypto();
                UISupport.showInfoMessage("Loaded keystore of type: " + crypto.getKeyStore().getType());
            } catch (Throwable t) {
                UISupport.showErrorMessage(t);
            }

        }
    });

    return form.getPanel();
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.AddEncryptionEntry.java

License:Open Source License

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<AddSignatureEntry>(this));

    form.addSpace(5);/*from www.  j a v a2 s  .  com*/
    wssContainerListener = new InternalWssContainerListener();
    getWssContainer().addWssContainerListener(wssContainerListener);

    KeystoresComboBoxModel keystoresComboBoxModel = new KeystoresComboBoxModel(getWssContainer(),
            getWssContainer().getCryptoByName(crypto));
    form.appendComboBox("crypto", "Keystore", keystoresComboBoxModel,
            "Selects the Keystore containing the key to use for signing").addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    keyAliasComboBoxModel.update(getWssContainer().getCryptoByName(crypto));
                }
            });

    keyAliasComboBoxModel = new KeyAliasComboBoxModel(getWssContainer().getCryptoByName(crypto));
    form.appendComboBox("username", "Alias", keyAliasComboBoxModel,
            "The alias for the key to use for encryption");

    form.appendPasswordField("password", "Password",
            "The password for the key to use for encryption (if it is private)");

    form.appendComboBox("keyIdentifierType", "Key Identifier Type", new Integer[] { 0, 1, 3, 4, 5, 6, 8 },
            "Sets which key identifier to use").setRenderer(new KeyIdentifierTypeRenderer());

    (embeddedKeyNameTextField = form.appendTextField("embeddedKeyName", "Embedded Key Name",
            "The embedded key name")).setEnabled(keyIdentifierType == WSConstants.EMBEDDED_KEYNAME);
    (embeddedKeyNamePassword = form.appendPasswordField("embeddedKeyPassword", "Embedded Key Password",
            "The embedded key password")).setEnabled(keyIdentifierType == WSConstants.EMBEDDED_KEYNAME);

    form.appendComboBox(
            "symmetricEncAlgorithm", "Symmetric Encoding Algorithm", new String[] { DEFAULT_OPTION,
                    WSConstants.AES_128, WSConstants.AES_192, WSConstants.AES_256, WSConstants.TRIPLE_DES },
            "Set the name of the symmetric encryption algorithm to use");

    form.appendComboBox("encKeyTransport", "Key Encryption Algorithm",
            new String[] { DEFAULT_OPTION, WSConstants.KEYTRANSPORT_RSA15, WSConstants.KEYTRANSPORT_RSAOEP },
            "Sets the algorithm to encode the symmetric key");

    form.appendComboBox("encryptionCanonicalization", "Encryption Canonicalization",
            new String[] { DEFAULT_OPTION, WSConstants.C14N_OMIT_COMMENTS, WSConstants.C14N_WITH_COMMENTS,
                    WSConstants.C14N_EXCL_OMIT_COMMENTS, WSConstants.C14N_EXCL_WITH_COMMENTS },
            "Set the name of an optional canonicalization algorithm to use before encryption");

    form.appendCheckBox("encryptSymmetricKey", "Create Encrypted Key",
            "Indicates whether to encrypt the symmetric key into an EncryptedKey or not");

    form.append("Parts", new WSPartsTable(parts, this));

    return new JScrollPane(form.getPanel());
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.AddSignatureEntry.java

License:Open Source License

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<AddSignatureEntry>(this));
    form.addSpace(5);/*from   w  ww  .ja  v a2 s.c  om*/
    wssContainerListener = new InternalWssContainerListener();
    getWssContainer().addWssContainerListener(wssContainerListener);

    form.appendComboBox("crypto", "Keystore",
            new KeystoresComboBoxModel(getWssContainer(), getWssContainer().getCryptoByName(crypto)),
            "Selects the Keystore containing the key to use for signing").addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    keyAliasComboBoxModel.update(getWssContainer().getCryptoByName(crypto));
                }
            });

    keyAliasComboBoxModel = new KeyAliasComboBoxModel(getWssContainer().getCryptoByName(crypto));
    form.appendComboBox("username", "Alias", keyAliasComboBoxModel,
            "The alias for the key to use for encryption");

    // form.appendTextField( "username", "Alias", "The certificate alias" );
    form.appendPasswordField("password", "Password", "The certificate password");

    form.appendComboBox("keyIdentifierType", "Key Identifier Type", new Integer[] { 0, 1, 3, 4 },
            "Sets which key identifier to use").setRenderer(new KeyIdentifierTypeRenderer());
    form.appendComboBox("signatureAlgorithm", "Signature Algorithm", new String[] { DEFAULT_OPTION,
            WSConstants.RSA, WSConstants.DSA, XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
            XMLSignature.ALGO_ID_MAC_HMAC_SHA256, XMLSignature.ALGO_ID_MAC_HMAC_SHA384,
            XMLSignature.ALGO_ID_MAC_HMAC_SHA512, XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160,
            XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5, XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1,
            XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5, XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1,
            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256, XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384,
            XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512, XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160 },
            "Set the name of the signature encryption algorithm to use");
    form.appendComboBox("signatureCanonicalization", "Signature Canonicalization",
            new String[] { DEFAULT_OPTION, WSConstants.C14N_OMIT_COMMENTS, WSConstants.C14N_WITH_COMMENTS,
                    WSConstants.C14N_EXCL_OMIT_COMMENTS, WSConstants.C14N_EXCL_WITH_COMMENTS },
            "Set the canonicalization method to use.");

    /* ADDED: Combo box for selecting digest algorithm */
    form.appendComboBox("digestAlgorithm", "Digest Algorithm",
            new String[] { DEFAULT_OPTION, MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160 },
            "Set the digest algorithm to use");

    form.appendCheckBox("useSingleCert", "Use Single Certificate", "Use single certificate for signing");

    form.append("Parts", new WSPartsTable(parts, this));

    return new JScrollPane(form.getPanel());
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.AddTimestampEntry.java

License:Open Source License

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<AddTimestampEntry>(this));
    form.addSpace(5);// w  w  w.  j  av a2 s. c  o  m
    form.appendTextField("timeToLive", "Time To Live", "Sets the TimeToLive value for the Timestamp Token");
    form.appendCheckBox("strictTimestamp", "Millisecond Precision",
            "Sets precision of timestamp to milliseconds");

    return form.getPanel();
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.AddUsernameEntry.java

License:Open Source License

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<AddUsernameEntry>(this));
    form.addSpace(5);//  w w w. ja  v  a2 s  .c  om
    form.appendTextField("username", "Username", "The username for this token");
    form.appendPasswordField("password", "Password", "The password for this token");

    form.appendCheckBox("addNonce", "Add Nonce", "Adds a nonce");
    form.appendCheckBox("addCreated", "Add Created", "Adds a created");

    form.appendComboBox("passwordType", "Password Type",
            new String[] { PASSWORD_TEXT, PASSWORD_DIGEST, PASSWORD_DIGEST_EXT },
            "The password type to generate");

    return form.getPanel();
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.AutomaticSAMLEntry.java

License:EUPL

@Override
protected JComponent buildUI() {
    wssContainerListener = new InternalWssContainerListener();
    getWssContainer().addWssContainerListener(wssContainerListener);

    form = new SimpleBindingForm(new PresentationModel<SignatureEntry>(this));

    form.addSpace(5);//from   ww w  .j av a2s.c o  m

    form.appendComboBox("samlVersion", "SAML version", new String[] { SAML_VERSION_1, SAML_VERSION_2 },
            "Choose the SAML version");

    signedCheckBox = form.appendCheckBox("signed", "Signed", null);
    signedCheckBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            checkSigned();
        }

    });

    form.appendComboBox("assertionType", "Assertion type",
            new String[] { AUTHENTICATION_ASSERTION_TYPE, ATTRIBUTE_ASSERTION_TYPE,
                    AUTHORIZATION_ASSERTION_TYPE },
            "Choose the type of assertion").addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    checkAssertionType();
                }

            });

    confirmationMethodComboBox = form.appendComboBox("confirmationMethod", "Confirmation method",
            new String[] { SENDER_VOUCHES_CONFIRMATION_METHOD }, "Choose the confirmation method");

    cryptoComboBox = form.appendComboBox("crypto", "Keystore",
            new KeystoresComboBoxModel(getWssContainer(), getWssContainer().getCryptoByName(crypto), true),
            "Selects the Keystore containing the key to use for signing the SAML message");

    cryptoComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            // FIXME This cases the drop down to be blank when changing keystore
            keyAliasComboBoxModel.update(getWssContainer().getCryptoByName(crypto));
        }
    });

    keyAliasComboBoxModel = new KeyAliasComboBoxModel(getWssContainer().getCryptoByName(crypto));
    keyAliasComboBox = form.appendComboBox("username", "Alias", keyAliasComboBoxModel,
            "The alias for the key to use for encryption");

    passwordField = form.appendPasswordField("password", "Password", "The certificate password");

    form.appendTextField("issuer", "Issuer", "The issuer");

    form.appendTextField("subjectName", "Subject Name", "The subject qualifier");

    form.appendTextField("subjectQualifier", "Subject Qualifier", "The subject qualifier");

    form.appendComboBox("digestAlgorithm", "Digest Algorithm",
            new String[] { MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384,
                    MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512 },
            "Set the digest algorithm to use");

    form.appendComboBox("signatureAlgorithm", "Signature Algorithm",
            new String[] { WSConstants.RSA, WSConstants.DSA, XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256,
                    XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384, XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512,
                    XMLSignature.ALGO_ID_MAC_HMAC_SHA1, XMLSignature.ALGO_ID_MAC_HMAC_SHA256,
                    XMLSignature.ALGO_ID_MAC_HMAC_SHA384, XMLSignature.ALGO_ID_MAC_HMAC_SHA512 },
            "Set the name of the signature encryption algorithm to use");

    attributeNameTextField = form.appendTextField("attributeName", "Attribute name",
            "The name of the attribute");

    samlAttributeValuesTable = new SAMLAttributeValuesTable(attributeValues, this);
    form.append("Attribute values", samlAttributeValuesTable);

    initComponentsEnabledState();

    return new JScrollPane(form.getPanel());
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.entries.EncryptionEntry.java

License:EUPL

@Override
protected JComponent buildUI() {
    SimpleBindingForm form = new SimpleBindingForm(new PresentationModel<SignatureEntry>(this));

    form.addSpace(5);/*from ww w .  j a v a 2  s .co  m*/
    wssContainerListener = new InternalWssContainerListener();
    getWssContainer().addWssContainerListener(wssContainerListener);

    KeystoresComboBoxModel keystoresComboBoxModel = new KeystoresComboBoxModel(getWssContainer(),
            getWssContainer().getCryptoByName(crypto), true);
    form.appendComboBox("crypto", "Keystore", keystoresComboBoxModel,
            "Selects the Keystore containing the key to use for signing").addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    keyAliasComboBoxModel.update(getWssContainer().getCryptoByName(crypto));
                }
            });

    keyAliasComboBoxModel = new KeyAliasComboBoxModel(getWssContainer().getCryptoByName(crypto));
    form.appendComboBox("username", "Alias", keyAliasComboBoxModel,
            "The alias for the key to use for encryption");

    form.appendPasswordField("password", "Password",
            "The password for the key to use for encryption (if it is private)");

    form.appendComboBox("keyIdentifierType", "Key Identifier Type", new Integer[] { 1, 2, 3, 4, 5, 6, 8 },
            "Sets which key identifier to use").setRenderer(new KeyIdentifierTypeRenderer());

    (embeddedKeyNameTextField = form.appendTextField("embeddedKeyName", "Embedded Key Name",
            "The embedded key name")).setEnabled(keyIdentifierType == WSConstants.EMBEDDED_KEYNAME);
    (embeddedKeyNamePassword = form.appendPasswordField("embeddedKeyPassword", "Embedded Key Password",
            "The embedded key password")).setEnabled(keyIdentifierType == WSConstants.EMBEDDED_KEYNAME);

    form.appendComboBox(
            "symmetricEncAlgorithm", "Symmetric Encoding Algorithm", new String[] { DEFAULT_OPTION,
                    WSConstants.AES_128, WSConstants.AES_192, WSConstants.AES_256, WSConstants.TRIPLE_DES },
            "Set the name of the symmetric encryption algorithm to use");

    form.appendComboBox("encKeyTransport", "Key Encryption Algorithm",
            new String[] { DEFAULT_OPTION, WSConstants.KEYTRANSPORT_RSA15, WSConstants.KEYTRANSPORT_RSAOEP },
            "Sets the algorithm to encode the symmetric key");

    form.appendCheckBox("encryptSymmetricKey", "Create Encrypted Key",
            "Indicates whether to encrypt the symmetric key into an EncryptedKey or not");

    form.append("Parts", new WSPartsTable(parts, this));

    return new JScrollPane(form.getPanel());
}