Java 2 console event handling

Hi all,
Is there any way to handle the console events? I need something like AWT's WindowListener but for handling console events - "on close" in particular. I've written basic server app for a game, and it does not have gui (it only listens on specific port and sends messages from point A to point B). As usually on any Java app launch I get a console window (if not disabled of course...). The problem is, when I shut down the server, users don't get notified that the server was shut down, and they "loose" connection with each other without knowing it. So, I need an event listener which would catch the "On Close" or "On Exit" event of the console window when I press the "X" and CTRL+C to close server, where I would add code to send messages to all users to inform off server offline status.
Any help would be greatly appreciated,
Oleg

thanks, acneto. But then again, I would need a listener for keys for console events? Is there one? But even if there is, users won't bother themselves typing anything (they will have the server app too), they'll just close it by pressing the "X" or CTRL+C, and other users won't get notified, so it's better to have a console window listener or something... Well, if this is not possible then I guess it'll be easier to just create a simple gui and then I'd add usual AWT listener... just curious anyways. If anyone has any other suggestions, I'd gladly hear them.
Oleg

Similar Messages

  • Java 1 vs. Java 2 Event Handling

    Prelude: This question relates to writing code for event handling.
    Java 1 is based on a hierarchy model to handle events, ie. inheritance from superclasses. Java 2 uses delagation event handling method. Java 2 code will not compile if it includes Java 1 code still modeled according to Java 1 event handling.
    Question:
    Is it generally easier to start completely over in trying to convert Java 1 code into Java 2 code by not retaining any Java 1 code and begin reconceptualizing what is needed for a conversion to Java 2?

    From what I understand java2 should support both models, however not both at the same time, you cant mix the modles...
    I also think that the older models methods or at least most have been depreciated, meaning that the old model will, if it hasnt allready in the latest release, dissapear.. For that single reason I would recommend updating the event model to the delegation model if you hope to keep it around and running for years to come. You gain a bit by doing this since the newer model is much faster!!!

  • Call to pl/sql from java event-handler

    How can I call pl/sql procedure or function from java-script event handler
    Thanks,
    Anna

    Anna,
    You cannot call any arbitrary PLSQL code from the forms, only "standard"/custom event handlers can be called through do_event Javascript fuction, syntax :
    do_event(this.form,this.name,1,'ON_CLICK,'');
    where:
    1 - button intstance, if you have more than one instance of the same button on the screen this should be 2,3,4.....
    'ON_CLICK' - is the predefined event type
    '' - the last argument is any user defined string which will passed down to the PLSQL event handler.
    Thanks,
    Dmitry
    null

  • Java Event Handling in JSP Pages

    Dear All:
    This is what I wanna do. when user enters text in my <input type="text" ... > in my JSP page, I want to take this user entered data and convert it in another language simultaneously as the user is inputting text in another textarea.
    Right now the only choice I have is onChange="convert()" Javascript function.
    But I dont want to use Javascript as I already have a Java class which does that for the Swing GUI client.
    Is their a way i can embed java for event handling in jsp.
    thanks,
    Chetan

    only if you use an applet, javascript, etc.
    remember, jsp is server-side, not client-side
    what the client sees is html or whatever (i.e. static content)

  • General Event Handling (Outside AWT)

    Hi all, I am looking for info on allowing my classes to send and recieve events between classes (the set of events is to be defined by me). What is Java's event handling approach? Is there something outside the AWT?
    I realise there may be design patterns for this scenario but though there may be some Java specific way as well (like in the AWT).
    Thanks,
    David

    listeners.
    like this...
    FooEvent <- your event class
    FooEventListener <- listener interface
    FooMaker <- class that generates foo events
    An interface for the listener.
    public interface FooEventListener{
      public void processEvent(FooEvent evt);
    }the class making the events
    public FooMaker{
      // among other things might have methods like...
      public void addFooEventListener(FooEventListener fel){
        // add the listener to some collection
      // called when events happen
      private void notifyListeners(){
         // notify each listener
    }and your listeners will implement the interface.
    does that help?

  • Event Handling with Java API.: Adding to a hierarchy table throws 2events

    I´m having some problems with the event handling. I´ve registered a Class with extends AbstractDataListener as EventListener. When there are changes in the product hierarchy table, some extra work should be done. However if i add a new record into the hierarchy, two events are fired.
    DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R17;Getra?nke, SEW
    DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R17;32 Zoll, B&R
    DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R18;56 Zoll, Lenze
    DEBUG DataEventListener.java:123 - Added:Development;PRODUCT_HIERARCHY;R18;20 Zoll, allgemein
    In this case, i added the records "32 Zoll, B&R" and then "20 Zoll, allgemein". As you can see in both cases two events are fired and the first event seems to come with wrong data. The reported id for the newly created record is R17. For the logging, i did lookup the entry in the hierarchy table by id and use the displayvalue of the record. But the first event always shows the displayvalue from some already existing entry.
    How can i avoid duplicate events or if this is not possible, how i can recognize that the display value of the first event is not valid.

    I have not tetsted it yet, because I'm waiting for my server to be updated, but SAP told me that the API version 5.5.42.67 should fix the problem.
    Thanks for your post.

  • Event Handling - Swing Window to Console Switch

    I have a serious problem with an app I am writing - I have a swing 'main menu' system built around a standard JFrame which calls a new instance of another class. This other class takes input from the keyboard and is displayed in the standard console window; i.e Using the standard System.out.print() syntax.
    My problem is the Swing window will not release the input stream to allow the conole to take input from the keyboard. I have implemented inner-classes within the 'main menu's' class for event handling purposes; in this case the mouse-clicks of the menu's JButton components. The problem only manifests itself when the inner-class' event handling code is called - I wrote some test methods to call the console classes code without using the inner-class' and the console works perfectly. It is my conclusion, therefore, that the calling of the console-based method from within the inner-class of the Swing super-class reserves the input for the Swing components, failing to reactivate the console. I have tried creating new InputStream objects but to no avail.
    Does anyone know how to release or terminate the methods within the inner-classes (they are all void / no return type as they implement the ActionListener abstract class)? This, I hope, will return the focus to the console.
    Any advice would be most greatfully received.
    LEC.

    If you were to have your connection object declared so that it could be referenced from anywhere in your class then you could use it in you actionPerformed method. For example:
    public class Test extends JFrame
    &nbsp&nbsp&nbspprivate Connection con = null;
    &nbsp&nbsp&nbsppublic void actionPerformed(ActionEvent e)
    &nbsp&nbsp&nbsp{
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspMyDetails appmydet = new MyDetails(con, id); //connection, userID
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspappmydet.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
    &nbsp&nbsp&nbsp}
    &nbsp&nbsp&nbsppublic void setConnection(Connection theCon)
    &nbsp&nbsp&nbsp{
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcon = theCon;
    &nbsp&nbsp&nbsp}

  • Having an issue with event handling - sql & java

    HI all am trying to construct this hybrid of java and mysql. the data comes from a mysql database and I want it to display in the gui. this I have achieved thus far. However I have buttons that sort by surname, first name, ID tag etc....I need event handlers for these buttons but am quite unsure as to how to do it. any help would be much appreciated. Thanks in advance.
    /* Student Contact Database GUI
    * Phillip Wells
    import java.awt.BorderLayout;     
    // imports java class. All import class statements tell the compiler to use a class that is defined in the Java API.
    // Borderlayout is a layout manager that assists GUI layout.
    import javax.swing.*;               // imports java class. Swing enables the use of a GUI.
    import javax.swing.JOptionPane;     // imports java class. JOptionPane displays messages in a dialog box as opposed to a console window.
    import javax.swing.JPanel;          // imports java class. A component of a GUI.
    import javax.swing.JFrame;          // imports java class. A component of a GUI.
    import javax.swing.JButton;          // imports java class. A component of a GUI.
    import javax.swing.JScrollPane;     // imports java class. A component of a GUI.
    import javax.swing.JTable;          // imports java class. A component of a GUI.
    import java.awt.*;               // imports java class. Similar to Swing but with different components and functions.
    import java.awt.event.*;          // imports java class. Deals with events.
    import java.awt.event.ActionEvent;     // imports java class. Deals with events.
    import java.awt.event.ActionListener;     // imports java class. Deals with events.
    import java.sql.*;               // imports java class. Provides API for accessing and processing data stored in a data source.
    import java.util.*;               // imports java class. Contains miscellaneous utility classes such as strings.
    public class studentContact extends JFrame {     // public class declaration. The �public� statement enables class availability to other java elements. 
        private JPanel jContentPane;    // initialises content pane
        private JButton snam, id, fname, exit;     // initialises Jbuttons
        String firstname = "firstname"; //initialises String firstname
         String secondname = "secondname"; //initialises String
        public studentContact() {
            Vector columnNames = new Vector();      // creates new vector object. Vectors are arrays that are expandable.
            Vector data = new Vector();
            initialize();
            try {
                // Connect to the Database
                String driver = "com.mysql.jdbc.Driver"; // connect to JDBC driver
                String url = "jdbc:mysql://localhost/Studentprofiles"; //location of Database
                String userid = "root"; //user logon information for MySQL server
                String password = "";     //logon password for above
                Class.forName(driver); //reference to JDBC connector
                Connection connection = DriverManager.getConnection(url, userid,
                        password);     // initiates connection
                // Read data from a table
                String sql = "Select * from studentprofile order by "+ firstname;
                //SQL query sent to database, orders results by firstname.
                Statement stmt = connection.createStatement
                (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
                //statement to create connection.
                //Scroll sensitive allows movement forth and back through results.
                //Concur updatable allows updating of database.
                ResultSet rs = stmt.executeQuery(sql); // executes SQL query stated above and sets the results in a table
                ResultSetMetaData md = rs.getMetaData();     // used to get the properties of the columns in a ResultSet object.
                int columns = md.getColumnCount(); //
                for (int i = 1; i <= columns; i++) {
                    columnNames.addElement(md.getColumnName(i));     // Get column names
                while (rs.next()) {
                    Vector row = new Vector(columns);          // vectors data from table
                    for (int i = 1; i <= columns; i++) {     
                        row.addElement(rs.getObject(i));     // Get row data
                    data.addElement(row);     // adds row data
                rs.close();     
                stmt.close();
            } catch (Exception e) {     // catches exceptions
                System.out.println(e);     // prints exception message
            JTable table = new JTable(data, columnNames) {     //constructs JTable
                public Class getColumnClass(int column) {     
                    for (int row = 0; row < getRowCount(); row++) {
                        Object o = getValueAt(row, column);
                        if (o != null) {
                            return o.getClass();
                    return Object.class;
            JScrollPane scrollPane = new JScrollPane( table );          // constructs scrollpane 'table'
            getContentPane().add(new JScrollPane(table), BorderLayout.SOUTH);   //adds table to a scrollpane
        private void initialize() {
            this.setContentPane(getJContentPane());
            this.setTitle("Student Contact Database");     // sets title of table
            ButtonListener b1 = new ButtonListener();     // constructs button listener
            snam = new JButton ("Sort by surname");      // constructs Jbutton
            snam.addActionListener(b1);     // adds action listener
            jContentPane.add(snam);          //adds button to pane
            id = new JButton ("Sort by ID");      // constructs Jbutton
            id.addActionListener(b1);     // adds action listener
            jContentPane.add(id);          //adds button to pane
            fname = new JButton ("Sort by first name");      // constructs Jbutton
            fname.addActionListener(b1);     // adds action listener
            jContentPane.add(fname);          //adds button to pane
            exit = new JButton ("Exit");     // constructs Jbutton
            exit.addActionListener(b1);     // adds action listener
            jContentPane.add(exit);          //adds button to pane
        private JPanel getJContentPane() {
            if (jContentPane == null) {
                jContentPane = new JPanel();          // constructs new panel
                jContentPane.setLayout(new FlowLayout());     // sets new layout manager
            return jContentPane;     // returns Jcontentpane
        private class ButtonListener implements ActionListener {     // create inner class button listener that uses action listener
            public void actionPerformed (ActionEvent e)
                if (e.getSource () == exit)     // adds listener to button exit.
                   System.exit(0);     // exits the GUI
                if (e.getSource () == snam)
                if (e.getSource () == id)
                if (e.getSource () == fname)
        public static void main(String[] args) {     // declaration of main method
            studentContact frame = new studentContact();     // constructs new frame
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);     //exits frame on closing
            frame.setSize(600, 300);          // set size of frame
            frame.setVisible(true);     // displays frame
    }p.s. sorry about the untidy comments!

    OK, so you've got this code here:
    private class ButtonListener implements ActionListener {
      public void actionPerformed (ActionEvent e) {
        if (e.getSource () == exit) {
          System.exit(0); // exits the GUI
        if (e.getSource () == snam) {
        if (e.getSource () == id) {
    }Perfect fine way to do this; although I think creating anonymous would be a bit cleaner:
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
    });But I think that the real question you have is "what do I put for logic when the JButtons are hit?", right?
    I would answer that you want to dynamically build your SQL statement changing your ordering based on the button.
    So you'd have a method that builds the SQL based on what you pass in - so it takes one argument perhaps?
    private static final int NAME = 1;
                             ID = 2;
    /* ... some code ... */
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
        buildSQL(NAME);
    /* ... some code ... */
    private void buildSQL(int type) {
      if ( type == NAME ) {
    /* ... build SQL by name ... */
      else if ( type == ID ) {
    /* ... build SQL by id ... */
    }That kind of thing.
    Or you might choose to have several build methods with no parameter type; each building the SQL differently, and calling whichever one you need. I did not read your entire pgm, so I don't know how you'd want to organize it. You need to ask more specific questions at that point.
    ~Bill

  • Having an issue with event handling - sql database  & java gui

    HI all, have posted this on another forum but I think this is the correct one to post on. I am trying to construct this hybrid of java and mysql. the data comes from a mysql database and I want it to display in the gui. this I have achieved thus far. However I have buttons that sort by surname, first name, ID tag etc....I need event handlers for these buttons but am quite unsure as to how to do it. any help would be much appreciated. Thanks in advance.
    /* Student Contact Database GUI
    * Phillip Wells
    import java.awt.BorderLayout;     
    // imports java class. All import class statements tell the compiler to use a class that is defined in the Java API.
    // Borderlayout is a layout manager that assists GUI layout.
    import javax.swing.*;               // imports java class. Swing enables the use of a GUI.
    import javax.swing.JOptionPane;     // imports java class. JOptionPane displays messages in a dialog box as opposed to a console window.
    import javax.swing.JPanel;          // imports java class. A component of a GUI.
    import javax.swing.JFrame;          // imports java class. A component of a GUI.
    import javax.swing.JButton;          // imports java class. A component of a GUI.
    import javax.swing.JScrollPane;     // imports java class. A component of a GUI.
    import javax.swing.JTable;          // imports java class. A component of a GUI.
    import java.awt.*;               // imports java class. Similar to Swing but with different components and functions.
    import java.awt.event.*;          // imports java class. Deals with events.
    import java.awt.event.ActionEvent;     // imports java class. Deals with events.
    import java.awt.event.ActionListener;     // imports java class. Deals with events.
    import java.sql.*;               // imports java class. Provides API for accessing and processing data stored in a data source.
    import java.util.*;               // imports java class. Contains miscellaneous utility classes such as strings.
    public class studentContact extends JFrame {     // public class declaration. The �public� statement enables class availability to other java elements. 
    private JPanel jContentPane; // initialises content pane
    private JButton snam, id, fname, exit; // initialises Jbuttons
    String firstname = "firstname"; //initialises String firstname
    String secondname = "secondname"; //initialises String
    public studentContact() {
    Vector columnNames = new Vector();      // creates new vector object. Vectors are arrays that are expandable.
    Vector data = new Vector();
    initialize();
    try {
    // Connect to the Database
    String driver = "com.mysql.jdbc.Driver"; // connect to JDBC driver
    String url = "jdbc:mysql://localhost/Studentprofiles"; //location of Database
    String userid = "root"; //user logon information for MySQL server
    String password = "";     //logon password for above
    Class.forName(driver); //reference to JDBC connector
    Connection connection = DriverManager.getConnection(url, userid,
    password);     // initiates connection
    // Read data from a table
    String sql = "Select * from studentprofile order by "+ firstname;
    //SQL query sent to database, orders results by firstname.
    Statement stmt = connection.createStatement
    (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    //statement to create connection.
    //Scroll sensitive allows movement forth and back through results.
    //Concur updatable allows updating of database.
    ResultSet rs = stmt.executeQuery(sql); // executes SQL query stated above and sets the results in a table
    ResultSetMetaData md = rs.getMetaData();     // used to get the properties of the columns in a ResultSet object.
    int columns = md.getColumnCount(); //
    for (int i = 1; i <= columns; i++) {
    columnNames.addElement(md.getColumnName(i));     // Get column names
    while (rs.next()) {
    Vector row = new Vector(columns);          // vectors data from table
    for (int i = 1; i <= columns; i++) {     
    row.addElement(rs.getObject(i));     // Get row data
    data.addElement(row);     // adds row data
    rs.close();     
    stmt.close();
    } catch (Exception e) {     // catches exceptions
    System.out.println(e);     // prints exception message
    JTable table = new JTable(data, columnNames) {     //constructs JTable
    public Class getColumnClass(int column) {     
    for (int row = 0; row < getRowCount(); row++) {
    Object o = getValueAt(row, column);
    if (o != null) {
    return o.getClass();
    return Object.class;
    JScrollPane scrollPane = new JScrollPane( table ); // constructs scrollpane 'table'
    getContentPane().add(new JScrollPane(table), BorderLayout.SOUTH); //adds table to a scrollpane
    private void initialize() {
    this.setContentPane(getJContentPane());
    this.setTitle("Student Contact Database");     // sets title of table
    ButtonListener b1 = new ButtonListener();     // constructs button listener
    snam = new JButton ("Sort by surname");     // constructs Jbutton
    snam.addActionListener(b1);     // adds action listener
    jContentPane.add(snam);          //adds button to pane
    id = new JButton ("Sort by ID");     // constructs Jbutton
    id.addActionListener(b1);     // adds action listener
    jContentPane.add(id);          //adds button to pane
    fname = new JButton ("Sort by first name");     // constructs Jbutton
    fname.addActionListener(b1);     // adds action listener
    jContentPane.add(fname);          //adds button to pane
    exit = new JButton ("Exit");     // constructs Jbutton
    exit.addActionListener(b1);     // adds action listener
    jContentPane.add(exit);          //adds button to pane
    private JPanel getJContentPane() {
    if (jContentPane == null) {
    jContentPane = new JPanel();          // constructs new panel
    jContentPane.setLayout(new FlowLayout());     // sets new layout manager
    return jContentPane;     // returns Jcontentpane
    private class ButtonListener implements ActionListener {     // create inner class button listener that uses action listener
    public void actionPerformed (ActionEvent e)
    if (e.getSource () == exit)     // adds listener to button exit.
    System.exit(0);     // exits the GUI
    if (e.getSource () == snam)
    if (e.getSource () == id)
    if (e.getSource () == fname)
    public static void main(String[] args) {     // declaration of main method
    studentContact frame = new studentContact();     // constructs new frame
    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);     //exits frame on closing
    frame.setSize(600, 300);          // set size of frame
    frame.setVisible(true);     // displays frame
    }

    OK, so you've got this code here:
    private class ButtonListener implements ActionListener {
      public void actionPerformed (ActionEvent e) {
        if (e.getSource () == exit) {
          System.exit(0); // exits the GUI
        if (e.getSource () == snam) {
        if (e.getSource () == id) {
    }Perfect fine way to do this; although I think creating anonymous would be a bit cleaner:
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
    });But I think that the real question you have is "what do I put for logic when the JButtons are hit?", right?
    I would answer that you want to dynamically build your SQL statement changing your ordering based on the button.
    So you'd have a method that builds the SQL based on what you pass in - so it takes one argument perhaps?
    private static final int NAME = 1;
                             ID = 2;
    /* ... some code ... */
    snam.addActionListener(new actionListener() {
      public void actionPerformed(ActionEvent ae) {
        buildSQL(NAME);
    /* ... some code ... */
    private void buildSQL(int type) {
      if ( type == NAME ) {
    /* ... build SQL by name ... */
      else if ( type == ID ) {
    /* ... build SQL by id ... */
    }That kind of thing.
    Or you might choose to have several build methods with no parameter type; each building the SQL differently, and calling whichever one you need. I did not read your entire pgm, so I don't know how you'd want to organize it. You need to ask more specific questions at that point.
    ~Bill

  • *ACTUAL* event handling mechanism in java

    Hi there! Could someone please help me find resources that explain how EXACTLY the event handling mechanism works in java?
    My searches on google and java.sun take me to pages that explain how to code or something close to that. But what I actually want to know is how is all this handled BY Java- how does the event source or VM know how/when to fire and event? how the event is fired? how do objects keep track of the listener objects?...and all the background stuff like that.
    I've downloaded the Java source code, too. But it seems like an ocean to me to wade through. Would be a great help if someone could 'point out the right path'.
    Thank you very much!

    Hi there! Could someone please help me find
    resources that explain how EXACTLY the event
    handling mechanism works in java?My counter question is why do you care how EXACTLY the mechanism works? It works, and that's all most people need to know.
    How it works is an implementation issue, likely to change from release to release, or as more efficient mechanisms are discovered.
    But what I actually want to know is how is all this
    handled BY Java- how does the event source or VM
    know how/when to fire and event?Native peers attached to a component (AWT) or the frame (Swing) notify Java that an event has occurred in some way. (This will likely change somewhat from platform to platform)
    An AWTEvent is created to represent the native event (Swing requiring more overhead to locate the source of the event) which is added to the EventQueue.
    how the event is fired? how do objects keep track of
    the listener objects?...and all the background stuff like
    that.The above is done on a native thread - not the event thread. The event thread is sitting in the event queue waiting for an event to come along. It processes events in the queue and sends them to the object which "generated" them. This object informs each of its listeners in turn about the event.
    Objects keep track of listeners however they want. AWT objects seem to use java.awt.AWTEventMulticaster. Swing objects seem to use an javax.swing.event.EventListenerList. I tend to use multiple ArrayLists.
    Note that native events are sent through the EventQueue because they originate from non-event-thread threads. Often when specialising events, in particular sending custom events in response to, say, a button press, the event firing will be done in-place, since it is already in the event thread. Custom events that originate from outside the event thread are customarily added to the EventQueue with EventQueue.invokeLater or invokeAndWait.
    This is from inspection of the Java 1.3 source (specifically java.awt.Button and javax.swing.JComponent) and knowledge of the APIs.

  • Difference in event handling between Java and Java API

    could anyone list the differences between Java and java-API in event handling??
    thanks,
    cheers,
    Hiru

    the event handling mechanisms in java language
    features and API (java Application Programming
    Features)features .no library can work without a
    language and no language has event handling built in.
    I am trying to compare and contrast the event
    handling mechanisms in the language and library
    combinations such as java/ java API.
    all contributions are welcome!
    thanks
    cheersSorry, I'm still not getting it. I know what Java is, and I know what I think of when I hear API. (Application Programming Interface.) The API is the aggregation of all the classes and methods you can call in Java. If we agree on that, then the event handling mechanisms in Java and its API are one and the same.
    So what do you want to know?
    %

  • Swing: when trying to get the values from a JTable inside an event handler

    Hi,
    I am trying to write a graphical interface to compute the Gauss Elimination procedure for solving linear systems. The class for computing the output of a linear system already works fine on console mode, but I am fighting a little bit to make it work with Swing.
    I put two buttons (plus labels) and a JTextField . The buttons have the following role:
    One of them gets the value from the JTextField and it will be used to the system dimension. The other should compute the solution. I also added a JTable so that the user can type the values in the screen.
    So whenever the user hits the button Dimensiona the program should retrieve the values from the table cells and pass them to a 2D Array. However, the program throws a NullPointerException when I try to
    do it. I have put the code for copying this Matrix inside a method and I call it from the inner class event handler.
    I would thank you very much for the help.
    Daniel V. Gomes
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import AdvanceMath.*;
    public class MathF2 extends JFrame {
    private JTextField ArrayOfFields[];
    private JTextField DimOfSis;
    private JButton Calcular;
    private JButton Ativar;
    private JLabel label1;
    private JLabel label2;
    private Container container;
    private int value;
    private JTable DataTable;
    private double[][] A;
    private double[] B;
    private boolean dimensionado = false;
    private boolean podecalc = false;
    public MathF2 (){
    super("Math Calcs");
    Container container = getContentPane();
    container.setLayout( new FlowLayout(FlowLayout.CENTER) );
    Calcular = new JButton("Resolver");
    Calcular.setEnabled(false);
    Ativar = new JButton("Dimensionar");
    label1 = new JLabel("Clique no bot�o para resolver o sistema.");
    label2 = new JLabel("Qual a ordem do sistema?");
    DimOfSis = new JTextField(4);
    DimOfSis.setText("0");
    JTable DataTable = new JTable(10,10);
    container.add(label2);
    container.add(DimOfSis);
    container.add(Ativar);
    container.add(label1);
    container.add(Calcular);
    container.add(DataTable);
    for ( int i = 0; i < 10 ; i ++ ){
    for ( int j = 0 ; j < 10 ; j++) {
    DataTable.setValueAt("0",i,j);
    myHandler handler = new myHandler();
    Calcular.addActionListener(handler);
    Ativar.addActionListener(handler);
    setSize( 500 , 500 );
    setVisible( true );
    public static void main ( String args[] ){
    MathF2 application = new MathF2();
    application.addWindowListener(
    new WindowAdapter(){
    public void windowClosing (WindowEvent event)
    System.exit( 0 );
    private class myHandler implements ActionListener {
    public void actionPerformed ( ActionEvent event ){
    if ( event.getSource()== Calcular ) {
    if ( event.getSource()== Ativar ) {
    //dimensiona a Matriz A
    if (dimensionado == false) {
    if (DimOfSis.getText()=="0") {
    value = 2;
    } else {
    value = Integer.parseInt(DimOfSis.getText());
    dimensionado = true;
    Ativar.setEnabled(false);
    System.out.println(value);
    } else {
    Ativar.setEnabled(false);
    Calcular.setEnabled(true);
    podecalc = true;
    try {
    InitValores( DataTable, value );
    } catch (Exception e) {
    System.out.println("Erro ao criar matriz" + e );
    private class myHandler2 implements ItemListener {
    public void itemStateChanged( ItemEvent event ){
    private void InitValores( JTable table, int n ) {
    A = new double[n][n];
    B = new double[n];
    javax.swing.table.TableModel model = table.getModel();
    for ( int i = 0 ; i < n ; i++ ){
    for (int j = 0 ; j < n ; j++ ){
    Object temp1 = model.getValueAt(i,j);
    String temp2 = String.valueOf(temp1);
    A[i][j] = Double.parseDouble(temp2);

    What I did is set up a :
    // This code will setup a listener for the table to handle a selection
    players.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = players.getSelectionModel();
    rowSM.addListSelectionListener(new Delete_Player_row_Selection(this));
    //Class will take the event and call a method inside the Delete_Player object.
    class Delete_Player_row_Selection
    implements javax.swing.event.ListSelectionListener
    Delete_Player adaptee;
    Delete_Player_row_Selection (Delete_Player temp)
    adaptee = temp;
    public void valueChanged (ListSelectionEvent listSelectionEvent)
    adaptee.row_Selection(listSelectionEvent);
    in the row_Selection function
    if(ex.getValueIsAdjusting()) //To remove double selection
    return;
    ListSelectionModel lsm = (ListSelectionModel) ex.getSource();
    if(lsm.isSelectionEmpty())
    System.out.println("EMtpy");
    else
    int selected_row = lsm.getMinSelectionIndex();
    ResultSetTableModel model = (ResultSetTableModel) players.getModel();
    String name = (String) model.getValueAt(selected_row, 1);
    Integer id = (Integer) model.getValueAt(selected_row, 3);
    This is how I got info out of a table when the user selected it

  • Custom Pre Process Event Handler in OIM 11g for middle initials

    Hi,
    I am trying to congiure a Custom Pre Process Event Handler for generating middle name in OIM 11g and I am following the steps as given in metalink ID: *1262803.1*
    Even after successfully performing all the steps I am not able to get the middle initials in Admin Console when I create a new user.
    1) Directory structure for the application that I have created through JDeveloper.
    CustomApplication/
    |-- CustomApplication.jws
    `-- CustomProject
    |-- CustomProject.jpr
    |-- classes
    | `-- com
    | `-- example
    | `-- custompph
    | `-- CustomPreProcessEventHandler.class
    `-- src
    `-- com
    `-- example
    `-- custompph
    `-- CustomPreProcessEventHandler.java
    2) Directory structure for Plugins directory
    My Plugin.xml :
    <?xml version="1.0" encoding="UTF-8" ?>
    <oimplugins>
    <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
    <plugin pluginclass="com.example.custompph.CustomPreProcessEventHandler"
    version="1.0" name="CustomPreProcessEventHandler" />
    </plugins>
    </oimplugins>
    plugin/
    |-- lib
    | `-- com
    | `-- example
    | `-- custompph
    | `-- CustomPreProcessEventHandler.class
    |-- middlename.zip
    `-- plugin.xml
    Copied the middlename.zip in the plugin folder in OIM_HOME and registered it successfully.
    3) Created a EventHandlers file and imported it successfully using importmetadata.
    My EventHandlers.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <eventhandlers>
    <!-- Custom preprocess event handlers -->
    <action-handler
    class="com.example.custompph.CustomPreProcessEventHandler"
    entity-type="User"
    operation="CREATE"
    name="CustomPreProcessEventHandler"
    stage="preprocess"
    order="10"
    sync="TRUE"/>
    </eventhandlers>
    I checked the logs as well but could not find something which can help me to proceed.
    Also please advise is their any mapping that I need to do in *"Design Console"*
    Please advise !!!!!
    Thanks

    My lib file contains the package as mentioned in the metalink.
    Heirarchy in Plugin folder :
    1) plugin.xml
    2) Lib ( lib contains 3 folders : com/example/custompph; And inside custompph is my CustomPreProcessEventHandler.class file)
    You mean to say i should not copy the entire package in lib but only the jar file of the CustomPreProceessEventHandler.class* file.
    If i put only a .jar file in lib i get the following error.
    "Error occured during the use of plugin registering utility. The plugin zip does not contain the definition of plugin class com.example.custompph.CustomPreProcessEventHandler"
    Thanks
    Edited by: 870050 on Jul 4, 2011 4:30 AM

  • Error in Java console

    Hi experts
    when I run Network UI Element
    to presnt org Chart
    I get in  IE->Tools->Java Console
    the follow error:
    <<<--- Applet.destroy(): AppWin0/JNET --->>>
    <<<--- EXIT for AppWin0/JNET --->>>
    java.lang.NullPointerException
         at sun.plugin.javascript.ocx.JSObject.eval(Unknown Source)
         at com.sap.tc.webdynpro.ace.Acf2JavaScriptClient$1.run(Acf2JavaScriptClient.java:55)
         at java.lang.Thread.run(Unknown Source)
    ACF 7.1000.0.71
    <<< frog.jar: version 5.4.6  02/01/06  sap.theme: null >>>

    this is the file:
    // This file has been generated partially by the Web Dynpro Code Generator.
    // MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
    // ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
    package co.il.bnhp;
    // IMPORTANT NOTE:
    // ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
    // BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
    // AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateOrgTree).
    // OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
    // A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
    // OF IMPORT STATEMENTS.
    //@@begin imports
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.StringWriter;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerFactoryConfigurationError;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.DOMException;
    import org.w3c.dom.DOMImplementation;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Entity;
    import org.w3c.dom.Node;
    import org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import co.i.bnhp.model.Zhr_Rfc_Disp_Manger_Employees2_Input;
    import co.il.bnhp.wdp.IPrivateOrgTree;
    import co.il.bnhp.wdp.IPublicOrgTree;
    import com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException;
    import com.sap.tc.webdynpro.progmodel.api.WDResourceFactory;
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDAliasResolvingException;
    import com.sap.tc.webdynpro.services.sal.url.api.WDURLGenerator;
    import com.sap.tc.webdynpro.services.sal.url.api.WDWebResource;
    import com.sap.tc.webdynpro.services.sal.url.api.WDWebResourceType;
    //@@end
    //@@begin documentation
    //@@end
    public class OrgTree
    Logging location.
      private static final com.sap.tc.logging.Location logger =
        com.sap.tc.logging.Location.getLocation(OrgTree.class);
      static
        //@@begin id
        String id = "$Id$";
        //@@end
        com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
    Private access to the generated Web Dynpro counterpart
    for this controller class.  </p>
    Use <code>wdThis</code> to gain typed access to the context,
    to trigger navigation via outbound plugs, to get and enable/disable
    actions, fire declared events, and access used controllers and/or
    component usages.
    @see co.il.bnhp.wdp.IPrivateOrgTree for more details
      private final IPrivateOrgTree wdThis;
    Root node of this controller's context. </p>
    Provides typed access not only to the elements of the root node
    but also to all nodes in the context (methods node<i>XYZ</i>())
    and their currently selected element (methods current<i>XYZ</i>Element()).
    It also facilitates the creation of new elements for all nodes
    (methods create<i>XYZ</i>Element()). </p>
    @see co.il.bnhp.wdp.IPrivateOrgTree.IContextNode for more details.
      private final IPrivateOrgTree.IContextNode wdContext;
    A shortcut for <code>wdThis.wdGetAPI()</code>. </p>
    Represents the generic API of the generic Web Dynpro counterpart
    for this controller. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdControllerAPI;
    A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>
    Represents the generic API of the Web Dynpro component this controller
    belongs to. Can be used to access the message manager, the window manager,
    to add/remove event handlers and so on. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;
      public OrgTree(IPrivateOrgTree wdThis)
        this.wdThis = wdThis;
        this.wdContext = wdThis.wdGetContext();
        this.wdControllerAPI = wdThis.wdGetAPI();
        this.wdComponentAPI = wdThis.wdGetAPI().getComponent();
      //@@begin javadoc:wdDoInit()
      /** Hook method called to initialize controller. */
      //@@end
      public void wdDoInit()
        //@@begin wdDoInit()
        buildDOM();
        //@@end
      //@@begin javadoc:wdDoExit()
      /** Hook method called to clean up controller. */
      //@@end
      public void wdDoExit()
        //@@begin wdDoExit()
        //@@end
      //@@begin javadoc:wdDoPostProcessing()
    Hook called to handle data retrieval errors before rendering.
    After doModifyView(), the Web Dynpro Framework gets all context data needed
    for rendering by validating the contexts (which in turn calls the supply
    functions and supplying relation roles). In this hook, the application
    should handle the errors which occurred during validation of the contexts.
    Using preorder depth-first traversal, this hook is called for all component
    controllers starting with the current root component.
    Permitted operations:
    - Flushing model queue
    - Creating messages
    - Reading context and model data
    Forbidden operations:
    - Invalidating model data
    - Manipulating the context
    - Firing outbound plugs
    - Creating components
    @param isCurrentRoot true if this is the root of the current request
      //@@end
      public void wdDoPostProcessing(boolean isCurrentRoot)
        //@@begin wdDoPostProcessing()
        //@@end
      //@@begin javadoc:wdDoBeforeNavigation()
    Hook before the navigation phase starts.
    This hook allows you to flush the model queue and handle any
    errors that occur. Firing outbound plugs is allowed in this hook.
    Using preorder depth-first traversal, this hook is called for all component
    controllers starting with the current root component.
    @param isCurrentRoot true if this is the root of the current request
      //@@end
      public void wdDoBeforeNavigation(boolean isCurrentRoot)
        //@@begin wdDoBeforeNavigation()
        //@@end
      //@@begin javadoc:wdDoApplicationStateChange()
    Hook that informs the application about a state change.
    <p>
    This hook is called e.g. to tell the application that will be
    <ul>
    <li>left via a suspend plug and therefore should go into a suspend/sleep
         mode with minimal need of resources. errors that occur. Firing
         outbound plugs is allowed in this hook.
    <li>left due to a timeout and could write it's state to a data base if the
         user comes back later on
    </ul>
    The concrete reason is available via IWDApplicationStateChangeInfo
    <p>
    <b>Important</b>: This hook is called for the top level component only!
    @param stateChangeInfo contains the information about the nature of the state change
    @param stateChangeReturn allows the application to ask for a different state change.
           The framework is allowed to ignore it considering i.e. the current resources situation.
      //@@end
      public void wdDoApplicationStateChange(com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeInfo stateChangeInfo, com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeReturn stateChangeReturn)
        //@@begin wdDoApplicationStateChange()
        //@@end
      //@@begin javadoc:buildDOM()
      /** Declared method. */
      //@@end
      public void buildDOM( )
        //@@begin buildDOM()
         //  File fileName = new File ("orgchart.xml");
          wdThis.wdGetEmpUserIdInterface().getemp();
         wdContext.currentContextElement().setPernrRet(wdContext.currentContextElement().getPernrRet());
                Zhr_Rfc_Disp_Manger_Employees2_Input input = new co.i.bnhp.model.Zhr_Rfc_Disp_Manger_Employees2_Input();
                wdContext.nodeZhr_Rfc_Disp_Manger_Employees2_Input().bind(input);
                 input.setP_Pernr("1511");
               //input.setP_Pernr(wdContext.currentContextElement().getPernrRet());               
                   try{
                        String xmlFile =WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), "//tmp//tipex.xml");
                        File  file = new File(xmlFile);
                        //Creating an empty XML Document
                        //We need a Document
                        input.execute();
                        wdContext.nodeSource().invalidate();
                        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
                        DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
                   //     DOMImplementation impl = docBuilder.getDOMImplementation();
                        Document doc = docBuilder.newDocument();
                        //Creating the XML tree
                                  Element SapJNETData = doc.createElement("SAPJNetData");                              
                                SapJNETData.setAttribute("version","1.0");
                            doc.appendChild(SapJNETData);
                          //  Element typeRepository = doc.createElement("TypeRepository");
                          //  typeRepository.setAttribute("href","
    tmp
    TypeRepository.xml");
                           // SapJNETData.appendChild(typeRepository);
                                Element typeRepository = doc.createElement("TypeRepository");
                                  typeRepository.setAttribute("id","orgchart");
                                  typeRepository.setAttribute("version","1.0");
                                  SapJNETData.appendChild(typeRepository);
                                Element color = doc.createElement("COLOR");
                                typeRepository.appendChild(color);
                                Element type1 = doc.createElement("type");
                                 type1.setAttribute("name","OCBlue");
                                 Element rgb1 = doc.createElement("rgb");
                                Text textRGB1 = doc.createTextNode("0,0,128");
                                color.appendChild(type1);
                                rgb1.appendChild(textRGB1);
                                type1.appendChild(rgb1);
                                Element type2 = doc.createElement("type");
                                 type2.setAttribute("name","OCGray");
                                  Element rgb2 = doc.createElement("rgb");
                                 Text textRGB2 = doc.createTextNode("215,220,216");
                                  color.appendChild(type2);
                                  rgb2.appendChild(textRGB2);
                                  type2.appendChild(rgb2);                      
                                Element type3 = doc.createElement("type");
                                  type3.setAttribute("name","OCGrayer");
                                  Element rgb3 = doc.createElement("rgb");
                                  Text textRGB3 = doc.createTextNode("195,200,196");
                                  color.appendChild(type3);
                                  rgb3.appendChild(textRGB3);
                                  type3.appendChild(rgb3);
                                Element type4 = doc.createElement("type");
                                  type4.setAttribute("name","OCLighter");
                                  Element rgb4 = doc.createElement("rgb");
                                  Text textRGB4 = doc.createTextNode("235,240,236");
                                  color.appendChild(type4);
                                  rgb4.appendChild(textRGB4);
                                  type4.appendChild(rgb4);
                                Element layout = doc.createElement("LAYOUT");
                                  typeRepository.appendChild(layout);
                                Element typeLayout = doc.createElement("type");
                                  typeLayout.setAttribute("name","OCLayout");
                                 Element style = doc.createElement("style");
                                 Text textStyle = doc.createTextNode("VERTICAL_FLOW");
                                  layout.appendChild(typeLayout);
                                  typeLayout.appendChild(style);
                                  style.appendChild(textStyle);
                                Element label = doc.createElement("LABEL");
                                  typeRepository.appendChild(label);
                                Element typeLabel1 = doc.createElement("type");
                                typeLabel1.setAttribute("name","OCLabelBase");
                                Element colorLabel = doc.createElement("color");
                                  colorLabel.setAttribute("type","Black");
                                Element font1 = doc.createElement("font");
                                  Element size1 = doc.createElement("size");
                              Text textSize1 = doc.createTextNode("12");
                                Element multiLine =doc.createElement("multiLine");
                                Text textMultiLine=doc.createTextNode("TRUE");
                                Element hAlign = doc.createElement("halign");
                                Text textHalign = doc.createTextNode("CENTER");
                                Element hAlignText = doc.createElement("halignText");
                                 Text textHalignText = doc.createTextNode("CENTER");
                                 Element border1 = doc.createElement("border");
                                 Element insets1 = doc.createElement("insets");
                                 insets1.setAttribute("top","3");
                                 Element typeLabel2 = doc.createElement("type");
                                 typeLabel2.setAttribute("name","OCLabelOrgUnit");
                                 typeLabel2.setAttribute("inherits","OCLabelBase");
                                 Element colorLabel2 = doc.createElement("color");
                                  colorLabel2.setAttribute("type","OCBlue");
                                  Element fillColorLabel2 = doc.createElement("fillColor");
                                  fillColorLabel2.setAttribute("type","OCGrayer");
                                  Element font2 = doc.createElement("font");
                                  Element style2 = doc.createElement("style");
                                  Text textStyle2 = doc.createTextNode("BOLD");
                                  Element border2 = doc.createElement("border");
                                  Element thickness = doc.createElement("thickness");
                                  Text textThickness = doc.createTextNode("1");
                                 Element Side = doc.createElement("sides");
                                 Text textSide = doc.createTextNode("SOUTH");
                                 Element typeLabel3 = doc.createElement("type");
                                  typeLabel3.setAttribute("name","OCLabelNumber");
                                  typeLabel3.setAttribute("inherits","OCLabelBase");
                                  Element colorLabel3 = doc.createElement("color");
                                  colorLabel3.setAttribute("type","OCBlue");
                                  Element size3 = doc.createElement("size");
                                  Text textSize3 = doc.createTextNode("40,0");
                                  Element halign3 = doc.createElement("halign");
                                  Text textHalign3 = doc.createTextNode("RIGHT");
                                 Element multiLine3 = doc.createElement("multiline");
                                  Text textMultiLine3 = doc.createTextNode("FALSE");
                                  Element border3 = doc.createElement("border");
                                  Element Thickness3 = doc.createElement("thickness");
                                  Text textThickness3 = doc.createTextNode("1");
                                  Element insets3 = doc.createElement("insets");
                                  insets3.setAttribute("top","0");
                                 Element Sides3 = doc.createElement("sides");
                                 Text textSides3 = doc.createTextNode("NORTH,WEST");
                                Element typeLabel4 = doc.createElement("type");
                                  typeLabel4.setAttribute("name","OCLabelChief");
                                typeLabel4.setAttribute("inherits","OCLabelBase");
                                Element font4 = doc.createElement("font");
                                Element style4 = doc.createElement("style");
                                Element border4 = doc.createElement("border");
                                Element insets4 = doc.createElement("insets");
                                insets4.setAttribute("top","6");
                                Element edgeT = doc.createElement("EDGE");
                                Element typeEdge= doc.createElement("type");
                                typeEdge.setAttribute("name","OCLink");
                                Element Shape = doc.createElement("shape");
                                Element ThickNess =doc.createElement("thickness");
                                Element targetDeco = doc.createElement("targetdeco");
                                targetDeco.setAttribute("shape","NONE");
                                Element nodeT = doc.createElement("NODE");
                                Element typeNode = doc.createElement("type");
                                typeNode.setAttribute("name","OCNodeBase");
                                Element shape = doc.createElement("shape");
                                shape.setAttribute("type","Box");
                                Element fillColor = doc.createElement("fillColor");
                                fillColor.setAttribute("type","OCGray");
                                Element borderNode = doc.createElement("border");
                                Element styleNode = doc.createElement("style");
                                Element plugs = doc.createElement("plugs");
                                plugs.setAttribute("min","0");
                                plugs.setAttribute("position","SOUTH");
                                plugs.setAttribute("positionMode","CENTRIC");
                                Element socket = doc.createElement("sockets");
                                socket.setAttribute("min","0");
                                 socket.setAttribute("position","NORTH");
                                  socket.setAttribute("positionMode","CENTRIC");
                                Element OCNode = doc.createElement("type");
                                OCNode.setAttribute("name","OCNode");
                                OCNode.setAttribute("inherits","OCNodeBase");
                                Element OCNodeShape = doc.createElement("shape");
                                Element OCNodeSize = doc.createElement("size");
                                OCNodeSize.setAttribute("pack","true");
                                Element OClayout = doc.createElement("layout");
                                OClayout.setAttribute("type","OCLayout");
                                Element OCNodeArrowUp = doc.createElement("type");
                                OCNodeArrowUp.setAttribute("name","OCNodeArrowUp");
                                OCNodeArrowUp.setAttribute("inherits","OCNodeBase");
                                Element OCNodeArrowShape = doc.createElement("shape");
                                Element OcNodeArrowSize = doc.createElement("size");
                                Element OcNodeArrowLabel = doc.createElement("label");
                                Element OcNodeArrowicon = doc.createElement("icon");
                                Element OcNodeArrowHalign = doc.createElement("halign");
                                Element OCNodeArrowDown = doc.createElement("type");
                                   OCNodeArrowDown.setAttribute("name","OCNodeArrowDown");
                                  OCNodeArrowDown.setAttribute("inherits","OCNodeArrowUp");
                                   Element OCNodeArrowDownLabel = doc.createElement("label");
                                   Element OcNodeArrowDownIcon = doc.createElement("icon");
                                Element NodeGraph = doc.createElement("Graph");
                                Element OCGraph = doc.createElement("type");
                                OCGraph.setAttribute("name","OCGraph");
                                Element direction = doc.createElement("direction");
                                Element components = doc.createElement("components");
                                Element OCGraphLayouts = doc.createElement("layouts");
                                Element types = doc.createElement("types");
                                Element OCGraphlayout = doc.createElement("layout");
                                OCGraphlayout.setAttribute("type","TREE");
                                Element property1 = doc.createElement("property");
                                property1.setAttribute("name","STYLE");
                                property1.setAttribute("value","VARIABLE_SIZE");
                                Element property2 = doc.createElement("property");
                                property2.setAttribute("name","OFFS_X");
                                  property2.setAttribute("value","50");
                                Element property3 = doc.createElement("property");
                                property3.setAttribute("name","OFFS_Y");
                                  property3.setAttribute("value","30");
                                Element Graph = doc.createElement("Graph");
                                Graph.setAttribute("type","OCGraph");
                                 Graph.setAttribute("version","1.0");
                                 Element layouts = doc.createElement("layouts");
                                 layouts.setAttribute("onLoad","TREE");
                                 Element view = doc.createElement("view");
                                 Element grid = doc.createElement("grid");
                                 Text TextGrid = doc.createTextNode("80,80");
                                Element UserInterface = doc.createElement("userInterface");
                                UserInterface.setAttribute("version","1.0");
                                Element mode = doc.createElement("mode");
                                label.appendChild(typeLabel1);
                                  typeLabel1.appendChild(colorLabel);
                                  typeLabel1.appendChild(font1);
                                font1.appendChild(size1);
                                  size1.appendChild(textSize1);
                                typeLabel1.appendChild(multiLine);
                                multiLine.appendChild(textMultiLine);
                                typeLabel1.appendChild(hAlign);
                                hAlign.appendChild(textHalign);
                                typeLabel1.appendChild(hAlignText);
                                  hAlignText.appendChild(textHalignText);
                                  typeLabel1.appendChild(border1);
                                  border1.appendChild(insets1);
                                  label.appendChild(typeLabel2);
                                  typeLabel2.appendChild(colorLabel2);
                                  typeLabel2.appendChild(fillColorLabel2);
                                  typeLabel2.appendChild(font2);
                                  font2.appendChild(style2);
                                  style2.appendChild(textStyle2);
                                  typeLabel2.appendChild(border2);
                                  border2.appendChild(thickness);
                                  thickness.appendChild(textThickness);
                                  border2.appendChild(Side);
                                  Side.appendChild(textSide);
                                  label.appendChild(typeLabel4);
                                  typeLabel4.appendChild(font4);
                                  font4.appendChild(style4);
                                  style4.appendChild(doc.createTextNode("BOLD"));
                                  typeLabel4.appendChild(border4);
                                  border4.appendChild(insets4);
                                  label.appendChild(typeLabel3);
                                  typeLabel3.appendChild(colorLabel3);
                                  typeLabel3.appendChild(size3);
                                  size3.appendChild(textSize3);
                                  typeLabel3.appendChild(halign3);
                                  halign3.appendChild(textHalign3);
                                  typeLabel3.appendChild(multiLine3);
                                  multiLine3.appendChild(textMultiLine3);
                                  typeLabel3.appendChild(border3);
                                  border3.appendChild(Thickness3);
                                  Thickness3.appendChild(textThickness3);
                                  border3.appendChild(insets3);
                                 insets3.setAttribute("top","0");
                                  border3.appendChild(Sides3);
                                  Sides3.appendChild(textSides3);
                                typeRepository.appendChild(edgeT);
                                edgeT.appendChild(typeEdge);
                                typeEdge.appendChild(Shape);
                                Shape.appendChild(doc.createTextNode("BENT"));
                                typeEdge.appendChild(ThickNess);
                                ThickNess.appendChild(doc.createTextNode("1"));
                                typeEdge.appendChild(targetDeco);
                                typeRepository.appendChild(nodeT);
                                nodeT.appendChild(typeNode);
                                typeNode.appendChild(shape);
                                shape.appendChild(fillColor);
                                shape.appendChild(borderNode);
                                borderNode.appendChild(styleNode);
                                styleNode.appendChild(doc.createTextNode("RAISED"));
                                typeNode.appendChild(plugs);
                                typeNode.appendChild(socket);
                                nodeT.appendChild(OCNode);
                                OCNode.appendChild(OCNodeShape);
                                OCNodeShape.appendChild(OCNodeSize);
                                OCNodeSize.appendChild(doc.createTextNode("150,0"));
                                OCNode.appendChild(OClayout);
                                nodeT.appendChild(OCNodeArrowUp);
                                OCNodeArrowUp.appendChild(OCNodeArrowShape);
                                OCNodeArrowShape.appendChild(OcNodeArrowSize);
                                OcNodeArrowSize.appendChild(doc.createTextNode("22,21"));
                                OCNodeArrowUp.appendChild(OcNodeArrowLabel);
                                OcNodeArrowLabel.appendChild(OcNodeArrowicon);
                                OcNodeArrowicon.appendChild(doc.createTextNode("apps/orgchart/arrow-up.gif"));
                                OcNodeArrowLabel.appendChild(OcNodeArrowHalign);
                                OcNodeArrowHalign.appendChild(doc.createTextNode("CENTER"));
                                nodeT.appendChild(OCNodeArrowDown);
                                OCNodeArrowDown.appendChild(OCNodeArrowDownLabel);
                                OCNodeArrowDownLabel.appendChild(OcNodeArrowDownIcon);
                                OcNodeArrowDownIcon.appendChild(doc.createTextNode("apps/orgchart/arrow-down.gif"));
                                typeRepository.appendChild(NodeGraph);
                                NodeGraph.appendChild(OCGraph);
                                OCGraph.appendChild(direction);
                                direction.appendChild(doc.createTextNode("TOP_BOTTOM"));
                                OCGraph.appendChild(components);
                                  components.appendChild(doc.createTextNode("OCNode"));
                                OCGraph.appendChild(OCGraphLayouts);
                                OCGraphLayouts.appendChild(types);
                                types.appendChild(doc.createTextNode("TREE"));
                                OCGraphLayouts.appendChild(OCGraphlayout);
                                OCGraphlayout.appendChild(property1);
                                OCGraphlayout.appendChild(property2);
                                OCGraphlayout.appendChild(property3);                                                                                   
                                SapJNETData.appendChild(UserInterface);
                                UserInterface.appendChild(mode);
                                mode.appendChild(doc.createTextNode("SELECTONLY"));
                                  SapJNETData.appendChild(Graph);
                                  Graph.appendChild(layouts);
                                  Graph.appendChild(view);
                                  view.appendChild(grid);
                                  grid.appendChild(TextGrid);
                                for (int i=0; i<wdContext.nodeZhr_Rfc_Employees2().size(); i++) {
                                  IPublicOrgTree.IEmpElement Emp = wdContext.nodeEmp().createEmpElement();
                                  IPublicOrgTree.IZhr_Rfc_Employees2Element curEmp = wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i);
                                  Element node  = doc.createElement("node");
                                  node.setAttribute("id",curEmp.getEmp_Pernr());
                                   node.setAttribute("type","OCNode");
                                   Element label1 = doc.createElement("label");
                                   label1.setAttribute("type","OCLabelOrgUnit");
                                   Text TextLabel1 = doc.createTextNode(curEmp.getEmp_Name());
                                   Element label2 = doc.createElement("label");
                                   label2.setAttribute("type","OCLabelChief");
                                   Text TextLabel2 = doc.createTextNode(curEmp.getEmp_Pernr());
                                   Graph.appendChild(node); 
                                   node.appendChild(label1);
                                   label1.appendChild(TextLabel1);
                                   node.appendChild(label2);
                                   label2.appendChild(TextLabel2);
                                   wdContext.nodeEmp().addElement(Emp);
                                   for (int i=0; i<wdContext.nodeZhr_Rfc_Employees2().size()-1; i++) {
                                       IPublicOrgTree.IEmpElement Emp = wdContext.nodeEmp().createEmpElement();
                                       IPublicOrgTree.IZhr_Rfc_Employees2Element  curEmp = wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i);
                                       for (int j=i1; j<wdContext.nodeZhr_Rfc_Employees2().size(); j+)          
                                        if (wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i).getEmp_Pernr().equals(wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(j).getEmp_Manager()))
                                            Element edge  = doc.createElement("edge");
                                            edge.setAttribute("type","OCLink");
                                            Element from = doc.createElement("from");
                                            from.setAttribute("node",curEmp.getEmp_Pernr());
                                            Element to = doc.createElement("to");
                                            to.setAttribute("node",wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(j).getEmp_Pernr());
                                            Graph.appendChild(edge);
                                            edge.appendChild(from);
                                            edge.appendChild(to);
                             //     typeLabel3.appendChild()
                             //   Element font = doc.createElement("font");
                             //     .appendChild(color);
                             //   type1.appendChild(rgb1);
                                  //create a comment and put it in the root element
                             //     Comment comment = doc.createComment("Just a thought");
                             //     type1.appendChild(comment);
                                  //create child element, add an attribute, and add to root
                             //     Element child = doc.createElement("child");
                                  //child.setAttribute("name", "value");
                                  //type.appendChild(child);
                                  //add a text element to the child
                        //Output the XML
                        //set up a transformer
                        TransformerFactory transfac = TransformerFactory.newInstance();
                        Transformer trans = transfac.newTransformer();
                        trans.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-8");
                        trans.setOutputProperty(OutputKeys.INDENT, "yes");
                        //create string from xml tree
                        StringWriter sw = new StringWriter();
                       StreamResult result = new StreamResult(file);
                       DOMSource source = new DOMSource(doc);
                        trans.transform(source, result);
                        wdContext.currentContextElement().setXmlString(sw.toString());
                   } catch (DOMException e) {
                        wdComponentAPI.getMessageManager().reportException("2-"+e.getMessage(),true);
                   } catch (TransformerConfigurationException e) {
         

  • Javascript error in event handler! Event Type = element [edge.2.0.0.min.js:162]

    I'm doing a little edge project (now in beta version) for my girlfriend (she hates the code), with examples of the animate() method and other functions like setInteval(), but when I run I get the following error in Chrome console:
    Javascript error in event handler! Event Type = element [edge.2.0.0.min.js:162]
    But this library is global for all projects, how is possible that trigger an error?
    Example here:
    https://app.box.com/s/m7nof4al6597gfn47jlu
    Thanks.

    you dont need to import java ease !!
    it's already included in edge animate, remove that yepnope completely your problem will gone
    Zaxist

Maybe you are looking for

  • I cannot print a pdf document on my HP 7520 printer.

    When I open the document and click on print, it opens the printer dialog box. Since I have three printers installed on my windows 7 computer, I have to select the correct printer. When I scroll through the printer list, the HP7520 printer does not sh

  • Updating delivery date on Purchase order line items

    Hi, I am using BAPI_PO_CREATE1 to create purchase order. It is creating fine except I want the delivery date on line item to be overwritten instead of system determining from MRP view of material on each line item. I am passing delivery date to DELIV

  • Posting for different APC values to different Depreciation Areas

    Hi All, I am trying to manage in ECC 6.0, different APC values for different depreciation areas, i.e. APC values differ from one dep area to another. I need to post the APC to GL only (i.e. for the 01 i.e. Book Depreciation area). For the remaining d

  • How to see all the reporting variables in BW

    Hi All, Is there any method or table we have in BW to see all the reporting variables Thanks in Advance! BW User

  • Effects on clips not stacking?

    Gday folks - just been experimenting with sapphire transitions and am having this problem.  When I finally worked out how to use them by keyframing the transition and having the clips on separate tracks I now have the problem that the sapphire transi