Examples of PolicyType


Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

            // iterate over the fields so that we can add the correct label and
            // control for each field
            for (Iterator i=fields.iterator(); i.hasNext();) {
                // no need to check the element is a "field" element
                final Element field = (Element) i.next();
                final PolicyType fieldType = getPolicyTypeForField(field);
                final String fieldName = getFieldName(field);

                // create the label for the field. Note, the PolicyType
                // determines wether the field requires a label, the label
                // returned could be null.
                Label label = createLabel(control, fieldType, fieldName);

                // create the policy value modifier
                PolicyValueModifier policyValueModifier =
                            fieldType.createPolicyValueModifier(
                                        control,
                                        style,
                                        policyName,
                                        repositoryManager);
                // add a listener to the policy value modifier so that we
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

                        DeviceRepositorySchemaConstants.
                        POLICY_DEFINITION_TYPE_ELEMENT_NAME +
                        " element");
        }
        // Obtain the type element for the field
        PolicyType policyType = PolicyType.getType(fieldType);
        // if type is null then the type element did not specify a recognised
        // type.
        if (policyType == null) {
            throw new IllegalStateException(
                        DeviceRepositorySchemaConstants.
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

    private void updatePolicyTypeCombo() {
        DeviceRepositoryAccessorManager dram =
                    context.getDeviceRepositoryAccessorManager();

        Element typeElement = dram.getTypeDefinitionElement(getPolicyName());
        PolicyType type = PolicyType.getType(typeElement);
        if (!typeCombo.getValue().equals(type)) {
            typeCombo.removeSelectionListener(typeSelectionListener);
            try {
                // update the types in the compo
                typeCombo.setItems(DevicesMessages.getLocalizedPolicyTypes(
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

        Element typeElement = dram.getTypeDefinitionElement(getPolicyName());

        PolicyTypeComposition composition =
                    PolicyTypeComposition.getComposition(typeElement);

        PolicyType policyType = (PolicyType) typeCombo.getValue();
        PolicyType currentType =
                    PolicyTypeComposition.getPolicyType(typeElement);

        if (currentType != policyType) {
            policyDefinition.removeChangeListener(odomChangeListener);
            try {
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

    private void updateOptionalTypeControls() {
        DeviceRepositoryAccessorManager dram =
                    context.getDeviceRepositoryAccessorManager();

        Element typeElement = dram.getTypeDefinitionElement(getPolicyName());
        PolicyType type = PolicyType.getType(typeElement);

        // If the optional controls already exist for the policy type, then we
        // do not recreate them - this prevents flicker as related values are
        // changed.
        if (type == PolicyType.RANGE) {
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

            String policyName = (String) policyNamesIterator.next();

            Element typeElement = context.getDeviceRepositoryAccessorManager().
                    getTypeDefinitionElement(policyName);

            PolicyType policyType = PolicyType.getType(typeElement);

            PolicyTypeComposition composition =
                    PolicyTypeComposition.getComposition(typeElement);

            // Assume no label is required. {@See #policyTypesWithoutLabels}.
View Full Code Here

Examples of com.volantis.mcs.eclipse.ab.editors.devices.types.PolicyType

        // The Label widget is only used if the policy type is not boolean,
        // since the boolean modifier does its own labelling
        Label policyLabel = null;

        Element policyTypeElement = deviceRAM.getTypeDefinitionElement(policyName);
        PolicyType policyType = PolicyType.getType(policyTypeElement);
        int numColumns = 2;

        if (!policyType.equals(PolicyType.BOOLEAN)) {
            // Non-boolean so a Label widget is needed.
            policyLabel = new Label(controllerComposite, SWT.NONE);
            // Set the label's text to be the localized policy name.
            policyLabel.setText(deviceRAM.getLocalizedPolicyName(policyName));
            // A non-null label means 3 columns are needed.
View Full Code Here

Examples of com.volantis.mcs.policies.PolicyType

                for (Iterator i = ARGUMENT_2_POLICY_TYPE.entrySet().iterator();
                     i.hasNext();) {
                    Map.Entry entry = (Map.Entry) i.next();
                    String policyArgument = (String) entry.getKey();
                    PolicyType policyType = (PolicyType) entry.getValue();

                    transferPolicies(policyArgument, policyType);
                }

                if(undoable) {
View Full Code Here

Examples of com.volantis.mcs.policies.PolicyType

     * Check the valid content types for the policy type supported by this
     * asset content section, and set up a series of flags indicating whether
     * the policy supports each possible type of content.
     */
    private void checkContentTypes() {
        PolicyType policyType = context.getPolicyType();
        PolicyModelSet modelSet = PolicyModelSet.getModelSet(policyType);

        Class[] contentTypes = modelSet.getContentClasses();
        if (contentTypes != null) {
            for (int i = 0; i < contentTypes.length; i++) {
View Full Code Here

Examples of com.volantis.mcs.policies.PolicyType

        final PolicyType[] types = policyModelSet.getFallBackTypes();
        Map typesToTextComponents = new HashMap();

        if (types != null && types.length > 0) {
            for (int i = 0; i < types.length; i++) {
                final PolicyType type = types[i];
                String labelString = EditorMessages.getString(
                        RESOURCE_PREFIX + StringUtils.toLowerIgnoreLocale(
                                types[i].toString()) + ".fallback.label");

                Label fallBackLabel = new Label(parent, SWT.NONE);
                setDefaultColour(fallBackLabel);
                fallBackLabel.setText(labelString);
                GridData data =
                        new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
                fallBackLabel.setLayoutData(data);
                enableableControls.add(fallBackLabel);

                Composite entry = new Composite(parent, SWT.NONE);
                GridLayout layout = new GridLayout(2, false);
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                entry.setLayout(layout);
                data = new GridData(GridData.FILL_HORIZONTAL);
                entry.setLayoutData(data);
                setDefaultColour(entry);

                final Text fallBackText = new Text(entry, SWT.BORDER);
                data = new GridData(GridData.FILL_HORIZONTAL);
                fallBackText.setLayoutData(data);
                typesToTextComponents.put(type, fallBackText);
                enableableControls.add(fallBackText);

                final PolicySelectorBrowseAction browseAction =
                        new PolicySelectorBrowseAction(FileExtension.
                                getFileExtensionForPolicyType(types[i]));

                Button button = new Button(entry, SWT.NONE);
                button.setText("Browse...");
                button.addSelectionListener(new SelectionListener() {
                    private void handleSelection() {
                        String oldText = fallBackText.getText();
                        String policyValue = browseAction.doBrowse(
                                oldText, parent, context);

                        // Has anything changed?
                        if (policyValue != null &&
                                !policyValue.equals(oldText)) {
                            fallBackText.setText(policyValue);
                            setFallbackPolicy(type, policyValue);
                        }
                    }

                    public void widgetSelected(SelectionEvent event) {
                        handleSelection();
                    }

                    public void widgetDefaultSelected(SelectionEvent event) {
                        handleSelection();
                    }
                });
                enableableControls.add(button);
            }

            // Initialise the fallback policies
            ListProxy alternatePolicies =
                    (ListProxy) ((BeanProxy) context.getInteractionModel()).
                            getPropertyProxy(PolicyModel.ALTERNATE_POLICIES);
            int size = alternatePolicies.size();

            for (int i = 0; i < size; i++) {
                Proxy itemProxy = alternatePolicies.getItemProxy(i);
                Object modelObject = itemProxy.getModelObject();
                PolicyReference ref = (PolicyReference) modelObject;
                Text text = (Text) typesToTextComponents
                        .get(ref.getExpectedPolicyType());
                text.setText(ref.getName());
            }

            // Register the listeners for the fallback GUI components
            for (int i = 0; i < types.length; i++) {
                final PolicyType type = types[i];
                final Text text = (Text) typesToTextComponents.get(type);
                text.addModifyListener(new ModifyListener() {
                    public void modifyText(ModifyEvent event) {
                        setFallbackPolicy(type, text.getText());
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.