JTree and real Components / event forwarding

Ok, so Ive seen some people forward events from JTree to node based Components.
I was just wondering, whether thats the right way to go.
Wouldn't it be better to write your own TreeLayoutManager, add the node based components with nodes as constraints to the the manager and add or remove them when the tree expands/collapses.
My only problem is, when to trigger the doLayout and how to get the proper node sizes. The only given value is the available width in the cellrenderer.
The cellrenderer would just return an empty, properly sized JLabel, and the "layoutmanager" would take care of the the real positioning.
That way I could have the painting speed benefits of a Jtree, combined with the flexibility of real components stored as nodes in it, right?
Well, I'm just looking for opinions on this.
Shoot :-D

Hi,
Thanks for your post.
>>What is meant by HeartbeatInterval and Max Latency Time?
Heartbeat Interval determines how often collector will check if source is still online,
MaxItems and MaxLatencyTime determine how source will batch items. In this example it will wait for 1 events or 1 seconds
<MaxItems>1</MaxItems>
<MaxLatencyTime>1000</MaxLatencyTime>
>>Next: When configuring the source computer i have to configure a Refresh time in the Policy key. (Computer Settings - Policies - Administrative Templates - Windows Components - Event Forwarding)
If you enable this policy setting, you can configure the Source Computer to contact a specific FQDN (Fully Qualified Domain Name) or IP Address and request subscription specifics.
If you disable or do not configure this policy setting, the Event Collector computer will not be specified.
>>when is this value being used for what? If I do not specify this refresh param, what is the default value?
In my view, it is connection refresh time, we must set this parameter, for example,
Use the following syntax when using the HTTPS protocol:
Server=https://<FQDN of the collector>:5986/wsman/SubscriptionManager/WEC,Refresh=<Refresh interval in seconds>,IssuerCA=<Thumb print of the client authentication certificate>
Meanwhile, i think you may ask in MSDN forums for technical support.
https://social.msdn.microsoft.com/Forums/en-US/home
Regards.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • Differences between Robot class generated events and real input events

    Hello everyone!
    I'm having a problem with the translation of the description of the awt.Robot class.
    - "This class is used to generate native system input events" -
    Does this mean there is no difference between real input events and generated events from the Robot class? Difference in reference to that the generated events can't be recognized as generated events by the os or programs.
    Thanks in advance.
    Chris B.

    The Robot class will use an interface provided by the operating system to inject events. Those are very close to 'real' input events, but not quite there. There are, for instance, several games out there which have a protection mechanism against Robot's events to prevent scripting/botting. However, any application that is not paying special attention to the event's source will assume that the input events generated by Robot are actually coming from the user, so you can 'control' any application with the exception of the beforementioned games.

  • Event Forwarding Subscription Parameters

    Hello,
    You provided a good installation guide to create a source initiated subscription here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb870973%28v=vs.85%29.aspx
    However, I'd like to know how it really works. Here are a few questions:
    Are the logs pulled or pushed? Is this dependent on the Subscription weather it is Normal Mode or Minimize Bandwidth/Latency ? If so, how does the source computer know to push the logs or wait until pulled?
    The XML file of a Subscription is very complex. Here is one from the msdn: 
    <Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
    <SubscriptionId>SampleSISubscription</SubscriptionId>
    <SubscriptionType>SourceInitiated</SubscriptionType>
    <Description>Source Initiated Subscription Sample</Description>
    <Enabled>true</Enabled>
    <Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
    <!-- Use Normal (default), Custom, MinLatency, MinBandwidth -->
    <ConfigurationMode>Custom</ConfigurationMode>
    <Delivery Mode="Push">
    <Batching>
    <MaxItems>1</MaxItems>
    <MaxLatencyTime>1000</MaxLatencyTime>
    </Batching>
    <PushSettings>
    <Heartbeat Interval="60000"/>
    </PushSettings>
    </Delivery>
    <Expires>2018-01-01T00:00:00.000Z</Expires>
    <Query>
    <![CDATA[
    <QueryList>
    <Query Path="Application">
    <Select>Event[System/EventID='999']</Select>
    </Query>
    </QueryList>
    ]]>
    </Query>
    <ReadExistingEvents>true</ReadExistingEvents>
    <TransportName>http</TransportName>
    <ContentFormat>RenderedText</ContentFormat>
    <Locale Language="en-US"/>
    <LogFile>ForwardedEvents</LogFile>
    <AllowedSourceNonDomainComputers></AllowedSourceNonDomainComputers>
    <AllowedSourceDomainComputers>O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)</AllowedSourceDomainComputers>
    </Subscription>
    What is meant by HeartbeatInterval and Max Latency Time?
    Next: When configuring the source computer i have to configure a Refresh time in the Policy key. (Computer Settings - Policies - Administrative Templates - Windows Components - Event Forwarding). 
    What is meant by that? when is this value being used for what?
    If I do not specify this refresh param, what is the default value?
    I really hope someone here can help me out of my confusion.
    Every Advice is appreciated

    Hi,
    Thanks for your post.
    >>What is meant by HeartbeatInterval and Max Latency Time?
    Heartbeat Interval determines how often collector will check if source is still online,
    MaxItems and MaxLatencyTime determine how source will batch items. In this example it will wait for 1 events or 1 seconds
    <MaxItems>1</MaxItems>
    <MaxLatencyTime>1000</MaxLatencyTime>
    >>Next: When configuring the source computer i have to configure a Refresh time in the Policy key. (Computer Settings - Policies - Administrative Templates - Windows Components - Event Forwarding)
    If you enable this policy setting, you can configure the Source Computer to contact a specific FQDN (Fully Qualified Domain Name) or IP Address and request subscription specifics.
    If you disable or do not configure this policy setting, the Event Collector computer will not be specified.
    >>when is this value being used for what? If I do not specify this refresh param, what is the default value?
    In my view, it is connection refresh time, we must set this parameter, for example,
    Use the following syntax when using the HTTPS protocol:
    Server=https://<FQDN of the collector>:5986/wsman/SubscriptionManager/WEC,Refresh=<Refresh interval in seconds>,IssuerCA=<Thumb print of the client authentication certificate>
    Meanwhile, i think you may ask in MSDN forums for technical support.
    https://social.msdn.microsoft.com/Forums/en-US/home
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know each Java Class that is involved in flow.

    As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know how flows goes to the server and server understands the method which is to be called of managed bean. I know it is with annotation @ManagedBean and method name, but how Call is binded with annotation @ManagedBean.
    In short, i want to know the internal implementation of JSF Framework.

    As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know how flows goes to the server and server understands the method which is to be called of managed bean. I know it is with annotation @ManagedBean and method name, but how Call is binded with annotation @ManagedBean.
    In short, i want to know the internal implementation of JSF Framework.

  • One model for JTree and JTable

    Hi.
    Is it possible for a JTree and a JTable to share one model?
    Thank you

    Hope u r not using Comonent TreeTable
    If u have Tree & Table different components, just want to have a common model then u can try this,
    It is nothing but default implementation given in DefaultTableModel
    public class MyTreeTableModel extends DefaultTreeModel implements TableModel, Serializable {
    protected Vector dataVector;
    /** List of listeners */
    protected EventListenerList listenerList = new EventListenerList();
    /** The <code>Vector</code> of column identifiers. */
    protected Vector columnIdentifiers;
    public MyTreeTableModel(TreeNode root) {
    this(root, false);
    // constructor for TreeModel only
    public MyTreeTableModel(TreeNode root, boolean asksAllowsChildren) {
    super(root, asksAllowsChildren);
    // constructor for TableModel only
    public MyTreeTableModel() {
    this(0, 0);
    private static Vector newVector(int size) {
    Vector v = new Vector(size);
    v.setSize(size);
    return v;
    // constructor for TableModel only
    public MyTreeTableModel(int rowCount, int columnCount) {
    this(newVector(columnCount), rowCount);
    // constructor for TableModel only
    public MyTreeTableModel(Vector columnNames, int rowCount) {
    super(null);
    setDataVector(newVector(rowCount), columnNames);
    // constructor for TableModel only
    public MyTreeTableModel(Object[] columnNames, int rowCount) {
    this(convertToVector(columnNames), rowCount);
    // constructor for TableModel only
    public MyTreeTableModel(Vector data, Vector columnNames) {
    super(null);
    setDataVector(data, columnNames);
    // constructor for TableModel only
    public MyTreeTableModel(Object[][] data, Object[] columnNames) {
    super(null);
    setDataVector(data, columnNames);
    * Returns a default name for the column using spreadsheet conventions:
    * A, B, C, ... Z, AA, AB, etc. If <code>column</code> cannot be found,
    * returns an empty string.
    * @param column the column being queried
    * @return a string containing the default name of <code>column</code>
    private String getDefaultColumnName(int column) {
    String result = "";
    for (; column >= 0; column = column / 26 - 1) {
    result = (char)((char)(column%26)+'A') + result;
    return result;
    * Returns a column given its name.
    * Implementation is naive so this should be overridden if
    * this method is to be called often. This method is not
    * in the <code>TableModel</code> interface and is not used by the
    * <code>JTable</code>.
    * @param columnName string containing name of column to be located
    * @return the column with <code>columnName</code>, or -1 if not found
    public int findColumn(String columnName) {
    for (int i = 0; i < getColumnCount(); i++) {
    if (columnName.equals(getColumnName(i))) {
    return i;
    return -1;
    * Returns <code>Object.class</code> regardless of <code>columnIndex</code>.
    * @param columnIndex the column being queried
    * @return the Object.class
    public Class getColumnClass(int columnIndex) {
    return Object.class;
    // Managing Listeners
    * Adds a listener to the list that's notified each time a change
    * to the data model occurs.
    * @param     l          the TableModelListener
    public void addTableModelListener(TableModelListener l) {
    listenerList.add(TableModelListener.class, l);
    * Removes a listener from the list that's notified each time a
    * change to the data model occurs.
    * @param     l          the TableModelListener
    public void removeTableModelListener(TableModelListener l) {
    listenerList.remove(TableModelListener.class, l);
    * Returns an array of all the table model listeners
    * registered on this model.
    * @return all of this model's <code>TableModelListener</code>s
    * or an empty
    * array if no table model listeners are currently registered
    public TableModelListener[] getTableModelListeners() {
    return (TableModelListener[])listenerList.getListeners(
    TableModelListener.class);
    // Fire methods
    * Notifies all listeners that all cell values in the table's
    * rows may have changed. The number of rows may also have changed
    * and the <code>JTable</code> should redraw the
    * table from scratch. The structure of the table (as in the order of the
    * columns) is assumed to be the same.
    public void fireTableDataChanged() {
    fireTableChanged(new TableModelEvent(this));
    * Notifies all listeners that the table's structure has changed.
    * The number of columns in the table, and the names and types of
    * the new columns may be different from the previous state.
    * If the <code>JTable</code> receives this event and its
    * <code>autoCreateColumnsFromModel</code>
    * flag is set it discards any table columns that it had and reallocates
    * default columns in the order they appear in the model. This is the
    * same as calling <code>setModel(TableModel)</code> on the
    * <code>JTable</code>.
    public void fireTableStructureChanged() {
    fireTableChanged(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
    * Notifies all listeners that rows in the range
    * <code>[firstRow, lastRow]</code>, inclusive, have been inserted.
    * @param firstRow the first row
    * @param lastRow the last row
    public void fireTableRowsInserted(int firstRow, int lastRow) {
    fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
    TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
    * Notifies all listeners that rows in the range
    * <code>[firstRow, lastRow]</code>, inclusive, have been updated.
    * @param firstRow the first row
    * @param lastRow the last row
    public void fireTableRowsUpdated(int firstRow, int lastRow) {
    fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
    TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE));
    * Notifies all listeners that rows in the range
    * <code>[firstRow, lastRow]</code>, inclusive, have been deleted.
    * @param firstRow the first row
    * @param lastRow the last row
    public void fireTableRowsDeleted(int firstRow, int lastRow) {
    fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
    TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
    * Notifies all listeners that the value of the cell at
    * <code>[row, column]</code> has been updated.
    * @param row row of cell which has been updated
    * @param column column of cell which has been updated
    public void fireTableCellUpdated(int row, int column) {
    fireTableChanged(new TableModelEvent(this, row, row, column));
    * Forwards the given notification event to all
    * <code>TableModelListeners</code> that registered
    * themselves as listeners for this table model.
    * @param e the event to be forwarded
    public void fireTableChanged(TableModelEvent e) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners==TableModelListener.class) {
    ((TableModelListener)listeners[i+1]).tableChanged(e);
    * Returns an array of all the objects currently registered
    * as <code><em>Foo</em>Listener</code>s
    * upon this <code>AbstractTableModel</code>.
    * <code><em>Foo</em>Listener</code>s are registered using the
    * <code>add<em>Foo</em>Listener</code> method.
    * <p>
    * You can specify the <code>listenerType</code> argument
    * with a class literal,
    * such as
    * <code><em>Foo</em>Listener.class</code>.
    * For example, you can query a
    * model <code>m</code>
    * for its table model listeners with the following code:
    * <pre>TableModelListener[] tmls = (TableModelListener[])(m.getListeners(TableModelListener.class));</pre>
    * If no such listeners exist, this method returns an empty array.
    * @param listenerType the type of listeners requested; this parameter
    * should specify an interface that descends from
    * <code>java.util.EventListener</code>
    * @return an array of all objects registered as
    * <code><em>Foo</em>Listener</code>s on this component,
    * or an empty array if no such
    * listeners have been added
    * @exception ClassCastException if <code>listenerType</code>
    * doesn't specify a class or interface that implements
    * <code>java.util.EventListener</code>
    public EventListener[] getListeners(Class listenerType) {
    return listenerList.getListeners(listenerType);
    * Returns the <code>Vector</code> of <code>Vectors</code>
    * that contains the table's
    * data values. The vectors contained in the outer vector are
    * each a single row of values. In other words, to get to the cell
    * at row 1, column 5: <p>
    * <code>((Vector)getDataVector().elementAt(1)).elementAt(5);</code><p>
    * @return the vector of vectors containing the tables data values
    public Vector getDataVector() {
    return dataVector;
    private static Vector nonNullVector(Vector v) {
    return (v != null) ? v : new Vector();
    * Replaces the current <code>dataVector</code> instance variable
    * with the new Vector of rows, <code>dataVector</code>.
    * <code>columnIdentifiers</code> are the names of the new
    * columns. The first name in <code>columnIdentifiers</code> is
    * mapped to column 0 in <code>dataVector</code>. Each row in
    * <code>dataVector</code> is adjusted to match the number of
    * columns in <code>columnIdentifiers</code>
    * either by truncating the <code>Vector</code> if it is too long,
    * or adding <code>null</code> values if it is too short.
    * <p>Note that passing in a <code>null</code> value for
    * <code>dataVector</code> results in unspecified behavior,
    * an possibly an exception.
    * @param dataVector the new data vector
    * @param columnIdentifiers the names of the columns
    public void setDataVector(Vector dataVector, Vector columnIdentifiers) {
    this.dataVector = nonNullVector(dataVector);
    this.columnIdentifiers = nonNullVector(columnIdentifiers);
    justifyRows(0, getRowCount());
    fireTableStructureChanged();
    * Replaces the value in the <code>dataVector</code> instance
    * variable with the values in the array <code>dataVector</code>.
    * The first index in the <code>Object[][]</code>
    * array is the row index and the second is the column index.
    * <code>columnIdentifiers</code> are the names of the new columns.
    * @param dataVector          the new data vector
    * @param columnIdentifiers     the names of the columns
    public void setDataVector(Object[][] dataVector, Object[] columnIdentifiers) {
    setDataVector(convertToVector(dataVector), convertToVector(columnIdentifiers));
    * Equivalent to <code>fireTableChanged</code>.
    * @param event the change event
    public void newDataAvailable(TableModelEvent event) {
    fireTableChanged(event);
    // Manipulating rows
    private void justifyRows(int from, int to) {
    // Sometimes the MyTreeTableModel is subclassed
    // instead of the AbstractTableModel by mistake.
    // Set the number of rows for the case when getRowCount
    // is overridden.
    dataVector.setSize(getRowCount());
    for (int i = from; i < to; i++) {
    if (dataVector.elementAt(i) == null) {
    dataVector.setElementAt(new Vector(), i);
    ((Vector)dataVector.elementAt(i)).setSize(getColumnCount());
    * Ensures that the new rows have the correct number of columns.
    * This is accomplished by using the <code>setSize</code> method in
    * <code>Vector</code> which truncates vectors
    * which are too long, and appends <code>null</code>s if they
    * are too short.
    * This method also sends out a <code>tableChanged</code>
    * notification message to all the listeners.
    * @param e this <code>TableModelEvent</code> describes
    * where the rows were added.
    *                    If <code>null</code> it assumes
    * all the rows were newly added
    public void newRowsAdded(TableModelEvent e) {
    justifyRows(e.getFirstRow(), e.getLastRow() + 1);
    fireTableChanged(e);
    * Equivalent to <code>fireTableChanged</code>.
    * @param event the change event
    public void rowsRemoved(TableModelEvent event) {
    fireTableChanged(event);
    * Obsolete as of Java 2 platform v1.3. Please use <code>setRowCount</code> instead.
    * Sets the number of rows in the model. If the new size is greater
    * than the current size, new rows are added to the end of the model
    * If the new size is less than the current size, all
    * rows at index <code>rowCount</code> and greater are discarded. <p>
    * @param rowCount the new number of rows
    public void setNumRows(int rowCount) {
    int old = getRowCount();
    if (old == rowCount) {
    return;
    dataVector.setSize(rowCount);
    if (rowCount <= old) {
    fireTableRowsDeleted(rowCount, old-1);
    else {
    justifyRows(old, rowCount);
    fireTableRowsInserted(old, rowCount-1);
    * Sets the number of rows in the model. If the new size is greater
    * than the current size, new rows are added to the end of the model
    * If the new size is less than the current size, all
    * rows at index <code>rowCount</code> and greater are discarded. <p>
    public void setRowCount(int rowCount) {
    setNumRows(rowCount);
    * Adds a row to the end of the model. The new row will contain
    * <code>null</code> values unless <code>rowData</code> is specified.
    * Notification of the row being added will be generated.
    * @param rowData optional data of the row being added
    public void addRow(Vector rowData) {
    insertRow(getRowCount(), rowData);
    * Adds a row to the end of the model. The new row will contain
    * <code>null</code> values unless <code>rowData</code> is specified.
    * Notification of the row being added will be generated.
    * @param rowData optional data of the row being added
    public void addRow(Object[] rowData) {
    addRow(convertToVector(rowData));
    * Inserts a row at <code>row</code> in the model. The new row
    * will contain <code>null</code> values unless <code>rowData</code>
    * is specified. Notification of the row being added will be generated.
    * @param row the row index of the row to be inserted
    * @param rowData optional data of the row being added
    * @exception ArrayIndexOutOfBoundsException if the row was invalid
    public void insertRow(int row, Vector rowData) {
    dataVector.insertElementAt(rowData, row);
    justifyRows(row, row+1);
    fireTableRowsInserted(row, row);
    * Inserts a row at <code>row</code> in the model. The new row
    * will contain <code>null</code> values unless <code>rowData</code>
    * is specified. Notification of the row being added will be generated.
    * @param row the row index of the row to be inserted
    * @param rowData optional data of the row being added
    * @exception ArrayIndexOutOfBoundsException if the row was invalid
    public void insertRow(int row, Object[] rowData) {
    insertRow(row, convertToVector(rowData));
    private static int gcd(int i, int j) {
    return (j == 0) ? i : gcd(j, i%j);
    private static void rotate(Vector v, int a, int b, int shift) {
    int size = b - a;
    int r = size - shift;
    int g = gcd(size, r);
    for(int i = 0; i < g; i++) {
    int to = i;
    Object tmp = v.elementAt(a + to);
    for(int from = (to + r) % size; from != i; from = (to + r) % size) {
    v.setElementAt(v.elementAt(a + from), a + to);
    to = from;
    v.setElementAt(tmp, a + to);
    * Moves one or more rows from the inlcusive range <code>start</code> to
    * <code>end</code> to the <code>to</code> position in the model.
    * After the move, the row that was at index <code>start</code>
    * will be at index <code>to</code>.
    * This method will send a <code>tableChanged</code> notification
    * message to all the listeners. <p>
    * <pre>
    * Examples of moves:
    * <p>
    * 1. moveRow(1,3,5);
    * a|B|C|D|e|f|g|h|i|j|k - before
    * a|e|f|g|h|B|C|D|i|j|k - after
    * <p>
    * 2. moveRow(6,7,1);
    * a|b|c|d|e|f|G|H|i|j|k - before
    * a|G|H|b|c|d|e|f|i|j|k - after
    * <p>
    * </pre>
    * @param start the starting row index to be moved
    * @param end the ending row index to be moved
    * @param to the destination of the rows to be moved
    * @exception ArrayIndexOutOfBoundsException if any of the elements
    * would be moved out of the table's range
    public void moveRow(int start, int end, int to) {
    int shift = to - start;
    int first, last;
    if (shift < 0) {
    first = to;
    last = end;
    else {
    first = start;
    last = to + end - start;
    rotate(dataVector, first, last + 1, shift);
    fireTableRowsUpdated(first, last);
    * Removes the row at <code>row</code> from the model. Notification
    * of the row being removed will be sent to all the listeners.
    * @param row the row index of the row to be removed
    * @exception ArrayIndexOutOfBoundsException if the row was invalid
    public void removeRow(int row) {
    dataVector.removeElementAt(row);
    fireTableRowsDeleted(row, row);
    // Manipulating columns
    * Replaces the column identifiers in the model. If the number of
    * <code>newIdentifier</code>s is greater than the current number
    * of columns, new columns are added to the end of each row in the model.
    * If the number of <code>newIdentifier</code>s is less than the current
    * number of columns, all the extra columns at the end of a row are
    * discarded. <p>
    * @param newIdentifiers vector of column identifiers. If
    *                    <code>null</code>, set the model
    * to zero columns
    public void setColumnIdentifiers(Vector columnIdentifiers) {
    setDataVector(dataVector, columnIdentifiers);
    * Replaces the column identifiers in the model. If the number of
    * <code>newIdentifier</code>s is greater than the current number
    * of columns, new columns are added to the end of each row in the model.
    * If the number of <code>newIdentifier</code>s is less than the current
    * number of columns, all the extra columns at the end of a row are
    * discarded. <p>
    * @param newIdentifiers array of column identifiers.
    *                    If <code>null</code>, set
    * the model to zero columns
    public void setColumnIdentifiers(Object[] newIdentifiers) {
    setColumnIdentifiers(convertToVector(newIdentifiers));
    * Sets the number of columns in the model. If the new size is greater
    * than the current size, new columns are added to the end of the model
    * with <code>null</code> cell values.
    * If the new size is less than the current size, all columns at index
    * <code>columnCount</code> and greater are discarded.
    * @param columnCount the new number of columns in the model
    public void setColumnCount(int columnCount) {
    columnIdentifiers.setSize(columnCount);
    justifyRows(0, getRowCount());
    fireTableStructureChanged();
    * Adds a column to the model. The new column will have the
    * identifier <code>columnName</code>, which may be null. This method
    * will send a
    * <code>tableChanged</code> notification message to all the listeners.
    * This method is a cover for <code>addColumn(Object, Vector)</code> which
    * uses <code>null</code> as the data vector.
    * @param columnName the identifier of the column being added
    public void addColumn(Object columnName) {
    addColumn(columnName, (Vector)null);
    * Adds a column to the model. The new column will have the
    * identifier <code>columnName</code>, which may be null.
    * <code>columnData</code> is the
    * optional vector of data for the column. If it is <code>null</code>
    * the column is filled with <code>null</code> values. Otherwise,
    * the new data will be added to model starting with the first
    * element going to row 0, etc. This method will send a
    * <code>tableChanged</code> notification message to all the listeners.
    * @param columnName the identifier of the column being added
    * @param columnData optional data of the column being added
    public void addColumn(Object columnName, Vector columnData) {
    columnIdentifiers.addElement(columnName);
    if (columnData != null) {
    int columnSize = columnData.size();
    if (columnSize > getRowCount()) {
    dataVector.setSize(columnSize);
    justifyRows(0, getRowCount());
    int newColumn = getColumnCount() - 1;
    for(int i = 0; i < columnSize; i++) {
    Vector row = (Vector)dataVector.elementAt(i);
    row.setElementAt(columnData.elementAt(i), newColumn);
    else {
    justifyRows(0, getRowCount());
    fireTableStructureChanged();
    * Adds a column to the model. The new column will have the
    * identifier <code>columnName</code>. <code>columnData</code> is the
    * optional array of data for the column. If it is <code>null</code>
    * the column is filled with <code>null</code> values. Otherwise,
    * the new data will be added to model starting with the first
    * element going to row 0, etc. This method will send a
    * <code>tableChanged</code> notification message to all the listeners.
    public void addColumn(Object columnName, Object[] columnData) {
    addColumn(columnName, convertToVector(columnData));
    // Implementing the TableModel interface
    * Returns the number of rows in this data table.
    * @return the number of rows in the model
    public int getRowCount() {
    return dataVector.size();
    * Returns the number of columns in this data table.
    * @return the number of columns in the model
    public int getColumnCount() {
    return columnIdentifiers.size();
    * Returns the column name.
    * @return a name for this column using the string value of the
    * appropriate member in <code>columnIdentifiers</code>.
    * If <code>columnIdentifiers</code> does not have an entry
    * for this index, returns the default
    * name provided by the superclass
    public String getColumnName(int column) {
    Object id = null;
    // This test is to cover the case when
    // getColumnCount has been subclassed by mistake ...
    if (column < columnIdentifiers.size()) {
    id = columnIdentifiers.elementAt(column);
    return (id == null) ? getDefaultColumnName(column)
    : id.toString();
    * Returns true regardless of parameter values.
    * @param row the row whose value is to be queried
    * @param column the column whose value is to be queried
    * @return true
    public boolean isCellEditable(int row, int column) {
    return true;
    * Returns an attribute value for the cell at <code>row</code>
    * and <code>column</code>.
    * @param row the row whose value is to be queried
    * @param column the column whose value is to be queried
    * @return the value Object at the specified cell
    * @exception ArrayIndexOutOfBoundsException if an invalid row or
    * column was given
    public Object getValueAt(int row, int column) {
    Vector rowVector = (Vector)dataVector.elementAt(row);
    return rowVector.elementAt(column);
    * Sets the object value for the cell at <code>column</code> and
    * <code>row</code>. <code>aValue</code> is the new value. This method
    * will generate a <code>tableChanged</code> notification.
    * @param aValue the new value; this can be null
    * @param row the row whose value is to be changed
    * @param column the column whose value is to be changed
    * @exception ArrayIndexOutOfBoundsException if an invalid row or
    * column was given
    public void setValueAt(Object aValue, int row, int column) {
    Vector rowVector = (Vector)dataVector.elementAt(row);
    rowVector.setElementAt(aValue, column);
    fireTableCellUpdated(row, column);
    // Protected Methods
    * Returns a vector that contains the same objects as the array.
    * @param anArray the array to be converted
    * @return the new vector; if <code>anArray</code> is <code>null</code>,
    *                    returns <code>null</code>
    protected static Vector convertToVector(Object[] anArray) {
    if (anArray == null) {
    return null;
    Vector v = new Vector(anArray.length);
    for (int i=0; i < anArray.length; i++) {
    v.addElement(anArray[i]);
    return v;
    * Returns a vector of vectors that contains the same objects as the array.
    * @param anArray the double array to be converted
    * @return the new vector of vectors; if <code>anArray</code> is
    *                    <code>null</code>, returns <code>null</code>
    protected static Vector convertToVector(Object[][] anArray) {
    if (anArray == null) {
    return null;
    Vector v = new Vector(anArray.length);
    for (int i=0; i < anArray.length; i++) {
    v.addElement(convertToVector(anArray[i]));
    return v;

  • Another JTable/buttons in cells query - event forwarding

    Hi Everyone.
    Apologies in advance for yet another thread on this subject. I realise this has been discussed a number of times but I can't find what seems like a definitive solution.
    I understand what the fundamental issue is with putting JComponents in table cells - i.e. that the cells are rendered essentially as static visual entities, that they're not "components" as such and will not receive events.
    I'd like to implement JButtons in table cells so that they behave as "normally" as possible - i.e. handle their own roll-over appearance, handle their own pressed appearance, and fire action events when pressed, with as little manual intervention in these mechanisms (e.g. in mouse listener code) as possible. I'm trying to do this by forwarding mouse events from the table to the button, but this doesn't seem to work as I'd hoped and I have various questions...
    (Background: I have implemented JButton objects in the data model, and the getTableCellRendererComponent() method returns *(JButton)value*.)
    My first question concerns the interception of mouse events. The usual technique would be to add a mouse listener and/or mouse motion listener to the table, and implement mouseClicked(), mousePressed() etc. However, can I override the table's processMouseEvent() and processMouseMotionEvent() methods instead, and from here forward events to buttons where appropriate, or process normally with super.processMouseEvent()? My motivation for doing this would be specifically not to invoke the super methods where events were forwarded to buttons - effectively consuming the event. Is this correct technique?
    My second question concerns attempts to reproduce button roll-over appearances. The JTable is of course considered a single entity as far as mouse events are concerned, and MOUSE_ENTERED and MOUSE_EXITED events aren't generated as the pointer moves from cell to cell. Merely forwarding mouse events to buttons - which will mostly be MOUSE_MOVED events - seems to be insufficient and presumably the roll-over appearance change relies upon ENTERED and EXITED events occurring at the proper times.
    I mimicked this behaviour in my override of processMouseMotionEvent() by calculating the value (i.e. JButton reference) of the cell under the mouse pointer, and if it wasn't the same as for the previous event, manually creating a MOUSE_ENTERED event and forwarding it to the new button. This seemed to work - the rollovers were happening (provided a table repaint() was performed), but it seemed to work without needing to explicitly sending a MOUSE_EXITED to the previous button before sending MOUSE_ENTERED to the new. I'm unclear why this is so - I was half-expecting both buttons to acquire the roll-over state, and they didn't.
    Also, I had assumed that having taken care of this, I should forward MOUSE_MOVED events occurring within the confines of a cell's area to the button verbatim, but this seems to instantly cancel out any roll-over (visually the button would briefly flash a roll-over appearance as the pointer moved into its cell bounds). Why might this be so?
    My last question is about the actual pressing of the button. I had hoped that forwarding MOUSE_CLICKED, MOUSE_PRESSED and MOUSE_RELEASED would cause the button to (a) acquire the button-pressed state, and (b) fire an action event to its action listeners. Neither of these things occur, and I don't understand why not.
    In summary, is interception and forwarding of events like this a viable technique for implementing table cell buttons? The various solutions that a Google trawl throws up all reproduce button-pressing mechanics in varying degrees, some just detecting a click and calling some user function, others manually manipulating the button model in the mouse handler etc. If possible I'd like to avoid this, and leave as much processing as possible to the button's native code.
    Thanks in advance for any suggestions received.
    Regards,
    A.

    try to look on this
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender

  • Focus Problem with JTree and Menus

    Hi all,
    I have a problem with focus when editing a JTree and selecting a menu. The problem occurs when the user single clicks on a node, invoking the countdown to edit. If the user quickly clicks on a menu item, the focus will go to the menu item, but then when the countdown finishes, the node now has keyboard focus.
    Below is code to reproduce the problem. Click on the node, hover for a little bit, then quickly click on the menu item.
    How would I go about fixing the problem? Thanks!
    import java.awt.Container;
    import java.awt.GridLayout;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    public class MyTree extends JTree {
         public MyTree(DefaultTreeModel treemodel) {
              setModel(treemodel);
              setRootVisible(true);
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              JMenuBar bar = new JMenuBar();
              JMenu menu = new JMenu("Test");
              JMenuItem item = new JMenuItem("Item");
              menu.add(item);
              bar.add(menu);
              frame.setJMenuBar(bar);
              Container contentPane = frame.getContentPane();
              contentPane.setLayout(new GridLayout(1, 2));
              DefaultMutableTreeNode root1 = new DefaultMutableTreeNode("Root");
              root1.add(new DefaultMutableTreeNode("Root2"));
              DefaultTreeModel model = new DefaultTreeModel(root1);
              MyTree tree1 = new MyTree(model);
              tree1.setEditable(true);
              tree1.setCellEditor(
                   new ComponentTreeCellEditor(
                        tree1,
                        new ComponentTreeCellRenderer()));
              tree1.setRowHeight(0);
              contentPane.add(tree1);
              frame.pack();
              frame.show();
    import java.awt.FlowLayout;
    import java.util.EventObject;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultTreeCellEditor;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreeCellEditor;
    import javax.swing.tree.TreeCellRenderer;
    public class ComponentTreeCellEditor
         extends DefaultTreeCellEditor
         implements TreeCellEditor {
         private String m_oldValue;
         private TreeCellRenderer m_renderer = null;
         private DefaultTreeModel m_model = null;
         private JPanel m_display = null;
         private JTextField m_field = null;
         private JTree m_tree = null;
         public ComponentTreeCellEditor(
              JTree tree,
              DefaultTreeCellRenderer renderer) {
              super(tree, renderer);
              m_renderer = renderer;
              m_model = (DefaultTreeModel) tree.getModel();
              m_tree = tree;
              m_display = new JPanel(new FlowLayout(FlowLayout.LEFT));
              m_field = new JTextField();
              m_display.add(new JLabel("My Label "));
              m_display.add(m_field);
         public java.awt.Component getTreeCellEditorComponent(
              JTree tree,
              Object value,
              boolean isSelected,
              boolean expanded,
              boolean leaf,
              int row) {
              m_field.setText(value.toString());
              return m_display;
         public Object getCellEditorValue() {
              return m_field.getText();
          * The edited cell should always be selected.
          * @param anEvent the event that fired this function.
          * @return true, always.
         public boolean shouldSelectCell(EventObject anEvent) {
              return true;
          * Only edit immediately if the event is null.
          * @param event the event being studied
          * @return true if event is null, false otherwise.
         protected boolean canEditImmediately(EventObject event) {
              return (event == null);
    }

    You can provide a cell renderer to the JTree to paint the checkBox.
    The following code checks or unchecks the box with each click also:
    _tree.setCellRenderer(new DefaultTreeCellRenderer()
      private JCheckBox checkBox = null;
      public Component getTreeCellRendererComponent(JTree tree,
                                                    Object value,
                                                    boolean selected,
                                                    boolean expanded,
                                                    boolean leaf,
                                                    int row,
                                                    boolean hasFocus)
        // Each node will be drawn as a check box
        if (checkBox == null)
          checkBox  = new JCheckBox();
          checkBox .setBackground(tree.getBackground());
        DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
        checkBox.setText(node.getUserObject().toString());
        checkBox.setSelected(selected);
        return checkBox;
    });

  • Drag and Drop between JTree and another component

    Hi,
    I have searched the forum for answer to this question but am not sure I found something similar to this. So, please help me out on this.
    I have a JTree and a JPanel, which basically shows images (as thumbnails) for the child nodes of one node in the tree heirarchy.
    I need to be able to drag and drop components from the JPanel to the JTree and vice versa, and of course, when you drop them on the tree, they should go under the correct node.
    I am using Swing 1.4.1, and have successfully implemented DnD in the JTree itself. But I am a little unclear about the DnD between the tree and the panel.
    Would really appreciate if someone could throw some light on this.
    Thanks a lot,
    Sri.

    Hi clairesheridan,
    thanks for your response. Your answer would have helped me if I was using JDK 1.3 but I am try to use the Swing API in jdk1.4.1, in which you have to set a transferhandler etc.
    Please let me know if you have any ideas or solutions.
    Thanks,
    sriharmya.

  • Difference between AT NEW ..... and ON CHANGE events

    difference between AT NEW and ON Change events..
    Thanks

    Hi
    <b>AT NEW</b>
    |{END OF} comp
    Beginning or end of a group of lines with the same content in the component comp1 comp2 ... and in the components to the left of comp1 comp2 .... The components comp1 comp2 ... can be specified, as described in the section Specification of Components, with the limitation that access to object attributes is not possible here.
    <b>ON CHANGE OF</b>
    ON CHANGE OF dobj [OR dobj1 [OR dobj2] ... ].
      statement_block
    ENDON.
    The statements ON CHANGE OF and ENDON, which are forbidden in classes, define a control structure that can contain a statement block statement_block. After ON CHANGE OF, any number of data objects dobj1, dobj2... of any data type can be added, linked by OR.
    The first time a statement ON CHANGE OF is executed, the statement block is executed if at least one of the specified data objects is not initial. The statement block is executed for each additional execution of the same statement ON CHANGE OF, if the content of one of the specified data objects has been changed since the last time the statement ON CHANGE OF was executed.
    For each time the statement ON CHANGE OF is executed, the content of all the specified data objects is saved as an auxiliary variable internally in the global system. The auxiliary variable is linked to this statement and cannot be accessed in the program. The auxiliary variables and their contents are retained longer than the lifetime of procedures. An auxiliary variable of this type can only be initialized if its statement ON CHANGE OF is executed while the associated data object is initial.
    This control structure, which is forbidden in classes, is particularly prone to errors and should be replaced by branches with explicitly declared auxiliary variables.
    <b>example:-</b>
    Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
    DATA: BEGIN OF ITAB OCCURS 0,
          F1 TYPE I,
          F2(6) TYPE C,
          F3(10) TYPE N,
          F4(16) TYPE P DECIMALS  2,
          END OF ITAB.
    DATA: SUB_TOT(10) TYPE P DECIMALS 3.
    **--1
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 30.
    ITAB-F4 = '3000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    *--2
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    *-- 3
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    SORT ITAB BY F1.
    LOOP AT ITAB.
    AT FIRST.
    WRITE: /35 ' MATERIAL DETAILS:'.
    ULINE.
    ENDAT.
    AT NEW F1.
    WRITE: / 'DETAILS OF MATERIAL:' COLOR 7  , ITAB-F1.
    ULINE.
    ENDAT.
    WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
    SUB_TOT = SUB_TOT + ITAB-F4.
    AT END OF F1.
    ULINE.
    WRITE: / 'SUB TOTAL :'  COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
    CLEAR SUB_TOT.
    ENDAT.
    AT LAST.
    SUM.
    ULINE.
    WRITE: 'SUM:', ITAB-F4.
    ULINE.
    ENDAT.
    ENDLOOP.

  • Windows Event forwarding - What is a "Valid destination log"

    Hi all,
    I'm currently setting up a centralization infrastructure for Windows events using the built-in event forwarding capabilities available in Windows Server 2008 R2.
    One of my requirements is to be able to create several subscriptions on the collector machine and to store forwarded events in different log files. For that, I tested creating a custom log (called CustomLog). This log appears in the Event Viewer, under the
    "Applications and Services Logs".
    However, I am not able to redirect forwarded events to this CustomLog. CustomLog does not appear in the list of possible destination in the Event Viewer GUI to create a subscription.
    To try what could be wrong, I left it with the default ForwardedEvents as destination and I tried to change it via Powershell. I ran the following command supposed to set the destination log as CustomLog:
    wecutil ss "Collect from both sources" /lf:CustomLog
    It ran without error. Though, no events were logged into CustomLog, and when I go back to the GUI to create/modify subscriptions and I try to open the subscription I set, I get a pop-up stating the following:
    "The destination log defined in this subscription cannot be found in the list of valid destination logs on this computer. verify that this log exists on the computer and is valid as a destination for forwarded events. Note that classic logs, analytic
    and debug logs and the Security log cannot be used as destination."
    Does anybody know what a "valid destination log" is and how I could turn my CustomLog into such a valid destination?
    Kind regards,
    Mike
    P.S. How can I verify my account in order to be able to post screenshots?

    MikeSec, did you ever get an answer to this? I'm facing the same and wondered how to setup a custom log location for event forwarding also. Getting the same error as you "The destination log defined in this subscription cannot be found in the list of
    valid destination logs on this computer. Verify that this log exists on the computer and is valid as a destination for forwarded events. Note that classic logs, analytic and debug logs and the Security log cannot be used as destinations."
    Seems that there isn't a way to register new event-logs as valid destinations or channels for event-forwarding.

  • I want the Definitaion fo  Class and its Components  in ABAP . With Example

    Gowri

    <b>Classes</b>
    Classes are templates for objects. Conversely, you can say that the type of
    an object is the same as its class. A class is an abstract description of an object. You could say that it is a set of instructions for building an object. The attributes
    of objects are defined by the components of the class, which describe the
    state and behavior of objects.
    <b>
    Local and Global Classes</b>
    Classes in ABAP Objects can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24) in the
    ABAP Workbench. They are stored centrally in class pools in the class library
    in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes. Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.
    There is, however, a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program. Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
    The following sections describe how to define local classes and interfaces in an ABAP program. For information about how to define local classes and interfaces, refer to the  Class Builder section of the ABAP Workbench Tools documentation.
    <b>Defining Local Classes</b>
    Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
    CLASS <class> DEFINITION.
    ENDCLASS.
    It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
    If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
    CLASS <class> IMPLEMENTATION.
    ENDCLASS.
    The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
    <b>Structure of a Class</b>
    <u>The following statements define the structure of a class:</u>
    A class contains components
    Each component is assigned to a visibility section
    Classes implement methods
    The following sections describe the structure of classes in more detail.
    <b>Class Components</b>
    The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
    There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
    In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
    <b>Attributes</b>
    Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
    <b>Instance Attributes</b>
    The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
    <b>Static Attributes</b>
    The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
    All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
    <b>Methods</b>
    Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
    The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
    METHOD <meth>.
    ENDMETHOD.
    You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
    <b>Instance Methods</b>
    You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
    <b>Static Methods</b>
    You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
    <b>Special Methods</b>
    As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
    <b>Events</b>
    Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
    The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
    Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
    The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
    <b>Instance Events</b>
    You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
    <b>Static Events</b>
    You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
    <u>See also Triggering and Handling Events.</u>
    <b>Types</b>
    You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
    <b>Constants</b>
    Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
    <b>Visibility Sections</b>
    You can divide the declaration part of a class into up to three visibility areas:
    CLASS <class> DEFINITION.
      PUBLIC SECTION.
      PROTECTED SECTION.
      PRIVATE SECTION.
    ENDCLASS.
    These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
    <b>Public Section</b>
    All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
    <b>
    Protected Section</b>
    All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
    <b>Private Section</b>
    Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.
    <b>Encapsulation</b>
    The three visibility areas are the basis for one of the important features of object orientation - encapsulation. When you define a class, you should take great care in designing the public components, and try to declare as few public components as possible. The public components of global classes may not be changed once you have released the class.
    For example, public attributes are visible externally, and form a part of the interface between an object and its users. If you want to encapsulate the state of an object fully, you cannot declare any public attributes. As well as defining the visibility of an attribute, you can also protect it from changes using the READ-ONLY addition.
    "Example  :
    CLASS C_COUNTER DEFINITION.
      PUBLIC SECTION.
        METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
                 INCREMENT_COUNTER,
                 GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER IMPLEMENTATION.
      METHOD SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
      METHOD GET_COUNTER.
        GET_VALUE = COUNT.
      ENDMETHOD.
    ENDCLASS.
    The class C_COUNTER contains three public methods - SET_COUNTER, INCREMENT_COUNTER, and GET_COUNTER. Each of these works with the private integer field COUNT. Two of the methods have input and output parameters. These form the data interface of the class. The field COUNT is not outwardly visible.
    Reward   points  if it is usefull...
    Girish

  • From JTree to Help panel events JTree Single leaf

    i'm a begginer and i really don't know how to give events for the JTree i watch an example of JTree where them create a method that create de the DefaultMutableTreeNode and givs a bookInfo or something like that the thing is that the event is node.isLeaf() that compromise all the leafs of the JTree and i want that i give a event for a single leaf to provide the help information in another panel
    JTree
    |
    |_____option
    |
    |_____option ========> to Jpanel
    it has to show the information like in an image or something like that but i cant do it i really don't know how to do it please help me how can i do this events for the leafs, not for all the leaf, i want an event for a single leaf.

    Try to express the problem again but use some new lines, full stops, etc. Using a), b), c), etc to separate out the points you are trying to make would help.
    So that when we try to read your problem it makes sense.

  • Trying to create a new movie.  It tells me to name my movie, and the only event choice is the last movie I made.  I don't want it there.  I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    I'm trying to create a new movie.  It tells me to name my movie, and the only event choice in the drop down menu is the last movie I made. IMovie Library is greyed out. I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    peggy818 wrote:
    … I'm lost and I'm just starting.  Not sure I like the new version.  …
    have a read in the Manual:
    http://help.apple.com/imovie/mac/10.0/?lang=en#mov755717b21

  • How to capture show layer and hide layer event in photoshop through a plugin???

    How to capture show layer and hide layer event in photoshop through a plugin???for mac

    Use the Listener plug-in found in the SDK to see how you can monitor the show/hide layer event. You can also use the Getter plug-in to show what information you can find out about the current state of Photoshop.

  • Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010

    Hello All,
    As per my requirement I have a two custom list.
    Agent Details
    Port Name
    Agent Details contains Agent code, Port Name,  email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
    Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
    Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
    when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list. 
    After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
    name list) to Agent Details custom list.
    Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
    Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
    Is anything am doing wrong then please guide me.

    Hi,
    As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
    The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
    You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
    When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
    having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
    The articles below are about how to debug in the event receiver in SharePoint 2010.
    http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
    http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
    http://sharesaint.com/?p=77
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • 6i help needed!!!

    n reports 6i is there any difference in architecture between using run_product and srw.run_report(which according to 6i doc calls rwrun60.exe)? The reason is I that have the same report submitted by the above two processes produce font difference in

  • Invoice or Billing documents negative or positive signs in Tables

    Hi, How can we recognise the amount signs are negative or positive(+/-) in VBRK and VBRP tables for all Invoices and Billing documents. Is there any indicator in any other table will expain the sign when it is storing in database tables. for example:

  • Unlimited Render of HDV footage painfully slow

    i am currently working with a 10 min HDV 1080i50 sequence, on a 2 x 2.8 Quad Core Mac Pro running 10 GB of RAM. Within Final Cut Pro i need to render "Unlimited" and "Full" segments. The "Full" segments rendered at normal speed, but the"Unlimited" se

  • Transpose columns and rows in numbers

    I need to transpose columns and rows in Numbers and I do not want to write script to do it.  Is there an easier way?

  • I lost my phone. How can I delete my phone without having activated iCloud?

    hey I just lost my phone. My question is, how can I delete it without having activated iCloud?