Bonjour,
J'ai un souci dont je ne sais comment résoudre.
J'ai crée un java bean auquel je passe un string à travers la forms et le java bean doit l'afficher dans un Jframe.
Pour la première fois ça marche même qd je change de forms. Mais mon souci c'est qd je suis dans la même forms et que je modifie la chaine passée au bean, il garde toujours l'ancienne valeur


Java Bean:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
public class Aide extends VBean {
 
    private static final ID Show  = ID.registerProperty("SHOW");
    private static final ID Clear = ID.registerProperty("CLEAR"); 
 
    JFrame   fm = new JFrame("SyGACUT Aide");
    IHandler mHandler; 
    static String htmlString = "" ;
    //public static void main(String[] args)
    //{
    //  new Aide();
    //}
    public void init(IHandler handler)
    {
       super.init(handler);
       mHandler = handler;
    }
 
    public boolean setProperty(ID property, Object value) {
        if (property == Clear) {
            htmlString = "" ; 
             return true;
        }
        else if(property == Show) {
             htmlString = (String)value ;
             Show();
             return true;
         }
         // ------ other properties --------
         else {
            return super.setProperty(property, value);
         }
    }
 
    private void Show()
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                // create jeditorpane
                JEditorPane jEditorPane = new JEditorPane();
 
                // make it read-only
                jEditorPane.setEditable(false);
 
                // create a scrollpane; modify its attributes as desired
                JScrollPane scrollPane = new JScrollPane(jEditorPane);
 
                // add an html editor kit
                HTMLEditorKit kit = new HTMLEditorKit();
                jEditorPane.setEditorKit(kit);
 
                // add some styles to the html
                StyleSheet styleSheet = kit.getStyleSheet();
                styleSheet.addRule("body {color:#000; font-family:times; margin: 4px; }");
                styleSheet.addRule("h1 {color: blue;}");
                styleSheet.addRule("h2 {color: #ff0000;}");
                styleSheet.addRule("pre {font : 10px monaco; color : black; background-color : #fafafa; }");
 
                // create some simple html as a string
                /*String htmlString = "<html>\n"
                                  + "<body>\n"
                                  + "<hr/><center><h1>Welcome!</h1></center><hr/>\n"
                                  + "<h2>This is an H2 header</h2>\n"
                                  + "<p>This is some sample text</p>\n"
                                  + "<p><a href=\"http://devdaily.com/blog/\">devdaily blog</a></p>\n"
                                  + "</body>\n";*/
 
                // create a document, set it on the jeditorpane, then add the html
                Document doc = kit.createDefaultDocument();
                jEditorPane.setDocument(doc);
                jEditorPane.setText(htmlString);
 
                // now add it all to a frame
                //JFrame j = new JFrame("HtmlEditorKit Test");
                fm.getContentPane().add(scrollPane, BorderLayout.CENTER);
                // make it easy to close the application
                //fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                fm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                // display the frame
                fm.setSize(new Dimension(500,400));
                // pack it, if you prefer
                //j.pack();
                // center the jframe, then make it visible
                fm.setLocationRelativeTo(null);
                fm.setVisible(true);
             }
         });
     }
}
oracle forms

Procedure Pb_Show_Help:
j'utilise une variable globale dont je peux modifier la valeur avant d'appeler la procedure

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
Procedure Pb_Show_Help
 (
   PC$Bean In Varchar2
 
 ) Is
 
Begin
  -- Clear text --
  Set_Custom_Property( PC$Bean, 1, 'CLEAR','');
  Set_Custom_Property( PC$Bean, 1, 'SHOW', Name_In('Global.Aide_Html') );   
End;
Appele de la procedure
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Pb_Show_Help('LAF_BLOCK.AIDE');
Resume
Forms A
:Global.Aide_Html := 'vert';

Java Bean affiche vert
Forms B
:Global.Aide_Html := 'mange';

Java Bean affiche mange

:Global.Aide_Html := 'banane';
Java Bean affiche toujours mange

merci d'avance si vous avez des solutions