bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
private static final BigInteger times(BigInteger x, int y) { if (y == 0) return ZERO; if (y == 1) return x; int[] xwords = x.words; int xlen = x.ival; if (xwords == null) return BigInteger.make((long) xlen * (long) y); boolean negative; BigInteger result = BigInteger.alloc(xlen + 1); if (xwords[xlen - 1] < 0) { negative = true; negate(result.words, xwords, xlen); xwords = result.words; } else negative = false; if (y < 0) { negative = !negative; y = -y; } result.words[xlen] = MPN.mul_1(result.words, xwords, xlen, y); result.ival = xlen + 1; if (negative) result.setNegative(); return result.canonicalize(); }
private static final BigInteger times(BigInteger x, int y) { if (y == 0) return ZERO; if (y == 1) return x; int[] xwords = x.words; int xlen = x.ival; if (xwords == null) return valueOf((long) xlen * (long) y); boolean negative; BigInteger result = BigInteger.alloc(xlen + 1); if (xwords[xlen - 1] < 0) { negative = true; negate(result.words, xwords, xlen); xwords = result.words; } else negative = false; if (y < 0) { negative = !negative; y = -y; } result.words[xlen] = MPN.mul_1(result.words, xwords, xlen, y); result.ival = xlen + 1; if (negative) result.setNegative(); return result.canonicalize(); }
15,388
public static BigInteger valueOf(long val) { return make(val); }
public static BigInteger valueOf(long val) { if (val >= minFixNum && val <= maxFixNum) return smallFixNums[(int) val - minFixNum]; int i = (int) val; if ((long) i == val) return new BigInteger(i); BigInteger result = alloc(2); result.ival = 2; result.words[0] = i; result.words[1] = (int)(val >> 32); return result; }
15,389
public FBScreen(Surface g) { this.g = g; w = 6; h = 18; sh = h * FBPcTextScreen.SCREEN_HEIGHT + 2 * margin; sw = w * FBPcTextScreen.SCREEN_WIDTH + 2 * margin; bi = new JNodeBufferedImage(sw, sh, BufferedImage.TYPE_INT_ARGB); ig = bi.getGraphics(); font = new Font("-FontForge-Bitstream Vera Sans Mono-Book-R-Normal-SansMono--12-120-75-75-P-69-FontSpecific", Font.PLAIN, 12); //font = new Font("-FontForge-Bitstream Vera Sans Mono-Book-R-Normal-SansMono--12-120-75-75-P-69-ISO10646", Font.PLAIN, 12); try{ FontProvider fm = (FontProvider) new BDFFontProvider(); if(!fm.provides(font)){ throw new RuntimeException(fm + " does not provide" + font); } tr = fm.getTextRenderer(font); if(tr == null) new NullPointerException("Text renderer is null"); }catch(Exception e){ new RuntimeException(e); } }
public FBScreen(Surface g) { this.g = g; w = 6; h = 18; sh = h * FBPcTextScreen.SCREEN_HEIGHT + 2 * margin; sw = w * FBPcTextScreen.SCREEN_WIDTH + 2 * margin; bi = new JNodeBufferedImage(sw, sh, BufferedImage.TYPE_INT_ARGB); ig = bi.getGraphics(); font = new Font("-FontForge-Bitstream Vera Sans Mono-Book-R-Normal-SansMono--12-120-75-75-P-69-ISO10646", Font.PLAIN, 12); //font = new Font("-FontForge-Bitstream Vera Sans Mono-Book-R-Normal-SansMono--12-120-75-75-P-69-ISO10646", Font.PLAIN, 12); try{ FontProvider fm = (FontProvider) new BDFFontProvider(); if(!fm.provides(font)){ throw new RuntimeException(fm + " does not provide" + font); } tr = fm.getTextRenderer(font); if(tr == null) new NullPointerException("Text renderer is null"); }catch(Exception e){ new RuntimeException(e); } }
15,390
public void repaint() { paintComponent(); }
public void repaint() { paintComponent(); }
15,392
public static void main(String[] args) throws Exception { final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/; Surface g = null; try { Device dev = null; if("".equals(devId)){ final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class); int dev_count = devs.size(); if(dev_count > 0){ Device[] dev_a = devs.toArray(new Device[dev_count]); dev = dev_a[0]; } } if(dev == null){ final DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME); dev = dm.getDevice(devId); } final FrameBufferAPI api = (FrameBufferAPI) dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); TextScreenConsoleManager mgr = new TextScreenConsoleManager(); ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500); ScrollableTextScreenConsole first = new ScrollableTextScreenConsole(mgr, "console", ts, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE); mgr.registerConsole(first); mgr.focus(first); new CommandShell(first).run(); Thread.sleep(60 * 1000); } catch (Throwable ex) { log.error("Error in FBConsole", ex); return; } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
public static void main(String[] args) throws Exception { final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/; Surface g = null; try { Device dev = null; if("".equals(devId)){ final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class); int dev_count = devs.size(); if(dev_count > 0){ Device[] dev_a = devs.toArray(new Device[dev_count]); dev = dev_a[0]; } } if(dev == null){ final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); dev = dm.getDevice(devId); } final FrameBufferAPI api = (FrameBufferAPI) dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); TextScreenConsoleManager mgr = new TextScreenConsoleManager(); ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500); ScrollableTextScreenConsole first = new ScrollableTextScreenConsole(mgr, "console", ts, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE); mgr.registerConsole(first); mgr.focus(first); new CommandShell(first).run(); Thread.sleep(60 * 1000); } catch (Throwable ex) { log.error("Error in FBConsole", ex); return; } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
15,393
public static void main(String[] args) throws Exception { final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/; Surface g = null; try { Device dev = null; if("".equals(devId)){ final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class); int dev_count = devs.size(); if(dev_count > 0){ Device[] dev_a = devs.toArray(new Device[dev_count]); dev = dev_a[0]; } } if(dev == null){ final DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME); dev = dm.getDevice(devId); } final FrameBufferAPI api = (FrameBufferAPI) dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); TextScreenConsoleManager mgr = new TextScreenConsoleManager(); ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500); ScrollableTextScreenConsole first = new ScrollableTextScreenConsole(mgr, "console", ts, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE); mgr.registerConsole(first); mgr.focus(first); new CommandShell(first).run(); Thread.sleep(60 * 1000); } catch (Throwable ex) { log.error("Error in FBConsole", ex); return; } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
public static void main(String[] args) throws Exception { final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/; Surface g = null; try { Device dev = null; if("".equals(devId)){ final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class); int dev_count = devs.size(); if(dev_count > 0){ Device[] dev_a = devs.toArray(new Device[dev_count]); dev = dev_a[0]; } } if(dev == null){ final DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME); dev = dm.getDevice(devId); } final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class); final FrameBufferConfiguration conf = api.getConfigurations()[0]; g = api.open(conf); TextScreenConsoleManager mgr = new TextScreenConsoleManager(); ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500); ScrollableTextScreenConsole first = new ScrollableTextScreenConsole(mgr, "console", ts, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE); mgr.registerConsole(first); mgr.focus(first); new CommandShell(first).run(); Thread.sleep(60 * 1000); } catch (Throwable ex) { log.error("Error in FBConsole", ex); return; } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
15,394
public void update(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; if (b.isContentAreaFilled() && (UIManager.get(getPropertyPrefix() + "gradient") != null) && b.isEnabled() && (b.getBackground() instanceof UIResource)) updateWidthGradient(g, b, b.getParent()); else super.update(g, c); }
public void update(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; if (b.isContentAreaFilled() && (UIManager.get(getPropertyPrefix() + "gradient") != null) && b.isEnabled() && (b.getBackground() instanceof UIResource)) updateWidthGradient(g, b, b.getParent()); else super.update(g, c); }
15,395
protected boolean isEofCluster(long entry) { return (entry >= eofMarker); }
protected boolean isEofCluster(long entry) { switch (bitSize) { case 12 : return (entry >=0xFF8); case 16 : return ((entry >= 0xFFF8)); case 32 : return (entry >= 0xFFFFFFF8); default : throw new IllegalArgumentException("Invalid bitSize " + bitSize); } }
15,396
public OutputStream _invoke(String method, InputStream input, ResponseHandler r_handler ) throws SystemException { boolean intercept = false; ServerRequestInterceptorOperations interceptor = null; gnuServerRequestInfo info = null; ResponseHandlerImpl i_handler = null; try { if (orb.iServer != null && r_handler instanceof ResponseHandlerImpl ) { interceptor = orb.iServer; i_handler = (ResponseHandlerImpl) r_handler; info = new gnuServerRequestInfo(this, i_handler.request_header, i_handler.reply_header ); intercept = true; interceptor.receive_request_service_contexts(info); } try { CookieHolder cookie = null; AOM.Obj self = poa.aom.get(Id); if (poa.servant_locator != null) { // If the servant locator is in use, it is always responsible // for providing the servant. self.servant = servant = null; cookie = new CookieHolder(); } else if (self != null && self.isDeactiveted()) { if (poa.applies( ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION ) && poa.servant_activator != null ) { // Reset the servant, forcing the subsequent activation. servant = null; } else { throw new OBJECT_NOT_EXIST("Object deactivated", 0x535503ec, CompletionStatus.COMPLETED_NO ); } } InvokeHandler handler = getHandler(method, cookie, true); Delegate d = null; try { d = servant._get_delegate(); orb.currents.put(Thread.currentThread(), this); } catch (Exception ex) { // In some cases exception is thrown if the delegate is not set. } if (d instanceof ServantDelegateImpl) { // If the delegate is already set, check maybe we can // reuse the existing instance. if (((ServantDelegateImpl) d).object != this) { servant._set_delegate(new ServantDelegateImpl(servant, poa, Id)); } } else { servant._set_delegate(new ServantDelegateImpl(servant, poa, Id)); } try { switch (manager.get_state().value()) { case State._ACTIVE : OutputStream rt; try { if (intercept) { interceptor.receive_request(info); } rt = handler._invoke(method, input, r_handler); if (intercept) { // Handler is casted into i_handler. if (i_handler.isExceptionReply()) { info.m_reply_header.reply_status = ReplyHeader.USER_EXCEPTION; // Make Any, holding the user exception. Any a = orb.create_any(); OutputStream buf = i_handler.getBuffer(); InputStream in = buf.create_input_stream(); String uex_idl = "unknown"; try { in.mark(Integer.MAX_VALUE); uex_idl = in.read_string(); in.reset(); } catch (IOException e) { throw new Unexpected(e); } try { UserException exception = ObjectCreator.readUserException(uex_idl, in ); ObjectCreator.insertWithHelper(a, exception ); } catch (Exception e) { // Failed due any reason, insert without // helper. a.insert_Streamable(new StreamHolder( buf.create_input_stream() ) ); RecordTypeCode r = new RecordTypeCode(TCKind.tk_except); r.setId(uex_idl); r.setName(ObjectCreator.getDefaultName( uex_idl ) ); } info.m_usr_exception = a; interceptor.send_exception(info); } else { info.m_reply_header.reply_status = ReplyHeader.NO_EXCEPTION; interceptor.send_reply(info); } } } catch (SystemException sys_ex) { if (intercept) { info.m_reply_header.reply_status = ReplyHeader.SYSTEM_EXCEPTION; info.m_sys_exception = sys_ex; interceptor.send_exception(info); } throw sys_ex; } return rt; case State._HOLDING : // The holding mode is implemented // relying on the holding capabilites of the network // support (if any). // TODO FIXME in more recent CORBA applications, the // client // ORB can free the connection and wait for a server side // notification about the completed request. Implement // this // as soon as JDK specification would allow bidirectional // policy. int sleep = 5; int max = 500; // Wait till the state will be switched into some other // mode. while (manager.get_state().value() == State._HOLDING) { try { Thread.sleep(sleep); if (sleep < max) { sleep = max; } } catch (InterruptedException ex) { } } // Handle another mode. return _invoke(method, input, r_handler); case State._DISCARDING : throw new TRANSIENT("Discarding mode", 0x535503e9, CompletionStatus.COMPLETED_NO ); case State._INACTIVE : throw new OBJ_ADAPTER("POA deactivated", 0x535503ea, CompletionStatus.COMPLETED_NO ); default : throw new InternalError(); // No more states. } } finally { if (poa.servant_locator != null) { poa.servant_locator.postinvoke(Id, poa, method, cookie.value, servant ); servant = null; } } } finally { orb.currents.remove(Thread.currentThread()); } } catch (ForwardRequest fex) { // May be thrown by interceptor. if (intercept) { Forwarding: while (true) { info.m_reply_header.reply_status = ReplyHeader.LOCATION_FORWARD; info.m_forward_reference = fex.forward; try { interceptor.send_other(info); break Forwarding; } catch (ForwardRequest fex2) { info.m_forward_reference = fex2.forward; fex.forward = info.m_forward_reference; } } } throw new gnuForwardRequest(fex.forward); } catch (gnuForwardRequest fex) { // May be thrown during activation. if (intercept) { Forwarding: while (true) { info.m_reply_header.reply_status = ReplyHeader.LOCATION_FORWARD; info.m_forward_reference = fex.forward_reference; try { interceptor.send_other(info); break Forwarding; } catch (ForwardRequest fex2) { info.m_forward_reference = fex2.forward; fex.forward_reference = (ObjectImpl) fex2.forward; } } } throw fex; } }
public OutputStream _invoke(String method, InputStream input, ResponseHandler r_handler ) throws SystemException { boolean intercept = false; ServerRequestInterceptorOperations interceptor = null; gnuServerRequestInfo info = null; ResponseHandlerImpl i_handler = null; try { if (orb.iServer != null && r_handler instanceof ResponseHandlerImpl ) { interceptor = orb.iServer; i_handler = (ResponseHandlerImpl) r_handler; info = new gnuServerRequestInfo(this, i_handler.request_header, i_handler.reply_header ); intercept = true; interceptor.receive_request_service_contexts(info); } try { CookieHolder cookie = null; AOM.Obj self = poa.aom.get(Id); if (poa.servant_locator != null) { // If the servant locator is in use, it is always responsible // for providing the servant. self.servant = cookie = new CookieHolder(); } else if (self != null && self.isDeactiveted()) { if (poa.applies( ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION ) && poa.servant_activator != null ) { // Reset the servant, forcing the subsequent activation. } else { throw new OBJECT_NOT_EXIST("Object deactivated", 0x535503ec, CompletionStatus.COMPLETED_NO ); } } InvokeHandler handler = getHandler(method, cookie, true); Delegate d = null; try { d = servant._get_delegate(); orb.currents.put(Thread.currentThread(), this); } catch (Exception ex) { // In some cases exception is thrown if the delegate is not set. } if (d instanceof ServantDelegateImpl) { // If the delegate is already set, check maybe we can // reuse the existing instance. if (((ServantDelegateImpl) d).object != this) { servant._set_delegate(new ServantDelegateImpl(servant, poa, Id)); } } else { servant._set_delegate(new ServantDelegateImpl(servant, poa, Id)); } try { switch (manager.get_state().value()) { case State._ACTIVE : OutputStream rt; try { if (intercept) { interceptor.receive_request(info); } rt = handler._invoke(method, input, r_handler); if (intercept) { // Handler is casted into i_handler. if (i_handler.isExceptionReply()) { info.m_reply_header.reply_status = ReplyHeader.USER_EXCEPTION; // Make Any, holding the user exception. Any a = orb.create_any(); OutputStream buf = i_handler.getBuffer(); InputStream in = buf.create_input_stream(); String uex_idl = "unknown"; try { in.mark(Integer.MAX_VALUE); uex_idl = in.read_string(); in.reset(); } catch (IOException e) { throw new Unexpected(e); } try { UserException exception = ObjectCreator.readUserException(uex_idl, in ); ObjectCreator.insertWithHelper(a, exception ); } catch (Exception e) { // Failed due any reason, insert without // helper. a.insert_Streamable(new StreamHolder( buf.create_input_stream() ) ); RecordTypeCode r = new RecordTypeCode(TCKind.tk_except); r.setId(uex_idl); r.setName(ObjectCreator.getDefaultName( uex_idl ) ); } info.m_usr_exception = a; interceptor.send_exception(info); } else { info.m_reply_header.reply_status = ReplyHeader.NO_EXCEPTION; interceptor.send_reply(info); } } } catch (SystemException sys_ex) { if (intercept) { info.m_reply_header.reply_status = ReplyHeader.SYSTEM_EXCEPTION; info.m_sys_exception = sys_ex; interceptor.send_exception(info); } throw sys_ex; } return rt; case State._HOLDING : // The holding mode is implemented // relying on the holding capabilites of the network // support (if any). // TODO FIXME in more recent CORBA applications, the // client // ORB can free the connection and wait for a server side // notification about the completed request. Implement // this // as soon as JDK specification would allow bidirectional // policy. int sleep = 5; int max = 500; // Wait till the state will be switched into some other // mode. while (manager.get_state().value() == State._HOLDING) { try { Thread.sleep(sleep); if (sleep < max) { sleep = max; } } catch (InterruptedException ex) { } } // Handle another mode. return _invoke(method, input, r_handler); case State._DISCARDING : throw new TRANSIENT("Discarding mode", 0x535503e9, CompletionStatus.COMPLETED_NO ); case State._INACTIVE : throw new OBJ_ADAPTER("POA deactivated", 0x535503ea, CompletionStatus.COMPLETED_NO ); default : throw new InternalError(); // No more states. } } finally { if (poa.servant_locator != null) { poa.servant_locator.postinvoke(Id, poa, method, cookie.value, servant ); } } } finally { orb.currents.remove(Thread.currentThread()); } } catch (ForwardRequest fex) { // May be thrown by interceptor. if (intercept) { Forwarding: while (true) { info.m_reply_header.reply_status = ReplyHeader.LOCATION_FORWARD; info.m_forward_reference = fex.forward; try { interceptor.send_other(info); break Forwarding; } catch (ForwardRequest fex2) { info.m_forward_reference = fex2.forward; fex.forward = info.m_forward_reference; } } } throw new gnuForwardRequest(fex.forward); } catch (gnuForwardRequest fex) { // May be thrown during activation. if (intercept) { Forwarding: while (true) { info.m_reply_header.reply_status = ReplyHeader.LOCATION_FORWARD; info.m_forward_reference = fex.forward_reference; try { interceptor.send_other(info); break Forwarding; } catch (ForwardRequest fex2) { info.m_forward_reference = fex2.forward; fex.forward_reference = (ObjectImpl) fex2.forward; } } } throw fex; } }
15,397
public VolatileImage createVolatileImage(int width, int height) { if (GraphicsEnvironment.isHeadless()) return null; GraphicsConfiguration config = getGraphicsConfiguration(); return config == null ? null : config.createCompatibleVolatileImage(width, height); }
public VolatileImage createVolatileImage(int width, int height) { if (peer != null) return peer.createVolatileImage(width, height); return null; GraphicsConfiguration config = getGraphicsConfiguration(); return config == null ? null : config.createCompatibleVolatileImage(width, height); }
15,399
public VolatileImage createVolatileImage(int width, int height) { if (GraphicsEnvironment.isHeadless()) return null; GraphicsConfiguration config = getGraphicsConfiguration(); return config == null ? null : config.createCompatibleVolatileImage(width, height); }
public VolatileImage createVolatileImage(int width, int height) { if (GraphicsEnvironment.isHeadless()) return null; GraphicsConfiguration config = getGraphicsConfiguration(); return config == null ? null : config.createCompatibleVolatileImage(width, height); }
15,400
void dispatchEventImpl(AWTEvent e) { // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight() && !e.isConsumed()) requestFocus(); break; } } } if (peer != null) peer.handleEvent(e); }
void dispatchEventImpl(AWTEvent e) { // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight() && isEnabled() && !e.isConsumed()) requestFocus(); break; } } } if (peer != null) peer.handleEvent(e); }
15,401
static Event translateEvent (AWTEvent e) { Object target = e.getSource (); Event translated = null; if (e instanceof InputEvent) { InputEvent ie = (InputEvent) e; long when = ie.getWhen (); int oldID = 0; int id = e.getID (); int oldMods = 0; int mods = ie.getModifiersEx (); if ((mods & InputEvent.BUTTON2_DOWN_MASK) != 0) oldMods |= Event.META_MASK; else if ((mods & InputEvent.BUTTON3_DOWN_MASK) != 0) oldMods |= Event.ALT_MASK; if ((mods & InputEvent.SHIFT_DOWN_MASK) != 0) oldMods |= Event.SHIFT_MASK; if ((mods & InputEvent.CTRL_DOWN_MASK) != 0) oldMods |= Event.CTRL_MASK; if ((mods & InputEvent.META_DOWN_MASK) != 0) oldMods |= Event.META_MASK; if ((mods & InputEvent.ALT_DOWN_MASK) != 0) oldMods |= Event.ALT_MASK; if (e instanceof MouseEvent) { if (id == MouseEvent.MOUSE_PRESSED) oldID = Event.MOUSE_DOWN; else if (id == MouseEvent.MOUSE_RELEASED) oldID = Event.MOUSE_UP; else if (id == MouseEvent.MOUSE_MOVED) oldID = Event.MOUSE_MOVE; else if (id == MouseEvent.MOUSE_DRAGGED) oldID = Event.MOUSE_DRAG; else if (id == MouseEvent.MOUSE_ENTERED) oldID = Event.MOUSE_ENTER; else if (id == MouseEvent.MOUSE_EXITED) oldID = Event.MOUSE_EXIT; else // No analogous AWT 1.0 mouse event. return null; MouseEvent me = (MouseEvent) e; translated = new Event (target, when, oldID, me.getX (), me.getY (), 0, oldMods); } else if (e instanceof KeyEvent) { if (id == KeyEvent.KEY_PRESSED) oldID = Event.KEY_PRESS; else if (e.getID () == KeyEvent.KEY_RELEASED) oldID = Event.KEY_RELEASE; else // No analogous AWT 1.0 key event. return null; int oldKey = 0; int newKey = ((KeyEvent) e).getKeyCode (); switch (newKey) { case KeyEvent.VK_BACK_SPACE: oldKey = Event.BACK_SPACE; break; case KeyEvent.VK_CAPS_LOCK: oldKey = Event.CAPS_LOCK; break; case KeyEvent.VK_DELETE: oldKey = Event.DELETE; break; case KeyEvent.VK_DOWN: case KeyEvent.VK_KP_DOWN: oldKey = Event.DOWN; break; case KeyEvent.VK_END: oldKey = Event.END; break; case KeyEvent.VK_ENTER: oldKey = Event.ENTER; break; case KeyEvent.VK_ESCAPE: oldKey = Event.ESCAPE; break; case KeyEvent.VK_F1: oldKey = Event.F1; break; case KeyEvent.VK_F10: oldKey = Event.F10; break; case KeyEvent.VK_F11: oldKey = Event.F11; break; case KeyEvent.VK_F12: oldKey = Event.F12; break; case KeyEvent.VK_F2: oldKey = Event.F2; break; case KeyEvent.VK_F3: oldKey = Event.F3; break; case KeyEvent.VK_F4: oldKey = Event.F4; break; case KeyEvent.VK_F5: oldKey = Event.F5; break; case KeyEvent.VK_F6: oldKey = Event.F6; break; case KeyEvent.VK_F7: oldKey = Event.F7; break; case KeyEvent.VK_F8: oldKey = Event.F8; break; case KeyEvent.VK_F9: oldKey = Event.F9; break; case KeyEvent.VK_HOME: oldKey = Event.HOME; break; case KeyEvent.VK_INSERT: oldKey = Event.INSERT; break; case KeyEvent.VK_LEFT: case KeyEvent.VK_KP_LEFT: oldKey = Event.LEFT; break; case KeyEvent.VK_NUM_LOCK: oldKey = Event.NUM_LOCK; break; case KeyEvent.VK_PAUSE: oldKey = Event.PAUSE; break; case KeyEvent.VK_PAGE_DOWN: oldKey = Event.PGDN; break; case KeyEvent.VK_PAGE_UP: oldKey = Event.PGUP; break; case KeyEvent.VK_PRINTSCREEN: oldKey = Event.PRINT_SCREEN; break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_KP_RIGHT: oldKey = Event.RIGHT; break; case KeyEvent.VK_SCROLL_LOCK: oldKey = Event.SCROLL_LOCK; break; case KeyEvent.VK_TAB: oldKey = Event.TAB; break; case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: oldKey = Event.UP; break; default: oldKey = (int) ((KeyEvent) e).getKeyChar(); } translated = new Event (target, when, oldID, 0, 0, oldKey, oldMods); } } else if (e instanceof AdjustmentEvent) { AdjustmentEvent ae = (AdjustmentEvent) e; int type = ae.getAdjustmentType(); int oldType; if (type == AdjustmentEvent.BLOCK_DECREMENT) oldType = Event.SCROLL_PAGE_UP; else if (type == AdjustmentEvent.BLOCK_INCREMENT) oldType = Event.SCROLL_PAGE_DOWN; else if (type == AdjustmentEvent.TRACK) oldType = Event.SCROLL_ABSOLUTE; else if (type == AdjustmentEvent.UNIT_DECREMENT) oldType = Event.SCROLL_LINE_UP; else if (type == AdjustmentEvent.UNIT_INCREMENT) oldType = Event.SCROLL_LINE_DOWN; else oldType = type; translated = new Event(target, oldType, new Integer(ae.getValue())); } else if (e instanceof ActionEvent) translated = new Event (target, Event.ACTION_EVENT, ((ActionEvent) e).getActionCommand ()); return translated; }
static Event translateEvent (AWTEvent e) { Object target = e.getSource (); Event translated = null; if (e instanceof WindowEvent) { WindowEvent we = (WindowEvent) e; int id = we.id; int newId = 0; switch (id) { case WindowEvent.WINDOW_DEICONIFIED: newId = Event.WINDOW_DEICONIFY; break; case WindowEvent.WINDOW_CLOSED: case WindowEvent.WINDOW_CLOSING: newId = Event.WINDOW_DESTROY; break; case WindowEvent.WINDOW_ICONIFIED: newId = Event.WINDOW_ICONIFY; break; case WindowEvent.WINDOW_GAINED_FOCUS: newId = Event.GOT_FOCUS; break; case WindowEvent.WINDOW_LOST_FOCUS: newId = Event.LOST_FOCUS; break; default: return null; } translated = new Event(target, 0, newId, 0, 0, 0, 0); } else if (e instanceof InputEvent) { InputEvent ie = (InputEvent) e; long when = ie.getWhen (); int oldID = 0; int id = e.getID (); int oldMods = 0; int mods = ie.getModifiersEx (); if ((mods & InputEvent.BUTTON2_DOWN_MASK) != 0) oldMods |= Event.META_MASK; else if ((mods & InputEvent.BUTTON3_DOWN_MASK) != 0) oldMods |= Event.ALT_MASK; if ((mods & InputEvent.SHIFT_DOWN_MASK) != 0) oldMods |= Event.SHIFT_MASK; if ((mods & InputEvent.CTRL_DOWN_MASK) != 0) oldMods |= Event.CTRL_MASK; if ((mods & InputEvent.META_DOWN_MASK) != 0) oldMods |= Event.META_MASK; if ((mods & InputEvent.ALT_DOWN_MASK) != 0) oldMods |= Event.ALT_MASK; if (e instanceof MouseEvent) { if (id == MouseEvent.MOUSE_PRESSED) oldID = Event.MOUSE_DOWN; else if (id == MouseEvent.MOUSE_RELEASED) oldID = Event.MOUSE_UP; else if (id == MouseEvent.MOUSE_MOVED) oldID = Event.MOUSE_MOVE; else if (id == MouseEvent.MOUSE_DRAGGED) oldID = Event.MOUSE_DRAG; else if (id == MouseEvent.MOUSE_ENTERED) oldID = Event.MOUSE_ENTER; else if (id == MouseEvent.MOUSE_EXITED) oldID = Event.MOUSE_EXIT; else // No analogous AWT 1.0 mouse event. return null; MouseEvent me = (MouseEvent) e; translated = new Event (target, when, oldID, me.getX (), me.getY (), 0, oldMods); } else if (e instanceof KeyEvent) { if (id == KeyEvent.KEY_PRESSED) oldID = Event.KEY_PRESS; else if (e.getID () == KeyEvent.KEY_RELEASED) oldID = Event.KEY_RELEASE; else // No analogous AWT 1.0 key event. return null; int oldKey = 0; int newKey = ((KeyEvent) e).getKeyCode (); switch (newKey) { case KeyEvent.VK_BACK_SPACE: oldKey = Event.BACK_SPACE; break; case KeyEvent.VK_CAPS_LOCK: oldKey = Event.CAPS_LOCK; break; case KeyEvent.VK_DELETE: oldKey = Event.DELETE; break; case KeyEvent.VK_DOWN: case KeyEvent.VK_KP_DOWN: oldKey = Event.DOWN; break; case KeyEvent.VK_END: oldKey = Event.END; break; case KeyEvent.VK_ENTER: oldKey = Event.ENTER; break; case KeyEvent.VK_ESCAPE: oldKey = Event.ESCAPE; break; case KeyEvent.VK_F1: oldKey = Event.F1; break; case KeyEvent.VK_F10: oldKey = Event.F10; break; case KeyEvent.VK_F11: oldKey = Event.F11; break; case KeyEvent.VK_F12: oldKey = Event.F12; break; case KeyEvent.VK_F2: oldKey = Event.F2; break; case KeyEvent.VK_F3: oldKey = Event.F3; break; case KeyEvent.VK_F4: oldKey = Event.F4; break; case KeyEvent.VK_F5: oldKey = Event.F5; break; case KeyEvent.VK_F6: oldKey = Event.F6; break; case KeyEvent.VK_F7: oldKey = Event.F7; break; case KeyEvent.VK_F8: oldKey = Event.F8; break; case KeyEvent.VK_F9: oldKey = Event.F9; break; case KeyEvent.VK_HOME: oldKey = Event.HOME; break; case KeyEvent.VK_INSERT: oldKey = Event.INSERT; break; case KeyEvent.VK_LEFT: case KeyEvent.VK_KP_LEFT: oldKey = Event.LEFT; break; case KeyEvent.VK_NUM_LOCK: oldKey = Event.NUM_LOCK; break; case KeyEvent.VK_PAUSE: oldKey = Event.PAUSE; break; case KeyEvent.VK_PAGE_DOWN: oldKey = Event.PGDN; break; case KeyEvent.VK_PAGE_UP: oldKey = Event.PGUP; break; case KeyEvent.VK_PRINTSCREEN: oldKey = Event.PRINT_SCREEN; break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_KP_RIGHT: oldKey = Event.RIGHT; break; case KeyEvent.VK_SCROLL_LOCK: oldKey = Event.SCROLL_LOCK; break; case KeyEvent.VK_TAB: oldKey = Event.TAB; break; case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: oldKey = Event.UP; break; default: oldKey = (int) ((KeyEvent) e).getKeyChar(); } translated = new Event (target, when, oldID, 0, 0, oldKey, oldMods); } } else if (e instanceof AdjustmentEvent) { AdjustmentEvent ae = (AdjustmentEvent) e; int type = ae.getAdjustmentType(); int oldType; if (type == AdjustmentEvent.BLOCK_DECREMENT) oldType = Event.SCROLL_PAGE_UP; else if (type == AdjustmentEvent.BLOCK_INCREMENT) oldType = Event.SCROLL_PAGE_DOWN; else if (type == AdjustmentEvent.TRACK) oldType = Event.SCROLL_ABSOLUTE; else if (type == AdjustmentEvent.UNIT_DECREMENT) oldType = Event.SCROLL_LINE_UP; else if (type == AdjustmentEvent.UNIT_INCREMENT) oldType = Event.SCROLL_LINE_DOWN; else oldType = type; translated = new Event(target, oldType, new Integer(ae.getValue())); } else if (e instanceof ActionEvent) translated = new Event (target, Event.ACTION_EVENT, ((ActionEvent) e).getActionCommand ()); return translated; }
15,402
Stylesheet(TransformerFactoryImpl factory, Stylesheet parent, Document doc, String systemId, int precedence) throws TransformerConfigurationException { this.factory = factory; this.systemId = systemId; this.precedence = precedence; this.parent = parent; extensionElementPrefixes = new HashSet(); excludeResultPrefixes = new HashSet(); stripSpace = new LinkedHashSet(); preserveSpace = new LinkedHashSet(); outputCdataSectionElements = new LinkedHashSet(); xpath = (XPathImpl) factory.xpathFactory.newXPath(); if (parent == null) { bindings = new Bindings(this); attributeSets = new LinkedList(); variables = new LinkedList(); namespaceAliases = new LinkedHashMap(); templates = new LinkedList(); keys = new LinkedList(); decimalFormats = new LinkedHashMap(); initDefaultDecimalFormat(); xpath.setNamespaceContext(this); xpath.setXPathFunctionResolver(this); } else { /* Test for import circularity */ for (Stylesheet ctx = this; ctx.parent != null; ctx = ctx.parent) { if (systemId != null && systemId.equals(ctx.parent.systemId)) { String msg = "circularity importing " + systemId; throw new TransformerConfigurationException(msg); } } /* OK */ Stylesheet root = getRootStylesheet(); bindings = root.bindings; attributeSets = root.attributeSets; variables = root.variables; namespaceAliases = root.namespaceAliases; templates = root.templates; keys = root.keys; decimalFormats = root.decimalFormats; xpath.setNamespaceContext(root); xpath.setXPathFunctionResolver(root); } xpath.setXPathVariableResolver(bindings); Test anyNode = new NodeTypeTest((short) 0); List tests = Collections.singletonList(anyNode); builtInNodeTemplate = new ApplyTemplatesNode(null, null, new Selector(Selector.CHILD, tests), null, null, null, true); builtInTextTemplate = new ValueOfNode(null, null, new Selector(Selector.SELF, tests), false); parse(doc.getDocumentElement(), true); current = doc; // Alow namespace resolution during processing debug = ("yes".equals(System.getProperty("xsl.debug"))); if (debug) { System.err.println("Stylesheet: " + doc.getDocumentURI()); for (Iterator i = templates.iterator(); i.hasNext(); ) { Template t = (Template) i.next(); t.list(System.err); System.err.println("--------------------"); } } }
Stylesheet(TransformerFactoryImpl factory, Stylesheet parent, Document doc, String systemId, int precedence) throws TransformerConfigurationException { this.factory = factory; this.systemId = systemId; this.precedence = precedence; this.parent = parent; extensionElementPrefixes = new HashSet(); excludeResultPrefixes = new HashSet(); stripSpace = new LinkedHashSet(); preserveSpace = new LinkedHashSet(); outputCdataSectionElements = new LinkedHashSet(); xpath = (XPathImpl) factory.xpathFactory.newXPath(); if (parent == null) { bindings = new Bindings(this); attributeSets = new LinkedList(); variables = new LinkedList(); namespaceAliases = new LinkedHashMap(); templates = new LinkedList(); keys = new LinkedList(); decimalFormats = new LinkedHashMap(); initDefaultDecimalFormat(); xpath.setNamespaceContext(this); xpath.setXPathFunctionResolver(this); } else { /* Test for import circularity */ for (Stylesheet ctx = this; ctx.parent != null; ctx = ctx.parent) { if (systemId != null && systemId.equals(ctx.parent.systemId)) { String msg = "circularity importing " + systemId; throw new TransformerConfigurationException(msg); } } /* OK */ Stylesheet root = getRootStylesheet(); bindings = root.bindings; attributeSets = root.attributeSets; variables = root.variables; namespaceAliases = root.namespaceAliases; templates = root.templates; keys = root.keys; decimalFormats = root.decimalFormats; xpath.setNamespaceContext(root); xpath.setXPathFunctionResolver(root); } xpath.setXPathVariableResolver(bindings); Test anyNode = new NodeTypeTest((short) 0); List tests = Collections.singletonList(anyNode); builtInNodeTemplate = new ApplyTemplatesNode(null, null, new Selector(Selector.CHILD, tests), null, null, null, true); builtInTextTemplate = new ValueOfNode(null, null, new Selector(Selector.SELF, tests), false); parse(doc.getDocumentElement(), true); current = doc; // Alow namespace resolution during processing debug = ("yes".equals(System.getProperty("xsl.debug"))); if (debug) { System.err.println("Stylesheet: " + doc.getDocumentURI()); for (Iterator i = templates.iterator(); i.hasNext(); ) { Template t = (Template) i.next(); t.list(System.err); System.err.println("--------------------"); } } }
15,403
Stylesheet(TransformerFactoryImpl factory, Stylesheet parent, Document doc, String systemId, int precedence) throws TransformerConfigurationException { this.factory = factory; this.systemId = systemId; this.precedence = precedence; this.parent = parent; extensionElementPrefixes = new HashSet(); excludeResultPrefixes = new HashSet(); stripSpace = new LinkedHashSet(); preserveSpace = new LinkedHashSet(); outputCdataSectionElements = new LinkedHashSet(); xpath = (XPathImpl) factory.xpathFactory.newXPath(); if (parent == null) { bindings = new Bindings(this); attributeSets = new LinkedList(); variables = new LinkedList(); namespaceAliases = new LinkedHashMap(); templates = new LinkedList(); keys = new LinkedList(); decimalFormats = new LinkedHashMap(); initDefaultDecimalFormat(); xpath.setNamespaceContext(this); xpath.setXPathFunctionResolver(this); } else { /* Test for import circularity */ for (Stylesheet ctx = this; ctx.parent != null; ctx = ctx.parent) { if (systemId != null && systemId.equals(ctx.parent.systemId)) { String msg = "circularity importing " + systemId; throw new TransformerConfigurationException(msg); } } /* OK */ Stylesheet root = getRootStylesheet(); bindings = root.bindings; attributeSets = root.attributeSets; variables = root.variables; namespaceAliases = root.namespaceAliases; templates = root.templates; keys = root.keys; decimalFormats = root.decimalFormats; xpath.setNamespaceContext(root); xpath.setXPathFunctionResolver(root); } xpath.setXPathVariableResolver(bindings); Test anyNode = new NodeTypeTest((short) 0); List tests = Collections.singletonList(anyNode); builtInNodeTemplate = new ApplyTemplatesNode(null, null, new Selector(Selector.CHILD, tests), null, null, null, true); builtInTextTemplate = new ValueOfNode(null, null, new Selector(Selector.SELF, tests), false); parse(doc.getDocumentElement(), true); current = doc; // Alow namespace resolution during processing debug = ("yes".equals(System.getProperty("xsl.debug"))); if (debug) { System.err.println("Stylesheet: " + doc.getDocumentURI()); for (Iterator i = templates.iterator(); i.hasNext(); ) { Template t = (Template) i.next(); t.list(System.err); System.err.println("--------------------"); } } }
Stylesheet(TransformerFactoryImpl factory, Stylesheet parent, Document doc, String systemId, int precedence) throws TransformerConfigurationException { this.factory = factory; this.systemId = systemId; this.precedence = precedence; this.parent = parent; extensionElementPrefixes = new HashSet(); excludeResultPrefixes = new HashSet(); stripSpace = new LinkedHashSet(); preserveSpace = new LinkedHashSet(); outputCdataSectionElements = new LinkedHashSet(); xpath = (XPathImpl) factory.xpathFactory.newXPath(); if (parent == null) { bindings = new Bindings(this); attributeSets = new LinkedList(); variables = new LinkedList(); namespaceAliases = new LinkedHashMap(); templates = new LinkedList(); keys = new LinkedList(); decimalFormats = new LinkedHashMap(); initDefaultDecimalFormat(); xpath.setNamespaceContext(this); xpath.setXPathFunctionResolver(this); } else { /* Test for import circularity */ for (Stylesheet ctx = this; ctx.parent != null; ctx = ctx.parent) { if (systemId != null && systemId.equals(ctx.parent.systemId)) { String msg = "circularity importing " + systemId; throw new TransformerConfigurationException(msg); } } /* OK */ Stylesheet root = getRootStylesheet(); bindings = root.bindings; attributeSets = root.attributeSets; variables = root.variables; namespaceAliases = root.namespaceAliases; templates = root.templates; keys = root.keys; decimalFormats = root.decimalFormats; xpath.setNamespaceContext(root); xpath.setXPathFunctionResolver(root); } xpath.setXPathVariableResolver(bindings); Test anyNode = new NodeTypeTest((short) 0); List tests = Collections.singletonList(anyNode); builtInNodeTemplate = new ApplyTemplatesNode(null, null, new Selector(Selector.CHILD, tests), null, null, null, true); builtInTextTemplate = new ValueOfNode(null, null, new Selector(Selector.SELF, tests), false); parse(doc.getDocumentElement(), true); current = doc; // Alow namespace resolution during processing debug = ("yes".equals(System.getProperty("xsl.debug"))); if (debug) { System.err.println("Stylesheet: " + doc.getDocumentURI()); for (Iterator i = templates.iterator(); i.hasNext(); ) { Template t = (Template) i.next(); t.list(System.err); System.err.println("--------------------"); } } }
15,404
void parse(Node node, boolean root) throws TransformerConfigurationException { if (node == null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
void parse(Node node, boolean root) throws TransformerConfigurationException { while (node != null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
15,408
void parse(Node node, boolean root) throws TransformerConfigurationException { if (node == null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
void parse(Node node, boolean root) throws TransformerConfigurationException { if (node == null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
15,409
void parse(Node node, boolean root) throws TransformerConfigurationException { if (node == null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
void parse(Node node, boolean root) throws TransformerConfigurationException { if (node == null) { return; } current = node; try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); NamedNodeMap attrs = node.getAttributes(); if ("stylesheet".equals(name)) { version = getAttribute(attrs, "version"); String eep = getAttribute(attrs, "extension-element-prefixes"); if (eep != null) { StringTokenizer st = new StringTokenizer(eep); while (st.hasMoreTokens()) { extensionElementPrefixes.add(st.nextToken()); } } String erp = getAttribute(attrs, "exclude-result-prefixes"); if (erp != null) { StringTokenizer st = new StringTokenizer(erp); while (st.hasMoreTokens()) { excludeResultPrefixes.add(st.nextToken()); } } parse(node.getFirstChild(), false); return; } else if ("template".equals(name)) { templates.addFirst(parseTemplate(node, attrs)); } else if ("param".equals(name) || "variable".equals(name)) { boolean global = "variable".equals(name); TemplateNode content = parse(node.getFirstChild()); String paramName = getRequiredAttribute(attrs, "name", node); String select = getAttribute(attrs, "select"); if (select != null && select.length() > 0) { if (content != null) { String msg = "parameter '" + paramName + "' has both select and content"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } Expr expr = (Expr) xpath.compile(select); variables.add(new ParameterNode(null, null, paramName, expr, global)); } else { variables.add(new ParameterNode(content, null, paramName, null, global)); } bindings.set(paramName, content, global); } else if ("include".equals(name) || "import".equals(name)) { int delta = "import".equals(name) ? -1 : 0; String href = getRequiredAttribute(attrs, "href", node); Source source; synchronized (factory.resolver) { if (transformer != null) { factory.resolver .setUserResolver(transformer.getURIResolver()); factory.resolver .setUserListener(transformer.getErrorListener()); } source = factory.resolver.resolve(systemId, href); } factory.newStylesheet(source, precedence + delta, this); } else if ("output".equals(name)) { parseOutput(node, attrs); } else if ("preserve-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { preserveSpace.add(parseNameTest(st.nextToken())); } } else if ("strip-space".equals(name)) { String elements = getRequiredAttribute(attrs, "elements", node); StringTokenizer st = new StringTokenizer(elements, " \t\n\r"); while (st.hasMoreTokens()) { stripSpace.add(parseNameTest(st.nextToken())); } } else if ("key".equals(name)) { parseKey(node, attrs); } else if ("decimal-format".equals(name)) { parseDecimalFormat(node, attrs); } else if ("namespace-alias".equals(name)) { parseNamespaceAlias(node, attrs); } else if ("attribute-set".equals(name)) { parseAttributeSet(node, attrs); } parse(node.getNextSibling(), false); } else if (root) { // Literal document element Attr versionNode = ((Element)node).getAttributeNodeNS(XSL_NS, "version"); if (versionNode == null) { String msg = "no xsl:version attribute on literal result node"; DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(msg, l); } version = versionNode.getValue(); Node rootClone = node.cloneNode(true); NamedNodeMap attrs = rootClone.getAttributes(); attrs.removeNamedItemNS(XSL_NS, "version"); templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, Template.DEFAULT_PRIORITY, null)); } else { // Skip unknown elements, text, comments, etc parse(node.getNextSibling(), false); } } catch (TransformerException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (DOMException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } catch (XPathExpressionException e) { DOMSourceLocator l = new DOMSourceLocator(node); throw new TransformerConfigurationException(e.getMessage(), l, e); } }
15,410
final TemplateNode parseApplyTemplates(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String m = getAttribute(attrs, "mode"); QName mode = (m == null) ? null : getQName(m); String s = getAttribute(attrs, "select"); if (s == null) { s = "child::node()"; } List sortKeys = parseSortKeys(children); List withParams = parseWithParams(children); Expr select = (Expr) xpath.compile(s); return new ApplyTemplatesNode(null, parse(next), select, mode, sortKeys, withParams, false); }
final TemplateNode parseApplyTemplates(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String m = getAttribute(attrs, "mode"); QName mode = (m == null) ? null : getQName(m); String s = getAttribute(attrs, "select"); if (s == null) { s = "child::node()"; } List sortKeys = parseSortKeys(children); List withParams = parseWithParams(children); Expr select = (Expr) xpath.compile(s); return new ApplyTemplatesNode(null, parse(next), select, mode, sortKeys, withParams, false); }
15,411
final TemplateNode parseApplyTemplates(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String m = getAttribute(attrs, "mode"); QName mode = (m == null) ? null : getQName(m); String s = getAttribute(attrs, "select"); if (s == null) { s = "child::node()"; } List sortKeys = parseSortKeys(children); List withParams = parseWithParams(children); Expr select = (Expr) xpath.compile(s); return new ApplyTemplatesNode(null, parse(next), select, mode, sortKeys, withParams, false); }
final TemplateNode parseApplyTemplates(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String m = getAttribute(attrs, "mode"); QName mode = (m == null) ? null : getQName(m); String s = getAttribute(attrs, "select"); if (s == null) { s = "child::node()"; } List sortKeys = parseSortKeys(children); List withParams = parseWithParams(children); Expr select = (Expr) xpath.compile(s); return new ApplyTemplatesNode(null, parse(next), select, mode, sortKeys, withParams, false); }
15,412
final TemplateNode parseAttribute(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new AttributeNode(parse(children), parse(next), n, ns, node); }
final TemplateNode parseAttribute(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new AttributeNode(parse(children), parse(next), n, ns, node); }
15,413
final TemplateNode parseAttribute(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new AttributeNode(parse(children), parse(next), n, ns, node); }
final TemplateNode parseAttribute(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); Node children = node.getFirstChild(); AttributeNode ret = new AttributeNode(n, ns, node); ret.children = parse(children); return ret; }
15,414
final TemplateNode parseAttributeValueTemplate(String value, Node source) throws TransformerConfigurationException, XPathExpressionException { current = source; // Tokenize int len = value.length(); int off = 0; List tokens = new ArrayList(); // text tokens List types = new ArrayList(); // literal or expression int depth = 0; for (int i = 0; i < len; i++) { char c = value.charAt(i); if (c == '{') { if (i < (len - 1) && value.charAt(i + 1) == '{') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 0) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.FALSE); } off = i + 1; } depth++; } else if (c == '}') { if (i < (len - 1) && value.charAt(i + 1) == '}') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 1) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.TRUE); } else { String msg = "attribute value template " + "must contain expression: " + value; DOMSourceLocator l = new DOMSourceLocator(source); throw new TransformerConfigurationException(msg, l); } off = i + 1; } depth--; } } if (depth > 0) { String msg = "invalid attribute value template: " + value; throw new TransformerConfigurationException(msg); } if (len - off > 0) { // Trailing text tokens.add(value.substring(off)); types.add(Boolean.FALSE); } // Construct template node tree TemplateNode ret = null; Document doc = source.getOwnerDocument(); len = tokens.size(); for (int i = len - 1; i >= 0; i--) { String token = (String) tokens.get(i); Boolean type = (Boolean) types.get(i); if (type == Boolean.TRUE) { // Expression text Expr select = (Expr) xpath.compile(token); ret = new ValueOfNode(null, ret, select, false); } else { // Verbatim text ret = new LiteralNode(null, ret, doc.createTextNode(token)); } } return ret; }
final TemplateNode parseAttributeValueTemplate(String value, Node source) throws TransformerConfigurationException, XPathExpressionException { current = source; // Tokenize int len = value.length(); int off = 0; List tokens = new ArrayList(); // text tokens List types = new ArrayList(); // literal or expression int depth = 0; for (int i = 0; i < len; i++) { char c = value.charAt(i); if (c == '{') { if (i < (len - 1) && value.charAt(i + 1) == '{') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 0) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.FALSE); } off = i + 1; } depth++; } else if (c == '}') { if (i < (len - 1) && value.charAt(i + 1) == '}') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 1) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.TRUE); } else { String msg = "attribute value template " + "must contain expression: " + value; DOMSourceLocator l = new DOMSourceLocator(source); throw new TransformerConfigurationException(msg, l); } off = i + 1; } depth--; } } if (depth > 0) { String msg = "invalid attribute value template: " + value; throw new TransformerConfigurationException(msg); } if (len - off > 0) { // Trailing text tokens.add(value.substring(off)); types.add(Boolean.FALSE); } // Construct template node tree TemplateNode ret = null; Document doc = source.getOwnerDocument(); len = tokens.size(); for (int i = len - 1; i >= 0; i--) { String token = (String) tokens.get(i); Boolean type = (Boolean) types.get(i); if (type == Boolean.TRUE) { // Expression text Expr select = (Expr) xpath.compile(token); TemplateNode ret2 = new ValueOfNode(select, false); ret2.next = ret; ret = ret2; } else { // Verbatim text ret = new LiteralNode(null, ret, doc.createTextNode(token)); } } return ret; }
15,415
final TemplateNode parseAttributeValueTemplate(String value, Node source) throws TransformerConfigurationException, XPathExpressionException { current = source; // Tokenize int len = value.length(); int off = 0; List tokens = new ArrayList(); // text tokens List types = new ArrayList(); // literal or expression int depth = 0; for (int i = 0; i < len; i++) { char c = value.charAt(i); if (c == '{') { if (i < (len - 1) && value.charAt(i + 1) == '{') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 0) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.FALSE); } off = i + 1; } depth++; } else if (c == '}') { if (i < (len - 1) && value.charAt(i + 1) == '}') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 1) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.TRUE); } else { String msg = "attribute value template " + "must contain expression: " + value; DOMSourceLocator l = new DOMSourceLocator(source); throw new TransformerConfigurationException(msg, l); } off = i + 1; } depth--; } } if (depth > 0) { String msg = "invalid attribute value template: " + value; throw new TransformerConfigurationException(msg); } if (len - off > 0) { // Trailing text tokens.add(value.substring(off)); types.add(Boolean.FALSE); } // Construct template node tree TemplateNode ret = null; Document doc = source.getOwnerDocument(); len = tokens.size(); for (int i = len - 1; i >= 0; i--) { String token = (String) tokens.get(i); Boolean type = (Boolean) types.get(i); if (type == Boolean.TRUE) { // Expression text Expr select = (Expr) xpath.compile(token); ret = new ValueOfNode(null, ret, select, false); } else { // Verbatim text ret = new LiteralNode(null, ret, doc.createTextNode(token)); } } return ret; }
final TemplateNode parseAttributeValueTemplate(String value, Node source) throws TransformerConfigurationException, XPathExpressionException { current = source; // Tokenize int len = value.length(); int off = 0; List tokens = new ArrayList(); // text tokens List types = new ArrayList(); // literal or expression int depth = 0; for (int i = 0; i < len; i++) { char c = value.charAt(i); if (c == '{') { if (i < (len - 1) && value.charAt(i + 1) == '{') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 0) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.FALSE); } off = i + 1; } depth++; } else if (c == '}') { if (i < (len - 1) && value.charAt(i + 1) == '}') { tokens.add(value.substring(off, i + 1)); types.add(Boolean.FALSE); i++; off = i + 1; continue; } if (depth == 1) { if (i - off > 0) { tokens.add(value.substring(off, i)); types.add(Boolean.TRUE); } else { String msg = "attribute value template " + "must contain expression: " + value; DOMSourceLocator l = new DOMSourceLocator(source); throw new TransformerConfigurationException(msg, l); } off = i + 1; } depth--; } } if (depth > 0) { String msg = "invalid attribute value template: " + value; throw new TransformerConfigurationException(msg); } if (len - off > 0) { // Trailing text tokens.add(value.substring(off)); types.add(Boolean.FALSE); } // Construct template node tree TemplateNode ret = null; Document doc = source.getOwnerDocument(); len = tokens.size(); for (int i = len - 1; i >= 0; i--) { String token = (String) tokens.get(i); Boolean type = (Boolean) types.get(i); if (type == Boolean.TRUE) { // Expression text Expr select = (Expr) xpath.compile(token); ret = new ValueOfNode(null, ret, select, false); } else { // Verbatim text TemplateNode ret2 = new LiteralNode(doc.createTextNode(token)); ret2.next = ret; ret = ret2; } } return ret; }
15,416
final TemplateNode parseCallTemplate(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String n = getRequiredAttribute(attrs, "name", node); QName name = getQName(n); List withParams = parseWithParams(children); return new CallTemplateNode(null, parse(next), name, withParams); }
final TemplateNode parseCallTemplate(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String n = getRequiredAttribute(attrs, "name", node); QName name = getQName(n); List withParams = parseWithParams(children); return new CallTemplateNode(null, parse(next), name, withParams); }
15,417
final TemplateNode parseCallTemplate(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String n = getRequiredAttribute(attrs, "name", node); QName name = getQName(n); List withParams = parseWithParams(children); return new CallTemplateNode(null, parse(next), name, withParams); }
final TemplateNode parseCallTemplate(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String n = getRequiredAttribute(attrs, "name", node); QName name = getQName(n); List withParams = parseWithParams(children); return new CallTemplateNode(null, parse(next), name, withParams); }
15,418
final TemplateNode parseCopy(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String uas = getAttribute(attrs, "use-attribute-sets"); return new CopyNode(parse(children), parse(next), uas); }
final TemplateNode parseCopy(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String uas = getAttribute(attrs, "use-attribute-sets"); return new CopyNode(parse(children), parse(next), uas); }
15,419
final TemplateNode parseCopy(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String uas = getAttribute(attrs, "use-attribute-sets"); return new CopyNode(parse(children), parse(next), uas); }
final TemplateNode parseCopy(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String uas = getAttribute(attrs, "use-attribute-sets"); Node children = node.getFirstChild(); CopyNode ret = new CopyNode(uas); ret.children = parse(children); return ret; }
15,420
final TemplateNode parseCopyOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); Expr select = (Expr) xpath.compile(s); return new CopyOfNode(parse(children), parse(next), select); }
final TemplateNode parseCopyOf(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); Expr select = (Expr) xpath.compile(s); return new CopyOfNode(parse(children), parse(next), select); }
15,421
final TemplateNode parseCopyOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); Expr select = (Expr) xpath.compile(s); return new CopyOfNode(parse(children), parse(next), select); }
final TemplateNode parseCopyOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); Expr select = (Expr) xpath.compile(s); Node children = node.getFirstChild(); CopyOfNode ret = new CopyOfNode(select); ret.children = parse(children); return ret; }
15,422
final TemplateNode parseElement(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); String uas = getAttribute(attrs, "use-attribute-sets"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new ElementNode(parse(children), parse(next), n, ns, uas, node); }
final TemplateNode parseElement(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); String uas = getAttribute(attrs, "use-attribute-sets"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new ElementNode(parse(children), parse(next), n, ns, uas, node); }
15,423
final TemplateNode parseElement(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); String uas = getAttribute(attrs, "use-attribute-sets"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); return new ElementNode(parse(children), parse(next), n, ns, uas, node); }
final TemplateNode parseElement(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); String namespace = getAttribute(attrs, "namespace"); String uas = getAttribute(attrs, "use-attribute-sets"); TemplateNode n = parseAttributeValueTemplate(name, node); TemplateNode ns = (namespace == null) ? null : parseAttributeValueTemplate(namespace, node); Node children = node.getFirstChild(); ElementNode ret = new ElementNode(n, ns, uas, node); ret.children = parse(children); return ret; }
15,424
final TemplateNode parseForEach(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); List sortKeys = parseSortKeys(children); Expr select = (Expr) xpath.compile(s); return new ForEachNode(parse(children), parse(next), select, sortKeys); }
final TemplateNode parseForEach(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); List sortKeys = parseSortKeys(children); Expr select = (Expr) xpath.compile(s); return new ForEachNode(parse(children), parse(next), select, sortKeys); }
15,425
final TemplateNode parseForEach(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); List sortKeys = parseSortKeys(children); Expr select = (Expr) xpath.compile(s); return new ForEachNode(parse(children), parse(next), select, sortKeys); }
final TemplateNode parseForEach(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); List sortKeys = parseSortKeys(children); Expr select = (Expr) xpath.compile(s); ForEachNode ret = new ForEachNode(select, sortKeys); ret.children = parse(children); return ret; }
15,426
final TemplateNode parseIf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new IfNode(parse(children), parse(next), test); }
final TemplateNode parseIf(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new IfNode(parse(children), parse(next), test); }
15,427
final TemplateNode parseIf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new IfNode(parse(children), parse(next), test); }
final TemplateNode parseIf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); Node children = node.getFirstChild(); IfNode ret = new IfNode(test); ret.children = parse(children); return ret; }
15,428
final TemplateNode parseMessage(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getAttribute(attrs, "terminate"); boolean terminate = "yes".equals(t); return new MessageNode(parse(children), parse(next), terminate); }
final TemplateNode parseMessage(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getAttribute(attrs, "terminate"); boolean terminate = "yes".equals(t); return new MessageNode(parse(children), parse(next), terminate); }
15,429
final TemplateNode parseMessage(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getAttribute(attrs, "terminate"); boolean terminate = "yes".equals(t); return new MessageNode(parse(children), parse(next), terminate); }
final TemplateNode parseMessage(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getAttribute(attrs, "terminate"); boolean terminate = "yes".equals(t); Node children = node.getFirstChild(); MessageNode ret = new MessageNode(terminate); ret.children = parse(children); return ret; }
15,430
final TemplateNode parseNumber(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
final TemplateNode parseNumber(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
15,431
final TemplateNode parseNumber(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
final TemplateNode parseNumber(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
15,432
final TemplateNode parseNumber(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
final TemplateNode parseNumber(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String v = getAttribute(attrs, "value"); String ff = getAttribute(attrs, "format"); if (ff == null) { ff = "1"; } TemplateNode format = parseAttributeValueTemplate(ff, node); String lang = getAttribute(attrs, "lang"); String lv = getAttribute(attrs, "letter-value"); int letterValue = "traditional".equals(lv) ? AbstractNumberNode.TRADITIONAL : AbstractNumberNode.ALPHABETIC; String gs = getAttribute(attrs, "grouping-separator"); String gz = getAttribute(attrs, "grouping-size"); int gz2 = (gz != null && gz.length() > 0) ? Integer.parseInt(gz) : 1; if (v != null && v.length() > 0) { Expr value = (Expr) xpath.compile(v); return new NumberNode(parse(children), parse(next), value, format, lang, letterValue, gs, gz2); } else { String l = getAttribute(attrs, "level"); int level = "multiple".equals(l) ? NodeNumberNode.MULTIPLE : "any".equals(l) ? NodeNumberNode.ANY : NodeNumberNode.SINGLE; String c = getAttribute(attrs, "count"); String f = getAttribute(attrs, "from"); Pattern count = null; Pattern from = null; if (c != null) { try { count = (Pattern) xpath.compile(c); } catch (ClassCastException e) { String msg = "invalid pattern: " + c; throw new TransformerConfigurationException(msg); } } if (f != null) { try { from = (Pattern) xpath.compile(f); } catch (ClassCastException e) { String msg = "invalid pattern: " + f; throw new TransformerConfigurationException(msg); } } return new NodeNumberNode(parse(children), parse(next), level, count, from, format, lang, letterValue, gs, gz2); } }
15,433
final TemplateNode parseProcessingInstruction(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); return new ProcessingInstructionNode(parse(children), parse(next), name); }
final TemplateNode parseProcessingInstruction(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); return new ProcessingInstructionNode(parse(children), parse(next), name); }
15,436
final TemplateNode parseProcessingInstruction(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); return new ProcessingInstructionNode(parse(children), parse(next), name); }
final TemplateNode parseProcessingInstruction(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String name = getRequiredAttribute(attrs, "name", node); return new ProcessingInstructionNode(parse(children), parse(next), name); }
15,437
final Template parseTemplate(Node node, NamedNodeMap attrs) throws TransformerConfigurationException, XPathExpressionException { String n = getAttribute(attrs, "name"); QName name = (n == null) ? null : getQName(n); String m = getAttribute(attrs, "match"); Pattern match = null; if (m != null) { try { match = (Pattern) xpath.compile(m); } catch (ClassCastException e) { String msg = "illegal pattern: " + m; throw new TransformerConfigurationException(msg); } } String p = getAttribute(attrs, "priority"); String mm = getAttribute(attrs, "mode"); QName mode = (mm == null) ? null : getQName(mm); double priority = (p == null) ? Template.DEFAULT_PRIORITY : Double.parseDouble(p); return new Template(this, name, match, parse(node.getFirstChild()), precedence, priority, mode); }
final Template parseTemplate(Node node, NamedNodeMap attrs) throws TransformerConfigurationException, XPathExpressionException { String n = getAttribute(attrs, "name"); QName name = (n == null) ? null : getQName(n); String m = getAttribute(attrs, "match"); Pattern match = null; if (m != null) { try { match = (Pattern) xpath.compile(m); } catch (ClassCastException e) { String msg = "illegal pattern: " + m; throw new TransformerConfigurationException(msg); } } String p = getAttribute(attrs, "priority"); String mm = getAttribute(attrs, "mode"); QName mode = (mm == null) ? null : getQName(mm); double priority = (p == null) ? Template.DEFAULT_PRIORITY : Double.parseDouble(p); Node children = node.getFirstChild(); return new Template(this, name, match, parse(children), precedence, priority, mode); }
15,438
final TemplateNode parseText(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); return new TextNode(parse(children), parse(next), d); }
final TemplateNode parseText(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); return new TextNode(parse(children), parse(next), d); }
15,439
final TemplateNode parseText(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); return new TextNode(parse(children), parse(next), d); }
final TemplateNode parseText(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); Node children = node.getFirstChild(); TextNode ret = new TextNode(d); ret.children = parse(children); return ret; }
15,440
final TemplateNode parseValueOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); Expr select = (Expr) xpath.compile(s); return new ValueOfNode(null, parse(next), select, d); }
final TemplateNode parseValueOf(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); Expr select = (Expr) xpath.compile(s); return new ValueOfNode(null, parse(next), select, d); }
15,441
final TemplateNode parseValueOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); Expr select = (Expr) xpath.compile(s); return new ValueOfNode(null, parse(next), select, d); }
final TemplateNode parseValueOf(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String s = getRequiredAttribute(attrs, "select", node); String doe = getAttribute(attrs, "disable-output-escaping"); boolean d = "yes".equals(doe); Expr select = (Expr) xpath.compile(s); return new ValueOfNode(select, d); }
15,442
final TemplateNode parseWhen(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new WhenNode(parse(children), parse(next), test); }
final TemplateNode parseWhen(Node node) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new WhenNode(parse(children), parse(next), test); }
15,443
final TemplateNode parseWhen(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); return new WhenNode(parse(children), parse(next), test); }
final TemplateNode parseWhen(Node node, Node children, Node next) throws TransformerConfigurationException, XPathExpressionException { NamedNodeMap attrs = node.getAttributes(); String t = getRequiredAttribute(attrs, "test", node); Expr test = (Expr) xpath.compile(t); Node children = node.getFirstChild(); WhenNode ret = new WhenNode(test); ret.children = parse(children); return ret; }
15,444
BasicOptionPaneUI() { }
BasicOptionPaneUI() { }
15,446
public boolean containsCustomComponents(JOptionPane op) { throw new Error ("Not implemented"); }
public boolean containsCustomComponents(JOptionPane op) { return hasCustomComponents; }
15,447
Dimension getMinimumOptionPaneSize() { return new Dimension(300,100); }
Dimension getMinimumOptionPaneSize() { return new Dimension(300,100); }
15,448
public Dimension getPreferredSize(JComponent c) { if (c == null) return getMinimumOptionPaneSize(); if (c != pane) return null; LayoutManager l = c.getLayout(); if (l == null) return getMinimumOptionPaneSize(); Dimension d1 = l.preferredLayoutSize(c); Dimension d2 = getMinimumOptionPaneSize(); d1.width = Math.max(d1.width, d2.width); d1.height = Math.max(d1.height, d2.height); return d2; }
public Dimension getPreferredSize(JComponent c) { if (c == null) return getMinimumOptionPaneSize(); if (c != pane) return null; LayoutManager l = c.getLayout(); if (l == null) return getMinimumOptionPaneSize(); Dimension d1 = l.preferredLayoutSize(c); Dimension d2 = getMinimumOptionPaneSize(); d1.width = Math.max(d1.width, d2.width); d1.height = Math.max(d1.height, d2.height); return d2; }
15,449
public Dimension getPreferredSize(JComponent c) { if (c == null) return getMinimumOptionPaneSize(); if (c != pane) return null; LayoutManager l = c.getLayout(); if (l == null) return getMinimumOptionPaneSize(); Dimension d1 = l.preferredLayoutSize(c); Dimension d2 = getMinimumOptionPaneSize(); d1.width = Math.max(d1.width, d2.width); d1.height = Math.max(d1.height, d2.height); return d2; }
public Dimension getPreferredSize(JComponent c) { if (c == null) return getMinimumOptionPaneSize(); if (c != pane) return null; LayoutManager l = c.getLayout(); if (l == null) return getMinimumOptionPaneSize(); Dimension d1 = l.preferredLayoutSize(c); Dimension d2 = getMinimumOptionPaneSize(); d1.width = Math.max(d1.width, d2.width); d1.height = Math.max(d1.height, d2.height); return d2; }
15,450
public void installUI(JComponent c) { super.installUI(c); pane = (JOptionPane)c; System.out.println(" -------------: " + pane); JLabel message = null; JButton ok_button = new JButton("Ok"); ok_button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent a) { System.out.println("ACTION ---> " + a); // pane.dialog.dispose(); if (pane.dialog.isModal()) { System.out.println("modal dialog !!"); pane.dialog.setModal(false); } pane.dialog.setVisible(false); } }); Object[] options = null; if (options != null) { for (int i=0; i<options.length; i++) { Object o = options[i]; if (o != null) { if (o instanceof String) { String s = (String) o; JLabel m = new JLabel(s); pane.add(m); } else if (o instanceof Component) { Component com = (Component) o; pane.add(com); } else { System.out.println("UNRECOGNIZED ARG: " + o); } } } } pane.add(message); pane.add(ok_button); }
public void installUI(JComponent c) { super.installUI(c); pane = (JOptionPane)c; System.out.println(" -------------: " + pane); JLabel message = null; JButton ok_button = new JButton("Ok"); ok_button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent a) { System.out.println("ACTION ---> " + a); // pane.dialog.dispose(); if (pane.dialog.isModal()) { System.out.println("modal dialog !!"); pane.dialog.setModal(false); } pane.dialog.setVisible(false); } }); Object[] options = null; if (options != null) { for (int i=0; i<options.length; i++) { Object o = options[i]; if (o != null) { if (o instanceof String) { String s = (String) o; JLabel m = new JLabel(s); pane.add(m); } else if (o instanceof Component) { Component com = (Component) o; pane.add(com); } else { System.out.println("UNRECOGNIZED ARG: " + o); } } } } pane.add(message); pane.add(ok_button); }
15,451
public void installUI(JComponent c) { super.installUI(c); pane = (JOptionPane)c; System.out.println(" -------------: " + pane); JLabel message = null; JButton ok_button = new JButton("Ok"); ok_button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent a) { System.out.println("ACTION ---> " + a); // pane.dialog.dispose(); if (pane.dialog.isModal()) { System.out.println("modal dialog !!"); pane.dialog.setModal(false); } pane.dialog.setVisible(false); } }); Object[] options = null; if (options != null) { for (int i=0; i<options.length; i++) { Object o = options[i]; if (o != null) { if (o instanceof String) { String s = (String) o; JLabel m = new JLabel(s); pane.add(m); } else if (o instanceof Component) { Component com = (Component) o; pane.add(com); } else { System.out.println("UNRECOGNIZED ARG: " + o); } } } } pane.add(message); pane.add(ok_button); }
public void installUI(JComponent c) { super.installUI(c); pane = (JOptionPane)c; System.out.println(" -------------: " + pane); JLabel message = null; JButton ok_button = new JButton("Ok"); ok_button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent a) { System.out.println("ACTION ---> " + a); // pane.dialog.dispose(); if (pane.dialog.isModal()) { System.out.println("modal dialog !!"); pane.dialog.setModal(false); } pane.dialog.setVisible(false); } }); Object[] options = null; if (options != null) { for (int i=0; i<options.length; i++) { Object o = options[i]; if (o != null) { if (o instanceof String) { String s = (String) o; JLabel m = new JLabel(s); pane.add(m); } else if (o instanceof Component) { Component com = (Component) o; pane.add(com); } else { System.out.println("UNRECOGNIZED ARG: " + o); } } } } pane.add(message); pane.add(ok_button); }
15,452
public void selectInitialValue(JOptionPane op) { throw new Error ("Not implemented"); }
public void selectInitialValue(JOptionPane op) { if (inputComponent != null) { inputComponent.requestFocus(); return; } if (initialFocusComponent != null) initialFocusComponent.requestFocus(); }
15,453
protected Point getPopupMenuOrigin() { // if menu in the menu bar if (isTopLevelMenu()) return new Point(0, this.getHeight()); // if submenu return new Point(this.getWidth(), 0); }
protected Point getPopupMenuOrigin() { // if menu in the menu bar if (isTopLevelMenu()) { int xOffset = UIManager.getInt("Menu.menuPopupOffsetX"); int yOffset = UIManager.getInt("Menu.menuPopupOffsetY"); if (getComponentOrientation().isLeftToRight()) { point.x = xOffset; if (screenLoc.x + point.x + popupSize.width > screenBounds.width + screenBounds.width && screenBounds.width - size.width < 2 * (screenLoc.x - screenBounds.x)) point.x = size.width - xOffset - popupSize.width; } else { point.x = size.width - xOffset - popupSize.width; if (screenLoc.x + point.x < screenBounds.x && screenBounds.width - size.width > 2 * (screenLoc.x - screenBounds.x)) point.x = xOffset; } point.y = size.height + yOffset; if (screenLoc.y + point.y + popupSize.height >= screenBounds.height && screenBounds.height - size.height < 2 * (screenLoc.y - screenBounds.y)) point.y = - yOffset - popupSize.height; } else { int xOffset = UIManager.getInt("Menu.submenuPopupOffsetX"); int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY"); if (getComponentOrientation().isLeftToRight()) { point.x = size.width + xOffset; if (screenLoc.x + point.x + popupSize.width >= screenBounds.x + screenBounds.width && screenBounds.width - size.width < 2 * (screenLoc.x - screenBounds.x)) point.x = - xOffset - popupSize.width; } else { point.x = - xOffset - popupSize.width; if (screenLoc.x + point.x < screenBounds.x && screenBounds.width - size.width > 2 * (screenLoc.x - screenBounds.x)) point.x = size.width + xOffset; } point.y = yOffset; if (screenLoc.y + point.y + popupSize.height >= screenBounds.y + screenBounds.height && screenBounds.height - size.height < 2 * (screenLoc.y - screenBounds.y)) { point.y = screenLoc.y - screenBounds.y + size.height - yOffset - popupSize.height; } } // if submenu return new Point(this.getWidth(), 0); }
15,456
protected Point getPopupMenuOrigin() { // if menu in the menu bar if (isTopLevelMenu()) return new Point(0, this.getHeight()); // if submenu return new Point(this.getWidth(), 0); }
protected Point getPopupMenuOrigin() { // if menu in the menu bar if (isTopLevelMenu()) return new Point(0, this.getHeight()); // if submenu return point; }
15,457
public void setPopupMenuVisible(boolean popup) { if (getModel().isEnabled()) popupMenu.setVisible(popup); }
public void setPopupMenuVisible(boolean popup) { if (getModel().isEnabled()) popupMenu.setVisible(popup); }
15,458
private void setSelectedHelper(boolean selected, boolean menuEnabled, boolean showMenu) { // If menu is selected and enabled, activates the menu and // displays associated popup. if (selected && menuEnabled) { super.setArmed(true); super.setSelected(true); // FIXME: The popup menu should be shown on the screen after certain // number of seconds pass. The 'delay' property of this menu indicates // this amount of seconds. 'delay' property is 0 by default. if (isShowing()) { fireMenuSelected(); int x = 0; int y = 0; if (showMenu) if (menuLocation == null) { // Calculate correct position of the popup. Note that location of the popup // passed to show() should be relative to the popup's invoker if (isTopLevelMenu()) y = this.getHeight(); else x = this.getWidth(); getPopupMenu().show(this, x, y); } else { getPopupMenu().show(this, menuLocation.x, menuLocation.y); } } } else { super.setSelected(false); super.setArmed(false); fireMenuDeselected(); popupMenu.setVisible(false); } }
private void setSelectedHelper(boolean selected, boolean menuEnabled, boolean showMenu) { // If menu is selected and enabled, activates the menu and // displays associated popup. if (selected && menuEnabled) { super.setArmed(true); super.setSelected(true); // FIXME: The popup menu should be shown on the screen after certain // number of seconds pass. The 'delay' property of this menu indicates // this amount of seconds. 'delay' property is 0 by default. if (isShowing()) { fireMenuSelected(); int x = 0; int y = 0; if (showMenu) if (menuLocation == null) { // Calculate correct position of the popup. Note that location of the popup // passed to show() should be relative to the popup's invoker if (isTopLevelMenu()) y = this.getHeight(); else x = this.getWidth(); getPopupMenu().show(this, x, y); } else { getPopupMenu().show(this, menuLocation.x, menuLocation.y); } } } else { super.setSelected(false); super.setArmed(false); fireMenuDeselected(); try { if (popupMenu != null) { popupMenu.setVisible(false); } } catch (Exception e) { e.printStackTrace(); } } }
15,460
public void write(byte[] data) throws IOException, NotImplementedException { write(data, 0, data.length); }
public void write(byte[] data) throws IOException { write(data, 0, data.length); }
15,461
public void writeBits(long bits, int numBits) throws IOException { // FIXME: Implement me. throw new Error("not implemented"); }
public void writeBits(long bits, int numBits) throws IOException, NotImplementedException { // FIXME: Implement me. throw new Error("not implemented"); }
15,462
public void writeBytes(String data) throws IOException { write(data.getBytes()); }
public void writeBytes(String data) throws IOException { int len = data.length(); for (int i = 0; i < len; ++i) writeByte(data.charAt(i)); }
15,463
public void writeChar(int value) throws IOException { writeShort((short) value); }
public void writeChar(int value) throws IOException { writeShort(value); }
15,464
public void writeDouble(double value) throws IOException { writeLong((long) value); }
public void writeDouble(double value) throws IOException { writeLong(Double.doubleToLongBits(value)); }
15,465
public void writeFloat(float value) throws IOException { writeInt((int) value); }
public void writeFloat(float value) throws IOException { writeInt(Float.floatToIntBits(value)); }
15,466
public void writeUTF(String data) throws IOException, NotImplementedException { throw new Error("not implemented"); }
public void writeUTF(String data) throws IOException, NotImplementedException { throw new Error("not implemented"); }
15,467
public void writeUTF(String data) throws IOException, NotImplementedException { throw new Error("not implemented"); }
public void writeUTF(String data) throws IOException, NotImplementedException { int len = value.length(); int sum = 0; for (int i = 0; i < len && sum <= 65535; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') buf[pos++] = (byte) c; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) { buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } else { buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } } writeShort (sum); write(buf, 0, sum); }
15,468
public int getSelectedColumnCount() { return 0; // TODO }
public int getSelectedColumnCount() { ListSelectionModel lsm = this.selectionModel; int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int sum = 0; if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: sum = 1; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: sum = hi - lo + 1; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) if (lsm.isSelectedIndex(i)) ++sum; break; } } return sum; // TODO }
15,469
public int[] getSelectedColumns() { return null; // TODO }
public int[] getSelectedColumns() { ListSelectionModel lsm = this.selectionModel; int sz = getSelectedColumnCount(); int [] ret = new int[sz]; int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int j = 0; java.util.ArrayList ls = new java.util.ArrayList(); if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: ret[0] = lo; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) ret[j++] = i; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) if (lsm.isSelectedIndex(i)) ret[j++] = i; break; } } return ret; // TODO }
15,470
public static Vector getInterfaces() throws SocketException { final VMNetAPI api = VMNetUtils.getAPI(); final Collection devs = api.getNetDevices(); final Vector intfs = new Vector(); for (Iterator i = devs.iterator(); i.hasNext(); ) { final VMNetDevice dev = (VMNetDevice)i.next(); final List addrs = api.getInetAddresses(dev); final InetAddress[] addrArr = (InetAddress[])addrs.toArray(new InetAddress[addrs.size()]); // TODO re-insert next line// intfs.add(new NetworkInterface(dev.getId(), addrArr)); } return intfs; }
public static Vector getInterfaces() throws SocketException { final VMNetAPI api = VMNetUtils.getAPI(); final Collection devs = api.getNetDevices(); final Vector intfs = new Vector(); for (Iterator i = devs.iterator(); i.hasNext(); ) { final VMNetDevice dev = (VMNetDevice)i.next(); final List addrs = api.getInetAddresses(dev); final InetAddress[] addrArr = (InetAddress[])addrs.toArray(new InetAddress[addrs.size()]); // TODO re-insert next line// intfs.add(new NetworkInterface(dev.getId(), addrArr)); } return intfs; }
15,471
public String toString() { // 64 is a reasonable buffer initial size for field StringBuffer sb = new StringBuffer(64); Modifier.toString(getModifiers(), sb).append(' '); sb.append(getType().getName()).append(' '); sb.append(getDeclaringClass().getName()).append('.'); sb.append(getName()); return sb.toString(); }
public String toString() { // 64 is a reasonable buffer initial size for field StringBuffer sb = new StringBuffer(64); Modifier.toString(getModifiers(), sb).append(' '); sb.append(getType().getName()).append(' '); sb.append(getDeclaringClass().getName()).append('.'); sb.append(getName()); return sb.toString(); }
15,475
public static boolean _boolean(Node context, Object object) { if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); } if (object instanceof Double) { return ((Double) object).doubleValue() != 0.0; } if (object instanceof String) { return ((String) object).length() != 0; } if (object instanceof Collection) { return ((Collection) object).size() != 0; } return false; // TODO user defined types }
public static boolean _boolean(Node context, Object object) { if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); } if (object instanceof Double) { Double value = (Double) object; if (value.isNaN()) return false; return value.doubleValue() != 0.0; } if (object instanceof String) { return ((String) object).length() != 0; } if (object instanceof Collection) { return ((Collection) object).size() != 0; } return false; // TODO user defined types }
15,476
public static String _local_name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); return node.getLocalName(); }
public static String _local_name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); return node.getLocalName(); }
15,477
public static String _name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: case Node.ELEMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: return node.getNodeName(); default: return ""; } }
public static String _name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: case Node.ELEMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: return node.getNodeName(); default: return ""; } }
15,478
public static String _name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: case Node.ELEMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: return node.getNodeName(); default: return ""; } }
public static String _name(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: case Node.ELEMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: return node.getNodeName(); default: return ""; } }
15,479
public static String _namespace_uri(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); return node.getNamespaceURI(); }
public static String _namespace_uri(Node context, Collection nodeSet) { Node node = (nodeSet == null || nodeSet.size() == 0) ? context : firstNode(nodeSet); return node.getNamespaceURI(); }
15,481
public void refresh(){ super.refresh(); try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId); if(pdm != null){ isvalid = false; for(PluginDescriptorModel fdm : pdm.fragments()){ if(fdm.getId().equals(fragmentId)){ buffer = pdm.getJarFile().getBuffer(); isvalid = buffer != null; } } } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
public void refresh(){ try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId); if(pdm != null){ isvalid = false; for(PluginDescriptorModel fdm : pdm.fragments()){ if(fdm.getId().equals(fragmentId)){ buffer = pdm.getJarFile().getBuffer(); isvalid = buffer != null; } } } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
15,482
public void refresh(){ super.refresh(); try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId); if(pdm != null){ isvalid = false; for(PluginDescriptorModel fdm : pdm.fragments()){ if(fdm.getId().equals(fragmentId)){ buffer = pdm.getJarFile().getBuffer(); isvalid = buffer != null; } } } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
public void refresh(){ super.refresh(); try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId); if(pdm != null){ isvalid = false; for(PluginDescriptorModel fdm : pdm.fragments()){ if(fdm.getId().equals(fragmentId)){ buffer = fdm.getJarFile().getBuffer(); isvalid = buffer != null; } } } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
15,483
public JIFSFpluginJar(String id, FSDirectory parent) { super(id + ".jar", parent); this.id = id; refresh(); }
public JIFSFpluginJar(String id, FSDirectory parent) { super(id + ".jar", parent); this.id = id; refresh(); }
15,484
public void refresh(){ super.refresh(); try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(id); if(pdm != null){ buffer = pdm.getJarFile().getBuffer(); isvalid = buffer != null; } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
public void refresh(){ try{ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(id); if(pdm != null){ buffer = pdm.getJarFile().getBuffer(); isvalid = buffer != null; } else { isvalid = false; } } catch (NameNotFoundException e){ System.err.println(e); } }
15,485
public JScrollBar() { this(SwingConstants.HORIZONTAL, 0, 10, 0, 100); }
public JScrollBar() { this(SwingConstants.VERTICAL, 0, 10, 0, 100); }
15,486
public void addAdjustmentListener(AdjustmentListener listener) { adjustmentListenerList.add(AdjustmentListener.class, listener); }
public void addAdjustmentListener(AdjustmentListener listener) { listenerList.add(AdjustmentListener.class, listener); }
15,487
public void addChangeListener(ChangeListener listener) { changeListenerList.add(ChangeListener.class, listener); }
public void addChangeListener(ChangeListener listener) { listenerList.add(ChangeListener.class, listener); }
15,488
protected void fireAdjustmentValueChanged(int id, int type, int value) { Object[] adjustmentListeners = adjustmentListenerList.getListenerList(); AdjustmentEvent adjustmentEvent = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value); for (int i = adjustmentListeners.length - 2; i >= 0; i -= 2) { if (adjustmentListeners[i] == AdjustmentListener.class) ((AdjustmentListener) adjustmentListeners[i + 1]).adjustmentValueChanged(adjustmentEvent); } }
protected void fireAdjustmentValueChanged(int id, int type, int value) { Object[] adjustmentListeners = listenerList.getListenerList(); AdjustmentEvent adjustmentEvent = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value); for (int i = adjustmentListeners.length - 2; i >= 0; i -= 2) { if (adjustmentListeners[i] == AdjustmentListener.class) ((AdjustmentListener) adjustmentListeners[i + 1]).adjustmentValueChanged(adjustmentEvent); } }
15,489
private void fireStateChanged() { Object[] changeListeners = changeListenerList.getListenerList(); if (changeEvent == null) changeEvent = new ChangeEvent(this); for (int i = changeListeners.length - 2; i >= 0; i -= 2) { if (changeListeners[i] == ChangeListener.class) ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent); } }
private void fireStateChanged() { Object[] changeListeners = listenerList.getListenerList(); if (changeEvent == null) changeEvent = new ChangeEvent(this); for (int i = changeListeners.length - 2; i >= 0; i -= 2) { if (changeListeners[i] == ChangeListener.class) ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent); } }
15,490
public AdjustmentListener[] getAdjustmentListeners() { return (AdjustmentListener[]) adjustmentListenerList.getListenerList(); }
public AdjustmentListener[] getAdjustmentListeners() { return (AdjustmentListener[]) listenerList.getListeners(AdjustmentListener.class); }
15,491
public ChangeListener[] getChangeListeners() { return (ChangeListener[]) changeListenerList.getListenerList(); }
public ChangeListener[] getChangeListeners() { return (ChangeListener[]) listenerList.getListeners(ChangeListener.class); }
15,492
public void removeAdjustmentListener(AdjustmentListener listener) { adjustmentListenerList.remove(AdjustmentListener.class, listener); }
public void removeAdjustmentListener(AdjustmentListener listener) { listenerList.remove(AdjustmentListener.class, listener); }
15,493
public void removeChangeListener(ChangeListener listener) { changeListenerList.remove(ChangeListener.class, listener); }
public void removeChangeListener(ChangeListener listener) { listenerList.remove(ChangeListener.class, listener); }
15,494
public final void debugStackTrace(VmThread thread) throws UninterruptiblePragma { Address f = thread.getStackFrame(); Unsafe.debug("Debug stacktrace: "); boolean first = true; int max = 20; while (isValid(f) && (max > 0)) { if (first) { first = false; } else { Unsafe.debug(", "); } final VmMethod method = getMethod(f); final int pc = getPC(f); final int lineNr = method.getBytecode().getLineNr(pc); final VmType vmClass = method.getDeclaringClass(); Unsafe.debug(vmClass.getName()); Unsafe.debug("::"); Unsafe.debug(method.getName()); Unsafe.debug(lineNr); f = getPrevious(f); max--; } if (isValid(f)) { Unsafe.debug("..."); } }
public final void debugStackTrace(VmThread thread) throws UninterruptiblePragma { Address f = thread.getStackFrame(); Unsafe.debug("Debug stacktrace: "); boolean first = true; int max = 20; while (isValid(f) && (max > 0)) { if (first) { first = false; } else { Unsafe.debug(", "); } final VmMethod method = getMethod(f); final int pc = getPC(f); final int lineNr = method.getBytecode().getLineNr(pc); final VmType vmClass = method.getDeclaringClass(); Unsafe.debug(vmClass.getName()); Unsafe.debug("::"); Unsafe.debug(method.getName()); Unsafe.debug(lineNr); f = getPrevious(f); max--; } if (isValid(f)) { Unsafe.debug("..."); } }
15,495
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
private Object getAttribute(AttributedCharacterIterator.Attribute key, int pos) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
15,496
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return null; for (int i = attribs.length - 1; i >= 0; i--) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
15,497
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
15,498
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
15,499
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null); }
public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { if (attribs == null) return null; for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return null; }
15,500
public void setText(String text) { if (text != labelText) { String oldText = labelText; labelText = text; firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, labelText); if (labelText.length() <= underlinedChar) setDisplayedMnemonicIndex(labelText.length() - 1); } }
public void setText(String text) { if (text != labelText) { String oldText = labelText; labelText = text; firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, labelText); if (labelText != null && labelText.length() <= underlinedChar) setDisplayedMnemonicIndex(labelText.length() - 1); } }
15,501
public BevelBorderUIResource(int bevelType) { }
public BevelBorderUIResource(int bevelType) { }
15,503