J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | // This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead ! |
| 27 | |
| 28 | package sun.awt.X11; |
| 29 | |
| 30 | import sun.misc.Unsafe; |
| 31 | import java.util.logging.*; |
| 32 | |
| 33 | public class XQueryTree { |
| 34 | private static Unsafe unsafe = XlibWrapper.unsafe; |
| 35 | private static final Logger log = Logger.getLogger("sun.awt.X11.XQueryTree"); |
| 36 | private boolean __executed = false; |
| 37 | long _w; |
| 38 | long root_ptr = unsafe.allocateMemory(Native.getLongSize()); |
| 39 | long parent_ptr = unsafe.allocateMemory(Native.getLongSize()); |
| 40 | long children_ptr = unsafe.allocateMemory(Native.getLongSize()); |
| 41 | long nchildren_ptr = unsafe.allocateMemory(Native.getIntSize()); |
| 42 | UnsafeXDisposerRecord disposer; |
| 43 | public XQueryTree( |
| 44 | long w ) |
| 45 | { |
| 46 | set_w(w); |
| 47 | sun.java2d.Disposer.addRecord(this, disposer = new UnsafeXDisposerRecord("XQueryTree", |
| 48 | new long[]{root_ptr, parent_ptr, nchildren_ptr}, |
| 49 | new long[] {children_ptr})); |
| 50 | set_children(0); |
| 51 | } |
| 52 | public int execute() { |
| 53 | return execute(null); |
| 54 | } |
| 55 | public int execute(XToolkit.XErrorHandler errorHandler) { |
| 56 | XToolkit.awtLock(); |
| 57 | try { |
| 58 | if (isDisposed()) { |
| 59 | throw new IllegalStateException("Disposed"); |
| 60 | } |
| 61 | if (__executed) { |
| 62 | throw new IllegalStateException("Already executed"); |
| 63 | } |
| 64 | __executed = true; |
| 65 | if (errorHandler != null) { |
| 66 | XToolkit.WITH_XERROR_HANDLER(errorHandler); |
| 67 | } |
| 68 | Native.putLong(children_ptr, 0); |
| 69 | int status = |
| 70 | XlibWrapper.XQueryTree(XToolkit.getDisplay(), |
| 71 | get_w(), |
| 72 | root_ptr, |
| 73 | parent_ptr, |
| 74 | children_ptr, |
| 75 | nchildren_ptr ); |
| 76 | if (errorHandler != null) { |
| 77 | XToolkit.RESTORE_XERROR_HANDLER(); |
| 78 | } |
| 79 | return status; |
| 80 | } finally { |
| 81 | XToolkit.awtUnlock(); |
| 82 | } |
| 83 | } |
| 84 | public boolean isExecuted() { |
| 85 | return __executed; |
| 86 | } |
| 87 | |
| 88 | public boolean isDisposed() { |
| 89 | return disposer.disposed; |
| 90 | } |
| 91 | public void dispose() { |
| 92 | XToolkit.awtLock(); |
| 93 | try { |
| 94 | if (isDisposed()) { |
| 95 | return; |
| 96 | } |
| 97 | disposer.dispose(); |
| 98 | } finally { |
| 99 | XToolkit.awtUnlock(); |
| 100 | } |
| 101 | } |
| 102 | public long get_w() { |
| 103 | if (isDisposed()) { |
| 104 | throw new IllegalStateException("Disposed"); |
| 105 | } |
| 106 | if (!__executed) { |
| 107 | throw new IllegalStateException("Not executed"); |
| 108 | } |
| 109 | return _w; |
| 110 | } |
| 111 | public void set_w(long data) { |
| 112 | _w = data; |
| 113 | } |
| 114 | public long get_root() { |
| 115 | if (isDisposed()) { |
| 116 | throw new IllegalStateException("Disposed"); |
| 117 | } |
| 118 | if (!__executed) { |
| 119 | throw new IllegalStateException("Not executed"); |
| 120 | } |
| 121 | return Native.getLong(root_ptr); |
| 122 | } |
| 123 | public void set_root(long data) { |
| 124 | Native.putLong(root_ptr, data); |
| 125 | } |
| 126 | public long get_parent() { |
| 127 | if (isDisposed()) { |
| 128 | throw new IllegalStateException("Disposed"); |
| 129 | } |
| 130 | if (!__executed) { |
| 131 | throw new IllegalStateException("Not executed"); |
| 132 | } |
| 133 | return Native.getLong(parent_ptr); |
| 134 | } |
| 135 | public void set_parent(long data) { |
| 136 | Native.putLong(parent_ptr, data); |
| 137 | } |
| 138 | public long get_children() { |
| 139 | if (isDisposed()) { |
| 140 | throw new IllegalStateException("Disposed"); |
| 141 | } |
| 142 | if (!__executed) { |
| 143 | throw new IllegalStateException("Not executed"); |
| 144 | } |
| 145 | return Native.getLong(children_ptr); |
| 146 | } |
| 147 | public void set_children(long data) { |
| 148 | Native.putLong(children_ptr, data); |
| 149 | } |
| 150 | public int get_nchildren() { |
| 151 | if (isDisposed()) { |
| 152 | throw new IllegalStateException("Disposed"); |
| 153 | } |
| 154 | if (!__executed) { |
| 155 | throw new IllegalStateException("Not executed"); |
| 156 | } |
| 157 | return Native.getInt(nchildren_ptr); |
| 158 | } |
| 159 | public void set_nchildren(int data) { |
| 160 | Native.putInt(nchildren_ptr, data); |
| 161 | } |
| 162 | } |