Package org.sodbeans.controller.impl.processors

Examples of org.sodbeans.controller.impl.processors.ButtonProcessor


    private JButton button;
    private String weblink = "org.netbeans.modules.welcome.content.WebLink";

    @Override
    protected SpeechProcessor getFocusEventProcessor() {
        ButtonProcessor proc = new ButtonProcessor();

        if (button == null)
            return new NullProcessor();

        String name;
        AccessibleContext context = button.getAccessibleContext();
        if (context.getAccessibleName() != null){
            name = context.getAccessibleName();
        }
        else{
            name = button.getText();
        }
            String clazz = button.getClass().getName();

        if(clazz != null && clazz.compareTo(weblink)==0) { //it's a web link, to at least give its URL.
            //grab its private field
            try {
                //it's a web link, to at least give its URL.
                //grab its private field
                Field url = button.getClass().getDeclaredField("url");
                url.setAccessible(true);
                name = (String) url.get(button);

            } catch (NoSuchFieldException ex) {
                Exceptions.printStackTrace(ex);
            } catch (SecurityException ex) {
                Exceptions.printStackTrace(ex);
            } catch (IllegalArgumentException ex) {
                Exceptions.printStackTrace(ex);
            } catch (IllegalAccessException ex) {
                Exceptions.printStackTrace(ex);
            }
        }

        if(name == null || name == "") {
            AccessibleContext ac = button.getAccessibleContext();
            if(ac != null) {
                name = ac.getAccessibleDescription();
            }
        }

        //ok, does it at least have a tooltip?
        if(name == null) {
            name = button.getToolTipText();
        }

        //a text field?
        if(name == null) {
            name = button.getText();
        }

        proc.setText(name);
       
        return proc;
    }
View Full Code Here

TOP

Related Classes of org.sodbeans.controller.impl.processors.ButtonProcessor

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.