Package gov.nasa.arc.mct.policy

Examples of gov.nasa.arc.mct.policy.ExecutionResult


                boolean flag = verify(name.getText().trim());
                create.setEnabled(flag);
                message.setIcon((flag) ? null : MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                message.setText((flag) ? "" : ERRORMSG);
               
                ExecutionResult exResult = checkReservedWordsNamingPolicy(name.getText().trim());
                if (!exResult.getStatus()) {
                    create.setEnabled(false);
                    message.setIcon(MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                    message.setText(exResult.getMessage());
                }

            }

        });
View Full Code Here


    private ExecutionResult checkReservedWordsNamingPolicy(String name) {
       
        PolicyContext context = new  PolicyContext();
        context.setProperty("NAME", name);
        String namingKey = PolicyInfo.CategoryType.COMPONENT_NAMING_POLICY_CATEGORY.getKey();
        ExecutionResult exResult = PolicyManagerImpl.getInstance().execute(namingKey, context);
       
        return exResult;           
    }
View Full Code Here

                boolean flag = verify(name.getText().trim());
                create.setEnabled(flag);
                message.setIcon((flag) ? null : MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                message.setText((flag) ? "" : errorMessage);
               
                ExecutionResult exResult = checkReservedWordsNamingPolicy(name.getText().trim());
                if (!exResult.getStatus()) {
                    create.setEnabled(false);
                    message.setIcon(MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                    message.setText(exResult.getMessage());
    
                   
                }

            }

        });
       
        name.addKeyListener(new KeyAdapter() {
            public void keyReleased(KeyEvent e) {
                if (!checkReservedWordsNamingPolicy(name.getText().trim()).getStatus()) {
                    name.setForeground(Color.RED);
                } else {
                    name.setForeground(Color.BLACK);
                }
            }

        });

        JPanel controlPanel = new JPanel();
        create.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
 
                // now, make sure the name selected does not have any reserved words.
               
                ExecutionResult exResult = checkReservedWordsNamingPolicy(name.getText().trim());
               
                if (!exResult.getStatus()) {
                    PlaceObjectsInCollectionDialog.this.setVisible(true);
                     OptionBox.showMessageDialog(null,
                            "<HTML>Unable to create group with given string (" + name.getText().trim() +") - Reserved names violation.<BR>" +
                            "Violated name: " + exResult.getMessage(),
                            "Error creating group with entered name",
                            OptionBox.ERROR_MESSAGE);
                   
                     confirmed = false;
                    
View Full Code Here

    private ExecutionResult checkReservedWordsNamingPolicy(String name) {
       
        PolicyContext context = new  PolicyContext();
        context.setProperty("NAME", name);
        String namingkey = PolicyInfo.CategoryType.COMPONENT_NAMING_POLICY_CATEGORY.getKey();
        ExecutionResult exResult = PolicyManagerImpl.getInstance().execute(namingkey, context);
       
        return exResult;           
    }
View Full Code Here

     */
    public final JComponent getControlManifestation() {
        PolicyContext policyContext = new PolicyContext();
        policyContext.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), getManifestedComponent());       
        policyContext.setProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), getInfo());
        ExecutionResult result = PlatformAccess.getPlatform().getPolicyManager().execute(PolicyInfo.CategoryType.SHOW_HIDE_CTRL_MANIFESTATION.getKey(), policyContext);
        if (!result.getStatus())
            return null;
       
        controlManifestation = initializeControlManifestation();
        if (controlManifestation != null) {
            controlWrapper = new ControlWrapper(controlManifestation);
View Full Code Here

    @BeforeClass
    public void setupPlatform() {
       
        oldPlatform = PlatformAccess.getPlatform();
       
        ExecutionResult trueResult = new ExecutionResult(null, true, null);
        PolicyManager mockPolicyManager = Mockito.mock(PolicyManager.class);
        Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.<PolicyContext>any())).thenReturn(trueResult);
        Platform mockPlatform = Mockito.mock(Platform.class);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
View Full Code Here

               
                duplicate.setEnabled(flag);
                message.setIcon((flag) ? null : MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                message.setText((flag) ? "" : ERRORMSG);
               
                ExecutionResult exResult = checkReservedWordsNamingPolicy(name.getText().trim());
                if (!exResult.getStatus()) {
                    duplicate.setEnabled(false);
                    message.setIcon(MCTIcons.getErrorIcon(ICON_WIDTH, ICON_HEIGHT));
                    message.setText(exResult.getMessage());    
                }

            }

        });
       
        name.addKeyListener(new KeyAdapter() {
            public void keyReleased(KeyEvent e) {
                if (!checkReservedWordsNamingPolicy(name.getText().trim()).getStatus()) {
                    name.setForeground(Color.RED);
                } else {
                    name.setForeground(Color.BLACK);
                }
            }

        });
        contentPanel.add(prompt);
        contentPanel.add(name);

        JPanel controlPanel = new JPanel();
        duplicate.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
               
               // now, make sure the name selected does not have any reserved words.
               
              ExecutionResult exResult = checkReservedWordsNamingPolicy(name.getText().trim());
               
                if (!exResult.getStatus()) {
                    DuplicateObjectDialog.this.setVisible(true);
                   
                    OptionBox.showMessageDialog(null,
                            String.format(bundle.getString("ERRMSG_RESERVED"),
                                      name.getText().trim(),
                                      exResult.getMessage()),
                            bundle.getString("ERRTITLE_RESERVED"),         
                            OptionBox.ERROR_MESSAGE);
                   
                     confirmed = false;
                    
View Full Code Here

    private ExecutionResult checkReservedWordsNamingPolicy(String name) {
       
        PolicyContext context = new  PolicyContext();
        context.setProperty("NAME", name);
        String namingKey = PolicyInfo.CategoryType.COMPONENT_NAMING_POLICY_CATEGORY.getKey();
        ExecutionResult exResult = PolicyManagerImpl.getInstance().execute(namingKey, context);
       
        return exResult;           
    }
View Full Code Here

           
            private boolean canComponentBeContained() {
                PolicyContext policyContext = new PolicyContext();
                policyContext.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(),Collections.singleton(context.getWindowManifestation().getManifestedComponent()));
                String policyCategoryKey = PolicyInfo.CategoryType.CAN_OBJECT_BE_CONTAINED_CATEGORY.getKey();
                ExecutionResult result = PolicyManagerImpl.getInstance().execute(policyCategoryKey, policyContext);
                return result.getStatus();
            }

            @Override
            protected Transferable createTransferable(JComponent c) {
                View v = context.getWindowManifestation();
View Full Code Here

        mockPersistence = Mockito.mock(PersistenceProvider.class);
        (new PlatformAccess()).setPlatform(mockPlatform);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistence);
        Mockito.when(mockPlatform.getMySandbox()).thenReturn(mySandbox);
        ExecutionResult er = new ExecutionResult(null, true, null);
        Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(er);
    }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.policy.ExecutionResult

Copyright © 2018 www.massapicom. 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.