Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Problem with plug-in creation : Mvc and Xul management

  1. #1
    Join Date
    Jan 2017
    Posts
    2

    Question Problem with plug-in creation : Mvc and Xul management

    Hello there,

    I am a young Java developper and i am currently trying to create a new plug-in for PDI. I want to implement an HTTP Client to Spoon, allowing the user to access my own transformation, jobs, features, ect...

    My problem is i can't reach to change some Xul components from my Java code.

    As an overlay, i put a new menupopup to the main menu bar. Some of the items inside possess a "disabled" tag :

    Code:
    <menuitem id="open-item" label="Ouvrir..." disabled="true"/>
    I want to change the disabled value to "false" when i'm connected. So i tried the following :

    - To use some XulComponent objects, and i managed to change this kind of object's disabled value, but it doesn't reflect on Spoon. I suppose it's because the change happen in the object only.

    Code:
    XulComponent xc =   (XulComponent) document.getElementById("myMenu").getElementById("open-item"); 
    xc.setAttribute("disabled", "false");
    - To use Bindings, but as the bind() method is deprecated, i can't use the tutorial method from here : http://wiki.pentaho.com/display/Serv...L+Applications

    So i turned to some BindingFactory as it seems to be the new way to make it, but when i change my own object parameters value after a bind, it doesn't seems to change the value of XulComponent or the value in Xul file either.

    Here is the binding code (inside my handler object) :

    Code:
    public void test(){
    
        XulComponent xc =   (XulComponent) document.getElementById("myMenu").getElementById("open-item");        
        BindingFactory bf = new DefaultBindingFactory();
        bf.setDocument(document);
        Binding bind = bf.createBinding(mm1, "okEnabled", xc, "disabled"); // mm1 is just an object with a name(string) and a enabled(boolean) parameters
        mm1.setOkEnabled(false);
    
        }
    and the xul file :
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
    <overlay id="my-overlay" title="my overlay"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        height="600"
        width="800" xmlns:pen="http://www.pentaho.org/2008/xul">
    
    
        <menubar id="spoon-menubar">
            <menu id="myMenu" label="my Menu">
                <menupopup id="myMenu-popup">
                    <menuitem id="connect" label="Se connecter"  command="myMenu.showLogin()"/>
                    <menuseparator id="myMenu-separator-1"/>
                    <menuitem id="open-item" label="Ouvrir..." disabled="true"/>
                    <menuitem id="save-as-item" label="Enregistrer sous..." disabled="true" />
                    <menuseparator id="myMenu-separator-2"/>
                    <menu id="publish" label="Publier" >
                        <menupopup id="publish-popup">
                            <menuitem id="publish-transformation" label="Transformation" disabled="true"/>
                            <menuitem id="publish-job" label="Job" disabled="true"/>
                        </menupopup>
                    </menu>
                    <menuseparator id="myMenu-separator-3"/>
                    <menuitem id="close-item" label="Fermer" command ="myMenu.showLoginAlert()"/>
                </menupopup>
            </menu>
        </menubar>    
    </overlay>
    As i'm still inexperienced with Pentaho, idon't know if i am on the good way to solve it. Or am i totally wrong? is there another way to make it properly?

    Thank you in advance for your answers, and sorry if i made some mistake with my english. If you need any others informations, please just tell me and i'll try to answer as fast as possible.

  2. #2
    Join Date
    Jan 2017
    Posts
    2

    Default

    I would make a little up on this post, does anyone know more about this please? I'm truly stuck with this thing :/ .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.