bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public static void invoke(ServerRequest request, InvokeHandler target, Streamable result ) { try { int IN = ARG_IN.value; int OUT = ARG_OUT.value; // Write all arguments to the buffer output stream. cdrBufOutput buffer = new cdrBufOutput(); gnuNVList args = new gnuNVList(); request.arguments(args); for (int i = 0; i < args.count(); i++) { if ((args.item(i).flags() & IN) != 0) { args.item(i).value().write_value(buffer); } } ServiceRequestAdapter h = new ServiceRequestAdapter(); target._invoke(request.operation(), buffer.create_input_stream(), h); InputStream in = h.reply.create_input_stream(); if (h.isException) { // Write the exception information gnuAny exc = new gnuAny(); universalHolder uku = new universalHolder(h.reply); exc.insert_Streamable(uku); request.set_exception(exc); } else { if (result != null) { result._read(in); gnuAny r = new gnuAny(); r.insert_Streamable(result); request.set_result(r); }; // Unpack the arguments for (int i = 0; i < args.count(); i++) { if ((args.item(i).flags() & OUT) != 0) { Any a = args.item(i).value(); a.read_value(in, a.type()); } } } } catch (Bounds ex) { throw new InternalError(); } }
|
public static void invoke(ServerRequest request, InvokeHandler target, Streamable result ) { try { int IN = ARG_IN.value; int OUT = ARG_OUT.value; // Write all arguments to the buffer output stream. cdrBufOutput buffer = new cdrBufOutput(); gnuNVList args = new gnuNVList(); request.arguments(args); for (int i = 0; i < args.count(); i++) { if ((args.item(i).flags() & IN) != 0) { args.item(i).value().write_value(buffer); } } ServiceRequestAdapter h = new ServiceRequestAdapter(); target._invoke(request.operation(), buffer.create_input_stream(), h); InputStream in = h.reply.create_input_stream(); if (h.isException) { // Write the exception information gnuAny exc = new gnuAny(); universalHolder uku = new universalHolder(h.reply); exc.insert_Streamable(uku); request.set_exception(exc); } else { if (result != null) { result._read(in); gnuAny r = new gnuAny(); r.insert_Streamable(result); request.set_result(r); } else { gnuAny r = new gnuAny(); r.insert_Streamable(new streamReadyHolder(in)); } // Unpack the arguments for (int i = 0; i < args.count(); i++) { if ((args.item(i).flags() & OUT) != 0) { Any a = args.item(i).value(); a.read_value(in, a.type()); } } } } catch (Bounds ex) { throw new InternalError(); } }
| 13,727
|
protected void addImpl(Component comp, Object layerConstraint, int index) { Integer layer; if (layerConstraint != null && layerConstraint instanceof Integer) layer = (Integer) layerConstraint; else if (componentToLayer.containsKey (comp)) layer = (Integer) componentToLayer.remove (comp); else layer = DEFAULT_LAYER; int newIdx = insertIndexForLayer(layer.intValue (), -1); componentToLayer.put (comp, layer); incrLayer (layer); super.addImpl(comp, null, newIdx); validate(); repaint(); }
|
protected void addImpl(Component comp, Object layerConstraint, int index) { Integer layer; if (layerConstraint != null && layerConstraint instanceof Integer) layer = (Integer) layerConstraint; else if (componentToLayer.containsKey (comp)) layer = (Integer) componentToLayer.remove (comp); else layer = DEFAULT_LAYER; int newIdx = insertIndexForLayer(layer.intValue (), index); componentToLayer.put (comp, layer); incrLayer (layer); super.addImpl(comp, null, newIdx); validate(); repaint(); }
| 13,729
|
protected void addImpl(Component comp, Object layerConstraint, int index) { Integer layer; if (layerConstraint != null && layerConstraint instanceof Integer) layer = (Integer) layerConstraint; else if (componentToLayer.containsKey (comp)) layer = (Integer) componentToLayer.remove (comp); else layer = DEFAULT_LAYER; int newIdx = insertIndexForLayer(layer.intValue (), -1); componentToLayer.put (comp, layer); incrLayer (layer); super.addImpl(comp, null, newIdx); validate(); repaint(); }
|
protected void addImpl(Component comp, Object layerConstraint, int index) { Integer layer; if (layerConstraint != null && layerConstraint instanceof Integer) layer = (Integer) layerConstraint; else if (componentToLayer.containsKey (comp)) layer = (Integer) componentToLayer.remove (comp); else layer = DEFAULT_LAYER; int newIdx = insertIndexForLayer(layer.intValue (), -1); componentToLayer.put (comp, layer); incrLayer (layer); super.addImpl(comp, null, newIdx); revalidate(); repaint(); }
| 13,730
|
public void setPosition(Component c, int position) { Integer layer = getLayer (c); int[] range = layerToRange (layer); if (range[0] == range[1]) throw new IllegalArgumentException (); int top = range[0]; int bot = range[1]; if (position == -1) position = (bot - top) - 1; int targ = top + position; int curr = -1; Component[] comps = getComponents(); for (int i = top; i < bot; ++i) { if (comps[i] == c) { curr = i; break; } } if (curr == -1) // should have found it throw new IllegalArgumentException (); super.swapComponents (curr, targ); validate(); repaint(); }
|
public void setPosition(Component c, int position) { Integer layer = getLayer (c); int[] range = layerToRange (layer); if (range[0] == range[1]) throw new IllegalArgumentException (); int top = range[0]; int bot = range[1]; if (position == -1) position = (bot - top) - 1; int targ = top + position; int curr = -1; Component[] comps = getComponents(); for (int i = top; i < bot; ++i) { if (comps[i] == c) { curr = i; break; } } if (curr == -1) // should have found it throw new IllegalArgumentException (); super.swapComponents (curr, targ); revalidate(); repaint(); }
| 13,731
|
public LineBreakIterator () { iter = null; }
|
public LineBreakIterator () { }
| 13,732
|
public void setArmed(boolean a) { changeState(ARMED, a); }
|
public void setArmed(boolean a) { if ((a && isArmed()) || (!a && !isArmed())) return; if (!isEnabled()) return; if (a) stateMask = stateMask | ARMED; else stateMask = stateMask & (~ARMED); fireStateChanged(); }
| 13,733
|
public void setEnabled(boolean e) { changeState(ENABLED, e); }
|
public void setEnabled(boolean e) { if ((e && isEnabled()) || (!e && !isEnabled())) return; if (e) stateMask = stateMask | ENABLED; else stateMask = stateMask & (~ENABLED); fireStateChanged(); }
| 13,734
|
public void setPressed(boolean p) { changeState(PRESSED, p); }
|
public void setPressed(boolean p) { if ((p && isPressed()) || (!p && !isPressed())) return; if (!isEnabled()) return; if (p) stateMask = stateMask | PRESSED; else stateMask = stateMask & (~PRESSED); if (!p && isArmed()) fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand)); fireStateChanged(); }
| 13,735
|
public void setRollover(boolean r) { changeState(ROLLOVER, r); }
|
public void setRollover(boolean r) { if ((r && isRollover()) || (!r && !isRollover())) return; if (!isEnabled()) return; if (r) stateMask = stateMask | ROLLOVER; else stateMask = stateMask & (~ROLLOVER); fireStateChanged(); }
| 13,736
|
public void setSelected(boolean s) { changeState(SELECTED, s); }
|
public void setSelected(boolean s) { if ((s && isSelected()) || (!s && !isSelected())) return; if (s) stateMask = stateMask | SELECTED; else stateMask = stateMask & (~SELECTED); fireStateChanged(); if (s) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.SELECTED)); if (group != null) group.setSelected(this, true); } else { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.DESELECTED)); if (group != null) group.setSelected(this, false); } }
| 13,737
|
public void finalize () { unmapImpl(); }
|
public void finalize() throws Throwable { unmapImpl(); }
| 13,738
|
public AccessibleContext getAccessibleContext() { return null; }
|
public AccessibleContext getAccessibleContext() { return new AccessibleJTree(); }
| 13,739
|
public boolean getScrollableTracksViewportHeight() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
|
public boolean getScrollableTracksViewportHeight() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getHeight() > getPreferredSize().height; return false; }
| 13,740
|
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getHeight() > getPreferredSize().height; return false; }
|
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
| 13,741
|
protected void send(DatagramPacket p) throws IOException { //Syslog.debug("UDP-send: " + p); final IPv4Address dstAddress = new IPv4Address(p.getAddress()); final IPv4Header ipHdr; ipHdr = new IPv4Header(getTos(), getTimeToLive(), IPPROTO_UDP, dstAddress, p.getLength() + UDP_HLEN); if (!getLocalAddress().isAnyLocalAddress() || (getDevice() != null)) { ipHdr.setSource(new IPv4Address(getLocalAddress())); } final UDPHeader udpHdr; final int srcPort = p.getPort(); // or getLocalPort???? TODO Fix srcPort issue udpHdr = new UDPHeader(srcPort, p.getPort(), p.getLength()); final SocketBuffer skbuf = new SocketBuffer(p.getData(), p.getOffset(), p.getLength()); skbuf.setDevice(getDevice()); protocol.send(ipHdr, udpHdr, skbuf); }
|
protected void send(DatagramPacket p) throws IOException { //Syslog.debug("UDP-send: " + p); final IPv4Address dstAddress = new IPv4Address(p.getAddress()); final IPv4Header ipHdr; ipHdr = new IPv4Header(getTos(), getTimeToLive(), IPPROTO_UDP, dstAddress, p.getLength() + UDP_HLEN); if (!getLocalAddress().isAnyLocalAddress() || (getDevice() != null)) { ipHdr.setSource(new IPv4Address(getLocalAddress())); } final UDPHeader udpHdr; final int srcPort = p.getPort(); // or getLocalPort???? TODO Fix srcPort issue udpHdr = new UDPHeader(srcPort, p.getPort(), p.getLength()); final SocketBuffer skbuf = new SocketBuffer(p.getData(), p.getOffset(), p.getLength()); skbuf.setDevice(getDevice()); protocol.send(ipHdr, udpHdr, skbuf); }
| 13,742
|
protected synchronized void bind(UDPDatagramSocketImpl socket) throws SocketException { final Integer lport = new Integer(socket.getLocalPort()); if (sockets.containsKey(lport)) { throw new SocketException("Port already bound (" + lport + ")"); } else { sockets.put(lport, socket); } }
|
protected synchronized void bind(UDPDatagramSocketImpl socket) throws SocketException { final Integer lport = new Integer(socket.getLocalPort()); if (sockets.containsKey(lport)) { throw new SocketException("Port already bound (" + lport + ")"); } else { sockets.put(lport, socket); } }
| 13,743
|
protected synchronized void unbind(UDPDatagramSocketImpl socket) { final Integer lport = new Integer(socket.getLocalPort()); if (sockets.get(lport) == socket) { sockets.remove(lport); } }
|
protected synchronized void unbind(UDPDatagramSocketImpl socket) { final Integer lport = new Integer(socket.getLocalPort()); if (sockets.get(lport) == socket) { sockets.remove(lport); } }
| 13,745
|
public NamingContextExtHolder(NamingContextExt initialValue) { value = initialValue; }
|
public NamingContextExtHolder() { value = initialValue; }
| 13,747
|
public NamingContextExtHolder(NamingContextExt initialValue) { value = initialValue; }
|
public NamingContextExtHolder(NamingContextExt initialValue) { }
| 13,748
|
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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
|
public FBScreen(Surface g) { this.g = g; 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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
| 13,749
|
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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
|
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 BufferedImage(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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
| 13,750
|
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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
|
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); try{ FontProvider fm = 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
| 13,751
|
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); 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); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
|
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); try{ FontProvider fm = (FontProvider) new BDFFontProvider(); if(!fm.provides(font)){ throw new RuntimeException(fm + " does not provide" + font); } TextRenderer tr = fm.getTextRenderer(font); if(tr == null) new NullPointerException("Text renderer is null"); }catch(Exception e){ new RuntimeException(e); } new Thread(new Runnable() { public void run() { while(true){ try{ paintComponent(); synchronized(FBScreen.this){ if(!update) { update = false; FBScreen.this.wait(); } } }catch(InterruptedException x ){ break; } } } }, "FBScreenUpdater").start(); }
| 13,752
|
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 = 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 = 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); } finally { if (g != null) { log.info("Close graphics"); g.close(); } } }
| 13,754
|
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); logger.log (Component.X509, "start Certificate len == {0}", new Integer (cert.getLength())); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); } // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); } tbsCertBytes = tbsCert.getEncoded(); logger.log (Component.X509, "start TBSCertificate len == {0}", new Integer (tbsCert.getLength())); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) } DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); } else { version = 1; } logger.log (Component.X509, "read version == {0}", new Integer (version)); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); logger.log (Component.X509, "read serial number == {0}", serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int certAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (certAlgLen)); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm ID == {0}", algId); // parameters ANY DEFINED BY algorithm OPTIONAL } if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; } else { algVal = val.getEncoded(); if (val.isConstructed()) encoded.skip(val.getLength()); } logger.log (Component.X509, "read algorithm parameters == {0}", algVal); } // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read issuer == {0}", issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time } if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); } notBefore = (Date) der.read().getValue(); logger.log (Component.X509, "read notBefore == {0}", notBefore); notAfter = (Date) der.read().getValue(); logger.log (Component.X509, "read notAfter == {0}", notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read subject == {0}", subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); } KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); logger.log (Component.X509, "read subjectPublicKey == {0}", subjectKey); if (version > 1) { val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read issuerUniqueId == {0}", issuerUniqueId); val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read subjectUniqueId == {0}", subjectUniqueId); val = der.read(); } if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); logger.log (Component.X509, "start Extensions len == {0}", new Integer (val.getLength())); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); logger.log (Component.X509, "start extension len == {0}", new Integer (ext.getLength())); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); logger.log (Component.X509, "read extension {0} == {1}", new Object[] { e.getOid (), e }); logger.log (Component.X509, "count == {0}", new Integer (len)); } val = der.read (); } logger.log (Component.X509, "read value {0}", val); if (!val.isConstructed()) { throw new CertificateException ("malformed AlgorithmIdentifier"); } int sigAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (sigAlgLen)); val = der.read(); sigAlgId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm id == {0}", sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); } } else { sigAlgVal = (byte[]) val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } logger.log (Component.X509, "read parameters == {0}", sigAlgVal); } signature = ((BitString) der.read().getValue()).toByteArray(); logger.log (Component.X509, "read signature ==\n{0}", Util.hexDump(signature, ">>>> ")); }
|
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); logger.log (Component.X509, "start Certificate len == {0}", new Integer (cert.getLength())); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); } // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); } tbsCertBytes = tbsCert.getEncoded(); logger.log (Component.X509, "start TBSCertificate len == {0}", new Integer (tbsCert.getLength())); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) } DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); } else { version = 1; } logger.log (Component.X509, "read version == {0}", new Integer (version)); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); logger.log (Component.X509, "read serial number == {0}", serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int certAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (certAlgLen)); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm ID == {0}", algId); // parameters ANY DEFINED BY algorithm OPTIONAL } if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; } else { algVal = val.getEncoded(); if (val.isConstructed()) encoded.skip(val.getLength()); } logger.log (Component.X509, "read algorithm parameters == {0}", algVal); } // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read issuer == {0}", issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time } if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); } notBefore = (Date) der.read().getValue(); logger.log (Component.X509, "read notBefore == {0}", notBefore); notAfter = (Date) der.read().getValue(); logger.log (Component.X509, "read notAfter == {0}", notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read subject == {0}", subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); } KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); logger.log (Component.X509, "read subjectPublicKey == {0}", subjectKey); if (version > 1) { val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read issuerUniqueId == {0}", issuerUniqueId); val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read subjectUniqueId == {0}", subjectUniqueId); val = der.read(); } if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); logger.log (Component.X509, "start Extensions len == {0}", new Integer (val.getLength())); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); logger.log (Component.X509, "start extension len == {0}", new Integer (ext.getLength())); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); logger.log (Component.X509, "read extension {0} == {1}", new Object[] { e.getOid (), e }); logger.log (Component.X509, "count == {0}", new Integer (len)); } val = der.read (); } logger.log (Component.X509, "read value {0}", val); if (!val.isConstructed()) { throw new CertificateException ("malformed AlgorithmIdentifier"); } int sigAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (sigAlgLen)); val = der.read(); sigAlgId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm id == {0}", sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); } } else { sigAlgVal = (byte[]) val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } logger.log (Component.X509, "read parameters == {0}", sigAlgVal); } signature = ((BitString) der.read().getValue()).toByteArray(); logger.log (Component.X509, "read signature ==\n{0}", Util.hexDump(signature, ">>>> ")); }
| 13,755
|
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); logger.log (Component.X509, "start Certificate len == {0}", new Integer (cert.getLength())); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); } // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); } tbsCertBytes = tbsCert.getEncoded(); logger.log (Component.X509, "start TBSCertificate len == {0}", new Integer (tbsCert.getLength())); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) } DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); } else { version = 1; } logger.log (Component.X509, "read version == {0}", new Integer (version)); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); logger.log (Component.X509, "read serial number == {0}", serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int certAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (certAlgLen)); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm ID == {0}", algId); // parameters ANY DEFINED BY algorithm OPTIONAL } if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; } else { algVal = val.getEncoded(); if (val.isConstructed()) encoded.skip(val.getLength()); } logger.log (Component.X509, "read algorithm parameters == {0}", algVal); } // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read issuer == {0}", issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time } if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); } notBefore = (Date) der.read().getValue(); logger.log (Component.X509, "read notBefore == {0}", notBefore); notAfter = (Date) der.read().getValue(); logger.log (Component.X509, "read notAfter == {0}", notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read subject == {0}", subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); } KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); logger.log (Component.X509, "read subjectPublicKey == {0}", subjectKey); if (version > 1) { val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read issuerUniqueId == {0}", issuerUniqueId); val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read subjectUniqueId == {0}", subjectUniqueId); val = der.read(); } if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); logger.log (Component.X509, "start Extensions len == {0}", new Integer (val.getLength())); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); logger.log (Component.X509, "start extension len == {0}", new Integer (ext.getLength())); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); logger.log (Component.X509, "read extension {0} == {1}", new Object[] { e.getOid (), e }); logger.log (Component.X509, "count == {0}", new Integer (len)); } val = der.read (); } logger.log (Component.X509, "read value {0}", val); if (!val.isConstructed()) { throw new CertificateException ("malformed AlgorithmIdentifier"); } int sigAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0}", new Integer (sigAlgLen)); val = der.read(); sigAlgId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm id == {0}", sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); } } else { sigAlgVal = (byte[]) val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } logger.log (Component.X509, "read parameters == {0}", sigAlgVal); } signature = ((BitString) der.read().getValue()).toByteArray(); logger.log (Component.X509, "read signature ==\n{0}", Util.hexDump(signature, ">>>> ")); }
|
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); logger.log (Component.X509, "start Certificate len == {0", new Integer (cert.getLength())); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); tbsCertBytes = tbsCert.getEncoded(); logger.log (Component.X509, "start TBSCertificate len == {0", new Integer (tbsCert.getLength())); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); else { version = 1; logger.log (Component.X509, "read version == {0", new Integer (version)); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); logger.log (Component.X509, "read serial number == {0", serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); int certAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0", new Integer (certAlgLen)); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm ID == {0", algId); // parameters ANY DEFINED BY algorithm OPTIONAL if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; else { algVal = val.getEncoded(); if (val.isConstructed()) encoded.skip(val.getLength()); logger.log (Component.X509, "read algorithm parameters == {0", algVal); // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read issuer == {0", issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); notBefore = (Date) der.read().getValue(); logger.log (Component.X509, "read notBefore == {0", notBefore); notAfter = (Date) der.read().getValue(); logger.log (Component.X509, "read notAfter == {0", notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); logger.log (Component.X509, "read subject == {0", subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); logger.log (Component.X509, "read subjectPublicKey == {0", subjectKey); if (version > 1) { val = der.read(); if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read issuerUniqueId == {0", issuerUniqueId); val = der.read(); if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); logger.log (Component.X509, "read subjectUniqueId == {0", subjectUniqueId); val = der.read(); if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); logger.log (Component.X509, "start Extensions len == {0", new Integer (val.getLength())); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); logger.log (Component.X509, "start extension len == {0", new Integer (ext.getLength())); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); logger.log (Component.X509, "read extension {0 == {1", new Object[] { e.getOid (), e ); logger.log (Component.X509, "count == {0", new Integer (len)); val = der.read (); logger.log (Component.X509, "read value {0", val); if (!val.isConstructed()) { throw new CertificateException ("malformed AlgorithmIdentifier"); int sigAlgLen = val.getLength(); logger.log (Component.X509, "start AlgorithmIdentifier len == {0", new Integer (sigAlgLen)); val = der.read(); sigAlgId = (OID) val.getValue(); logger.log (Component.X509, "read algorithm id == {0", sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); else { sigAlgVal = (byte[]) val.getEncoded(); if (val.isConstructed()) { encoded.skip(val.getLength()); logger.log (Component.X509, "read parameters == {0", sigAlgVal); signature = ((BitString) der.read().getValue()).toByteArray(); logger.log (Component.X509, "read signature ==\n{0", Util.hexDump(signature, ">>>> "));
| 13,756
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering(this.getClass().getName(), "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
| 13,757
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println(Messages.getString("JarVerifier.2")); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
| 13,758
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println(Messages.getString("JarVerifier.3")); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
| 13,759
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
| 13,760
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println(Messages.getFormattedString("JarVerifier.7", Integer.valueOf(limit))); } log.exiting("JarVerifier", "start"); }
| 13,761
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting("JarVerifier", "start"); }
|
void start() throws Exception { log.entering("JarVerifier", "start"); String jarFileName = main.getJarFileName(); jarFile = new JarFile(jarFileName); // 1. find all signature (.SF) files List sfFiles = new ArrayList(); for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { JarEntry je = (JarEntry) e.nextElement(); String jeName = je.getName(); if (! (jeName.startsWith(JarUtils.META_INF) && jeName.endsWith(JarUtils.SF_SUFFIX))) continue; // only interested in .SF files in, and not deeper than, META-INF String[] jeNameParts = jeName.split("/"); if (jeNameParts.length != 2) continue; String sfName = jeNameParts[1]; String sigFileName = sfName.substring(0, sfName.length() - 3); sfFiles.add(sigFileName); } // 2. verify each one if (sfFiles.isEmpty()) System.out.println("jar is not signed.--no signature files found."); else { int limit = sfFiles.size(); int count = 0; for (Iterator it = sfFiles.iterator(); it.hasNext(); ) { String alias = (String) it.next(); if (verifySF(alias)) if (verifySFEntries(alias)) count++; } if (count == 0) System.out.println("jar verification failed."); else if (count != limit) System.out.println("jar partially verified --" + count + " of " + limit + " signers."); else System.out.println("jar verified --" + limit + " signer(s)."); } log.exiting(this.getClass().getName(), "start"); }
| 13,762
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
| 13,763
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException(Messages.getFormattedString("JarVerifier.13", sigFileName)); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
| 13,764
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
| 13,765
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
| 13,766
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
| 13,767
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting("JarVerifier", "verifySF", new Boolean(result)); return result; }
|
private boolean verifySF(String sigFileName) throws CRLException, CertificateException, ZipException, IOException { log.entering("JarVerifier", "verifySF"); log.finest("About to verify signature of " + sigFileName + "..."); // 1. find the corresponding .DSA file for this .SF file JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.DSA_SUFFIX); if (dsaEntry == null) throw new SecurityException("Signature Block missing for " + sigFileName); // 2. read the .DSA file contents as a PKCS7 SignedData InputStream in = jarFile.getInputStream(dsaEntry); PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in); // 4. get the encrypted digest octet string from the first SignerInfo // this octet string is the digital signature of the .SF file contents Set signerInfos = pkcs7SignedData.getSignerInfos(); if (signerInfos == null || signerInfos.isEmpty()) throw new SecurityException("At least one SignerInfo element MUST be " + "present in a Signature Block (.DSA file)"); SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next(); byte[] encryptedDigest = signerInfo.getEncryptedDigest(); if (encryptedDigest == null) throw new SecurityException("Missing EncryptedDigest in Signature Block " + "(.DSA file) first SignerInfo element"); log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); // 5. get the signer public key Certificate cert = pkcs7SignedData.getCertificates()[0]; PublicKey verifierKey = cert.getPublicKey(); log.finest("--- verifier public key = " + verifierKey); // 6. verify the signature file signature OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId(); ISignature signatureAlgorithm; ISignatureCodec signatureCodec; if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID)) { signatureAlgorithm = new DSSSignature(); signatureCodec = new DSSSignatureX509Codec(); } else { signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH); signatureCodec = new RSAPKCS1V1_5SignatureX509Codec(); } Map signatureAttributes = new HashMap(); signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey); signatureAlgorithm.setupVerify(signatureAttributes); Object herSignature = signatureCodec.decodeSignature(encryptedDigest); // 7. verify the signature file contents JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName + JarUtils.SF_SUFFIX); in = jarFile.getInputStream(sfEntry); byte[] buffer = new byte[2048]; int n; while ((n = in.read(buffer)) != -1) if (n > 0) signatureAlgorithm.update(buffer, 0, n); boolean result = signatureAlgorithm.verify(herSignature); log.info("Signature block [" + sigFileName + "] is " + (result ? "" : "NOT ") + "OK"); log.exiting(this.getClass().getName(), "verifySF", Boolean.valueOf(result)); return result; }
| 13,768
|
private boolean verifySFEntries(String alias) throws IOException { log.entering("JarVerifier", "verifySFEntries"); // 1. read the signature file JarEntry jarEntry = jarFile.getJarEntry(JarUtils.META_INF + alias + JarUtils.SF_SUFFIX); InputStream in = jarFile.getInputStream(jarEntry); Attributes attr = new Attributes(); Map entries = new HashMap(); JarUtils.readSFManifest(attr, entries, in); // 2. The .SF file by default includes a header containing a hash of the // entire manifest file. When the header is present, then the verification // can check to see whether or not the hash in the header indeed matches // the hash of the manifest file. boolean result = false; String hash = attr.getValue(Main.DIGEST_MANIFEST_ATTR); if (hash != null) result = verifyManifest(hash); // A verification is still considered successful if none of the files that // were in the JAR file when the signature was generated have been changed // since then, which is the case if the hashes in the non-header sections // of the .SF file equal the hashes of the corresponding sections in the // manifest file. // // 3. Read each file in the JAR file that has an entry in the .SF file. // While reading, compute the file's digest, and then compare the result // with the digest for this file in the manifest section. The digests // should be the same, or verification fails. if (! result) for (Iterator it = entries.keySet().iterator(); it.hasNext();) { Entry me = (Entry) it.next(); String name = (String) me.getKey(); attr = (Attributes) me.getValue(); hash = attr.getValue(Main.DIGEST_ATTR); result = verifySFEntry(name, hash); if (! result) break; } log.exiting("JarVerifier", "verifySFEntries", new Boolean(result)); return result; }
|
private boolean verifySFEntries(String alias) throws IOException { log.entering(this.getClass().getName(), "verifySFEntries"); // 1. read the signature file JarEntry jarEntry = jarFile.getJarEntry(JarUtils.META_INF + alias + JarUtils.SF_SUFFIX); InputStream in = jarFile.getInputStream(jarEntry); Attributes attr = new Attributes(); Map entries = new HashMap(); JarUtils.readSFManifest(attr, entries, in); // 2. The .SF file by default includes a header containing a hash of the // entire manifest file. When the header is present, then the verification // can check to see whether or not the hash in the header indeed matches // the hash of the manifest file. boolean result = false; String hash = attr.getValue(Main.DIGEST_MANIFEST_ATTR); if (hash != null) result = verifyManifest(hash); // A verification is still considered successful if none of the files that // were in the JAR file when the signature was generated have been changed // since then, which is the case if the hashes in the non-header sections // of the .SF file equal the hashes of the corresponding sections in the // manifest file. // // 3. Read each file in the JAR file that has an entry in the .SF file. // While reading, compute the file's digest, and then compare the result // with the digest for this file in the manifest section. The digests // should be the same, or verification fails. if (! result) for (Iterator it = entries.keySet().iterator(); it.hasNext();) { Entry me = (Entry) it.next(); String name = (String) me.getKey(); attr = (Attributes) me.getValue(); hash = attr.getValue(Main.DIGEST_ATTR); result = verifySFEntry(name, hash); if (! result) break; } log.exiting("JarVerifier", "verifySFEntries", new Boolean(result)); return result; }
| 13,769
|
private boolean verifySFEntries(String alias) throws IOException { log.entering("JarVerifier", "verifySFEntries"); // 1. read the signature file JarEntry jarEntry = jarFile.getJarEntry(JarUtils.META_INF + alias + JarUtils.SF_SUFFIX); InputStream in = jarFile.getInputStream(jarEntry); Attributes attr = new Attributes(); Map entries = new HashMap(); JarUtils.readSFManifest(attr, entries, in); // 2. The .SF file by default includes a header containing a hash of the // entire manifest file. When the header is present, then the verification // can check to see whether or not the hash in the header indeed matches // the hash of the manifest file. boolean result = false; String hash = attr.getValue(Main.DIGEST_MANIFEST_ATTR); if (hash != null) result = verifyManifest(hash); // A verification is still considered successful if none of the files that // were in the JAR file when the signature was generated have been changed // since then, which is the case if the hashes in the non-header sections // of the .SF file equal the hashes of the corresponding sections in the // manifest file. // // 3. Read each file in the JAR file that has an entry in the .SF file. // While reading, compute the file's digest, and then compare the result // with the digest for this file in the manifest section. The digests // should be the same, or verification fails. if (! result) for (Iterator it = entries.keySet().iterator(); it.hasNext();) { Entry me = (Entry) it.next(); String name = (String) me.getKey(); attr = (Attributes) me.getValue(); hash = attr.getValue(Main.DIGEST_ATTR); result = verifySFEntry(name, hash); if (! result) break; } log.exiting("JarVerifier", "verifySFEntries", new Boolean(result)); return result; }
|
private boolean verifySFEntries(String alias) throws IOException { log.entering("JarVerifier", "verifySFEntries"); // 1. read the signature file JarEntry jarEntry = jarFile.getJarEntry(JarUtils.META_INF + alias + JarUtils.SF_SUFFIX); InputStream in = jarFile.getInputStream(jarEntry); Attributes attr = new Attributes(); Map entries = new HashMap(); JarUtils.readSFManifest(attr, entries, in); // 2. The .SF file by default includes a header containing a hash of the // entire manifest file. When the header is present, then the verification // can check to see whether or not the hash in the header indeed matches // the hash of the manifest file. boolean result = false; String hash = attr.getValue(Main.DIGEST_MANIFEST_ATTR); if (hash != null) result = verifyManifest(hash); // A verification is still considered successful if none of the files that // were in the JAR file when the signature was generated have been changed // since then, which is the case if the hashes in the non-header sections // of the .SF file equal the hashes of the corresponding sections in the // manifest file. // // 3. Read each file in the JAR file that has an entry in the .SF file. // While reading, compute the file's digest, and then compare the result // with the digest for this file in the manifest section. The digests // should be the same, or verification fails. if (! result) for (Iterator it = entries.keySet().iterator(); it.hasNext();) { Entry me = (Entry) it.next(); String name = (String) me.getKey(); attr = (Attributes) me.getValue(); hash = attr.getValue(Main.DIGEST_ATTR); result = verifySFEntry(name, hash); if (! result) break; } log.exiting(this.getClass().getName(), "verifySFEntries", Boolean.valueOf(result)); return result; }
| 13,770
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
|
public boolean matches(Node node, int pos, int len) switch (node.getNodeType()) case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) return false; } if (anyLocalName) return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
| 13,771
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; // Fall through case Node.ELEMENT_NODE: break; default: return false; if (any) { return true; String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; if (anyLocalName) { return true; String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); return (localName.equals(nodeLocalName));
| 13,772
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
| 13,773
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
|
public boolean matches(Node node, int pos, int len) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // Do not match namespace attributes String uri = node.getNamespaceURI(); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) || XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName())) { return false; } // Fall through case Node.ELEMENT_NODE: break; default: return false; } if (any) { return true; } String uri = qName.getNamespaceURI(); String nodeUri = node.getNamespaceURI(); String nodeLocalName = node.getLocalName(); if (nodeLocalName != null && !equal(uri, nodeUri)) { return false; } if (anyLocalName) { return true; } String localName = qName.getLocalPart(); if (nodeLocalName != null) { nodeLocalName = node.getNodeName(); } return (localName.equals(nodeLocalName)); }
| 13,774
|
public NotEmptyHolder(NotEmpty initialValue) { value = initialValue; }
|
public NotEmptyHolder() { value = initialValue; }
| 13,775
|
public NotEmptyHolder(NotEmpty initialValue) { value = initialValue; }
|
public NotEmptyHolder(NotEmpty initialValue) { }
| 13,776
|
private void updateImage() { switch (locked) { case HLOCKED: updateHLockImage(); break; case SLOCKED: updateSLockImage(); break; case BLOCKED: updateBLockImage(); break; } }
|
void updateImage() { switch (locked) { case HLOCKED: updateHLockImage(); break; case SLOCKED: updateSLockImage(); break; case BLOCKED: updateBLockImage(); break; } }
| 13,777
|
private void updateSlider() { if (slider == null) return; slider.setMinimum(0); if (locked == HLOCKED) { slider.setMaximum(359); ; slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setInverted(true); } else { slider.setMaximum(100); slider.setInverted(false); if (sRadio.isSelected()) slider.setValue(((Number) sSpinner.getValue()).intValue()); else slider.setValue(((Number) bSpinner.getValue()).intValue()); } repaint(); }
|
void updateSlider() { if (slider == null) return; slider.setMinimum(0); if (locked == HLOCKED) { slider.setMaximum(359); ; slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setInverted(true); } else { slider.setMaximum(100); slider.setInverted(false); if (sRadio.isSelected()) slider.setValue(((Number) sSpinner.getValue()).intValue()); else slider.setValue(((Number) bSpinner.getValue()).intValue()); } repaint(); }
| 13,778
|
private void updateTrack() { switch (locked) { case HLOCKED: updateHTrack(); break; case SLOCKED: updateSTrack(); break; case BLOCKED: updateBTrack(); break; } }
|
void updateTrack() { switch (locked) { case HLOCKED: updateHTrack(); break; case SLOCKED: updateSTrack(); break; case BLOCKED: updateBTrack(); break; } }
| 13,779
|
public MemoryImageSource(int w, int h, int pix[], int off, int scan) { this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, null); }
|
public MemoryImageSource(int w, int h, int pix[], int off, int scan) { this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, null); }
| 13,780
|
public MemoryImageSource(int w, int h, int pix[], int off, int scan) { this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, null); }
|
public MemoryImageSource(int w, int h, int pix[], int off, int scan) { this(w, h, cm, pix, off, scan, null); }
| 13,781
|
private static void readFields(ByteBuffer data, VmType< ? > cls, VmCP cp, VmSharedStatics sharedStatics, VmIsolatedStatics isolatedStatics, int slotSize, int flags) { final int fcount = data.getChar(); if (fcount > 0) { final VmField[] ftable = new VmField[fcount]; int objectSize = 0; for (int i = 0; i < fcount; i++) { final boolean wide; int modifiers = data.getChar(); final String name = cp.getUTF8(data.getChar()); final String signature = cp.getUTF8(data.getChar()); switch (signature.charAt(0)) { case 'J': case 'D': modifiers = modifiers | Modifier.ACC_WIDE; wide = true; break; default: wide = false; } final boolean isstatic = (modifiers & Modifier.ACC_STATIC) != 0; final int staticsIdx; final VmField fs; final VmStatics statics; if (isstatic) { // Determine if the static field should be shared. final boolean shared = cls.isSharedStatics(); if (shared) { statics = sharedStatics; } else { statics = isolatedStatics; } // If static allocate space for it. switch (signature.charAt(0)) { case 'B': staticsIdx = statics.allocIntField(); break; case 'C': staticsIdx = statics.allocIntField(); break; case 'D': staticsIdx = statics.allocLongField(); break; case 'F': staticsIdx = statics.allocIntField(); break; case 'I': staticsIdx = statics.allocIntField(); break; case 'J': staticsIdx = statics.allocLongField(); break; case 'S': staticsIdx = statics.allocIntField(); break; case 'Z': staticsIdx = statics.allocIntField(); break; default: { if (Modifier.isAddressType(signature)) { staticsIdx = statics.allocAddressField(); } else { staticsIdx = statics.allocObjectField(); // System.out.println(NumberUtils.hex(staticsIdx) // + "\t" + cls.getName() + "." + name); } } break; } fs = new VmStaticField(name, signature, modifiers, staticsIdx, cls, slotSize, shared); } else { staticsIdx = -1; statics = null; final int fieldOffset; // Set the offset (keep in mind that this will be fixed // by ClassResolver with respect to the objectsize of the // super-class. fieldOffset = objectSize; // Increment the objectSize if (wide) objectSize += 8; else if (Modifier.isPrimitive(signature)) { objectSize += 4; } else { objectSize += slotSize; } fs = new VmInstanceField(name, signature, modifiers, fieldOffset, cls, slotSize); } ftable[i] = fs; // Read field attributes final int acount = data.getChar(); for (int a = 0; a < acount; a++) { final String attrName = cp.getUTF8(data.getChar()); final int length = data.getInt(); if (isstatic && VmArray.equals(ConstantValueAttrName, attrName)) { final int idx = data.getChar(); switch (signature.charAt(0)) { case 'B': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'C': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'D': final long lval = Double.doubleToRawLongBits(cp .getDouble(idx)); statics.setLong(staticsIdx, lval); break; case 'F': final int ival = Float.floatToRawIntBits(cp .getFloat(idx)); statics.setInt(staticsIdx, ival); break; case 'I': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'J': statics.setLong(staticsIdx, cp.getLong(idx)); break; case 'S': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'Z': statics.setInt(staticsIdx, cp.getInt(idx)); break; default: // throw new IllegalArgumentException("signature " // + signature); statics.setObject(staticsIdx, cp.getString(idx)); break; } } else { skip(data, length); } } } // Align the instance fields for minimal object size. if ((flags & NO_FIELD_ALIGNMENT) == 0) { final int alignedObjectSize = alignInstanceFields(ftable, slotSize); objectSize = alignedObjectSize; } cls.setFieldTable(ftable); if (objectSize > 0) { ((VmNormalClass) cls).setObjectSize(objectSize); } } }
|
private static void readFields(ByteBuffer data, VmType< ? > cls, VmCP cp, VmSharedStatics sharedStatics, VmIsolatedStatics isolatedStatics, int slotSize, int flags) { final int fcount = data.getChar(); if (fcount > 0) { final VmField[] ftable = new VmField[fcount]; int objectSize = 0; for (int i = 0; i < fcount; i++) { final boolean wide; int modifiers = data.getChar(); final String name = cp.getUTF8(data.getChar()); final String signature = cp.getUTF8(data.getChar()); switch (signature.charAt(0)) { case 'J': case 'D': modifiers = modifiers | Modifier.ACC_WIDE; wide = true; break; default: wide = false; } final boolean isstatic = (modifiers & Modifier.ACC_STATIC) != 0; final int staticsIdx; final VmField fs; final VmStatics statics; if (isstatic) { // Determine if the static field should be shared. final boolean shared = cls.isSharedStatics(); if (shared) { statics = sharedStatics; } else { statics = isolatedStatics; } // If static allocate space for it. switch (signature.charAt(0)) { case 'B': staticsIdx = statics.allocIntField(); break; case 'C': staticsIdx = statics.allocIntField(); break; case 'D': staticsIdx = statics.allocLongField(); break; case 'F': staticsIdx = statics.allocIntField(); break; case 'I': staticsIdx = statics.allocIntField(); break; case 'J': staticsIdx = statics.allocLongField(); break; case 'S': staticsIdx = statics.allocIntField(); break; case 'Z': staticsIdx = statics.allocIntField(); break; default: { if (Modifier.isAddressType(signature)) { staticsIdx = statics.allocAddressField(); } else { staticsIdx = statics.allocObjectField(); // System.out.println(NumberUtils.hex(staticsIdx) // + "\t" + cls.getName() + "." + name); } } break; } fs = new VmStaticField(name, signature, modifiers, staticsIdx, cls, slotSize, shared); } else { staticsIdx = -1; statics = null; final int fieldOffset; // Set the offset (keep in mind that this will be fixed // by ClassResolver with respect to the objectsize of the // super-class. fieldOffset = objectSize; // Increment the objectSize if (wide) objectSize += 8; else if (Modifier.isPrimitive(signature)) { objectSize += 4; } else { objectSize += slotSize; } fs = new VmInstanceField(name, signature, modifiers, fieldOffset, cls, slotSize); } ftable[i] = fs; // Read field attributes final int acount = data.getChar(); for (int a = 0; a < acount; a++) { final String attrName = cp.getUTF8(data.getChar()); final int length = data.getInt(); if (isstatic && VmArray.equals(ConstantValueAttrName, attrName)) { final int idx = data.getChar(); switch (signature.charAt(0)) { case 'B': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'C': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'D': final long lval = Double.doubleToRawLongBits(cp .getDouble(idx)); statics.setLong(staticsIdx, lval); break; case 'F': final int ival = Float.floatToRawIntBits(cp .getFloat(idx)); statics.setInt(staticsIdx, ival); break; case 'I': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'J': statics.setLong(staticsIdx, cp.getLong(idx)); break; case 'S': statics.setInt(staticsIdx, cp.getInt(idx)); break; case 'Z': statics.setInt(staticsIdx, cp.getInt(idx)); break; default: // throw new IllegalArgumentException("signature " // + signature); statics.setObject(staticsIdx, cp.getString(idx)); break; } } else { skip(data, length); } } } // Align the instance fields for minimal object size. if ((flags & NO_FIELD_ALIGNMENT) == 0) { final int alignedObjectSize = alignInstanceFields(ftable, slotSize); objectSize = alignedObjectSize; } cls.setFieldTable(ftable); if (objectSize > 0) { ((VmNormalClass<?>) cls).setObjectSize(objectSize); } } }
| 13,782
|
static Icon currentIcon(AbstractButton b) { Icon i = b.getIcon(); ButtonModel model = b.getModel(); if (model.isPressed() && b.getPressedIcon() != null) i = b.getPressedIcon(); else if (model.isRollover()) { if (b.isSelected() && b.getRolloverSelectedIcon() != null) i = b.getRolloverSelectedIcon(); else if (b.getRolloverIcon() != null) i = b.getRolloverIcon(); } else if (b.isSelected()) { if (b.isEnabled() && b.getSelectedIcon() != null) i = b.getSelectedIcon(); else if (b.getDisabledSelectedIcon() != null) i = b.getDisabledSelectedIcon(); } else if (! b.isEnabled() && b.getDisabledIcon() != null) i = b.getDisabledIcon(); return i; }
|
static Icon currentIcon(AbstractButton b) { Icon i = b.getIcon(); ButtonModel model = b.getModel(); if (model.isPressed() && b.getPressedIcon() != null && b.isEnabled()) i = b.getPressedIcon(); else if (model.isRollover()) { if (b.isSelected() && b.getRolloverSelectedIcon() != null) i = b.getRolloverSelectedIcon(); else if (b.getRolloverIcon() != null) i = b.getRolloverIcon(); } else if (b.isSelected()) { if (b.isEnabled() && b.getSelectedIcon() != null) i = b.getSelectedIcon(); else if (b.getDisabledSelectedIcon() != null) i = b.getDisabledSelectedIcon(); } else if (! b.isEnabled() && b.getDisabledIcon() != null) i = b.getDisabledIcon(); return i; }
| 13,783
|
static Icon currentIcon(AbstractButton b) { Icon i = b.getIcon(); ButtonModel model = b.getModel(); if (model.isPressed() && b.getPressedIcon() != null) i = b.getPressedIcon(); else if (model.isRollover()) { if (b.isSelected() && b.getRolloverSelectedIcon() != null) i = b.getRolloverSelectedIcon(); else if (b.getRolloverIcon() != null) i = b.getRolloverIcon(); } else if (b.isSelected()) { if (b.isEnabled() && b.getSelectedIcon() != null) i = b.getSelectedIcon(); else if (b.getDisabledSelectedIcon() != null) i = b.getDisabledSelectedIcon(); } else if (! b.isEnabled() && b.getDisabledIcon() != null) i = b.getDisabledIcon(); return i; }
|
static Icon currentIcon(AbstractButton b) { Icon i = b.getIcon(); ButtonModel model = b.getModel(); if (model.isPressed() && b.getPressedIcon() != null) i = b.getPressedIcon(); else if (model.isRollover()) { if (b.isSelected() && b.getRolloverSelectedIcon() != null) i = b.getRolloverSelectedIcon(); else if (b.getRolloverIcon() != null) i = b.getRolloverIcon(); } else if (b.isSelected() && b.isEnabled()) { if (b.isEnabled() && b.getSelectedIcon() != null) i = b.getSelectedIcon(); else if (b.getDisabledSelectedIcon() != null) i = b.getDisabledSelectedIcon(); } else if (! b.isEnabled() && b.getDisabledIcon() != null) i = b.getDisabledIcon(); return i; }
| 13,784
|
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
|
protected void installDefaults(AbstractButton b) { String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
| 13,785
|
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
|
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
| 13,786
|
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
|
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); String prefix = getPropertyPrefix(); b.setFont(defaults.getFont(prefix + "font")); focusColor = defaults.getColor(prefix + "focus"); b.setForeground(defaults.getColor(prefix + "foreground")); b.setBackground(defaults.getColor(prefix + "background")); b.setMargin(defaults.getInsets(prefix + "margin")); b.setBorder(defaults.getBorder(prefix + "border")); b.setIconTextGap(defaults.getInt(prefix + "textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get(prefix + "focusInputMap")); b.setRolloverEnabled(defaults.getBoolean(prefix + "rollover")); b.setOpaque(true); }
| 13,787
|
public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); Font f = c.getFont(); g.setFont(f); if (b.isBorderPainted()) SwingUtilities.calculateInnerArea(b, vr); else vr = SwingUtilities.getLocalBounds(b); String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), b.getText(), currentIcon(b), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), vr, ir, tr, b.getIconTextGap() + defaultTextShiftOffset); if ((b.getModel().isArmed() && b.getModel().isPressed()) || b.isSelected()) paintButtonPressed(g, b); paintIcon(g, c, ir); if (text != null) paintText(g, b, tr, text); if (b.isFocusOwner()) paintFocus(g, b, vr, tr, ir); }
|
public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); Font f = c.getFont(); g.setFont(f); if (b.isBorderPainted()) SwingUtilities.calculateInnerArea(b, vr); else vr = SwingUtilities.getLocalBounds(b); String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), b.getText(), currentIcon(b), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), vr, ir, tr, b.getIconTextGap() + defaultTextShiftOffset); if ((b.getModel().isArmed() && b.getModel().isPressed()) || b.isSelected()) paintButtonPressed(g, b); paintIcon(g, c, ir); if (text != null) paintText(g, b, tr, text); if (b.isFocusOwner() && b.isFocusPainted()) paintFocus(g, b, vr, tr, ir); }
| 13,788
|
public void contentsChanged(ListDataEvent e) { BasicListUI.this.damageLayout(); }
|
public void contentsChanged(ListDataEvent e) { list.revalidate(); }
| 13,789
|
public void intervalAdded(ListDataEvent e) { BasicListUI.this.damageLayout(); }
|
public void intervalAdded(ListDataEvent e) { list.revalidate(); }
| 13,790
|
public void intervalRemoved(ListDataEvent e) { BasicListUI.this.damageLayout(); }
|
public void intervalRemoved(ListDataEvent e) { list.revalidate(); }
| 13,791
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded |= modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,792
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded |= selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,793
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded |= fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,794
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded |= fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,795
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded |= fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,796
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded |= prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,797
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == BasicListUI.this.list) { if (e.getOldValue() != null && e.getOldValue() instanceof ListModel) ((ListModel) e.getOldValue()).removeListDataListener(BasicListUI.this.listDataListener); if (e.getNewValue() != null && e.getNewValue() instanceof ListModel) ((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener); } // Update the updateLayoutStateNeeded flag. if (e.getPropertyName().equals("model")) updateLayoutStateNeeded += modelChanged; else if (e.getPropertyName().equals("selectionModel")) updateLayoutStateNeeded += selectionModelChanged; else if (e.getPropertyName().equals("font")) updateLayoutStateNeeded += fontChanged; else if (e.getPropertyName().equals("fixedCellWidth")) updateLayoutStateNeeded += fixedCellWidthChanged; else if (e.getPropertyName().equals("fixedCellHeight")) updateLayoutStateNeeded += fixedCellHeightChanged; else if (e.getPropertyName().equals("prototypeCellValue")) updateLayoutStateNeeded += prototypeCellValueChanged; else if (e.getPropertyName().equals("cellRenderer")) updateLayoutStateNeeded += cellRendererChanged; BasicListUI.this.damageLayout(); }
| 13,798
|
protected int convertYToRow(int y0) { if (list.getModel().getSize() == 0) return -1; // When y0 < 0, then the JDK returns the maximum row index of the list. So // do we. if (y0 < 0) return list.getModel().getSize() - 1; // Update the layout if necessary. maybeUpdateLayoutState(); int index = list.getModel().getSize() - 1;; // If a fixed cell height is set, then we can work more efficient. if (cellHeight > 0) index = Math.min(y0 / cellHeight, index); // If we have no fixed cell height, we must add up each cell height up // to y0. else { int h = 0; for (int row = 0; row < cellHeights.length; ++row) { h += cellHeights[row]; if (y0 < h) { index = row; break; } } } return index; }
|
protected int convertYToRow(int y0) { if (list.getModel().getSize() == 0) return -1; // When y0 < 0, then the JDK returns the maximum row index of the list. So // do we. if (y0 < 0) return list.getModel().getSize() - 1; // Update the layout if necessary. maybeUpdateLayoutState(); int index = list.getModel().getSize() - 1; // If a fixed cell height is set, then we can work more efficient. if (cellHeight > 0) index = Math.min(y0 / cellHeight, index); // If we have no fixed cell height, we must add up each cell height up // to y0. else { int h = 0; for (int row = 0; row < cellHeights.length; ++row) { h += cellHeights[row]; if (y0 < h) { index = row; break; } } } return index; }
| 13,799
|
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int minIndex = Math.min(index1, index2); int maxIndex = Math.max(index1, index2); Point loc = indexToLocation(list, minIndex); Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth, getRowHeight(minIndex)); for (int i = minIndex + 1; i <= maxIndex; i++) { Point hiLoc = indexToLocation(list, i); Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, getRowHeight(i)); bounds = bounds.union(hibounds); } return bounds; }
|
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int minIndex = Math.min(index1, index2); int maxIndex = Math.max(index1, index2); Point loc = indexToLocation(list, minIndex); Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth, getCellHeight(minIndex)); for (int i = minIndex + 1; i <= maxIndex; i++) { Point hiLoc = indexToLocation(list, i); Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, getRowHeight(i)); bounds = bounds.union(hibounds); } return bounds; }
| 13,800
|
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int minIndex = Math.min(index1, index2); int maxIndex = Math.max(index1, index2); Point loc = indexToLocation(list, minIndex); Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth, getRowHeight(minIndex)); for (int i = minIndex + 1; i <= maxIndex; i++) { Point hiLoc = indexToLocation(list, i); Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, getRowHeight(i)); bounds = bounds.union(hibounds); } return bounds; }
|
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int minIndex = Math.min(index1, index2); int maxIndex = Math.max(index1, index2); Point loc = indexToLocation(list, minIndex); Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth, getRowHeight(minIndex)); for (int i = minIndex + 1; i <= maxIndex; i++) { Point hiLoc = indexToLocation(list, i); Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, getCellHeight(i)); bounds = bounds.union(hibounds); } return bounds; }
| 13,801
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
| 13,802
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
| 13,803
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { for (int i = 0; i < cellHeights.length; i++) maxCellHeight = Math.max(maxCellHeight, cellHeights[i]); } if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
| 13,804
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
| 13,805
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
|
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); int visibleRows = list.getVisibleRowCount(); int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
| 13,806
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList l, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,808
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int maxCellHeight = getCellHeight(0); int visibleRows = list.getHeight() / maxCellHeight; int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,809
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,810
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); else loc = new Point(0, convertRowToY(index)); break; return loc;
| 13,811
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY; locY = gridY * maxCellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,812
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,813
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
|
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } // compute coordinates inside the grid int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } // compute coordinates inside the grid if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * maxCellHeight2; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
| 13,814
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. //keyListener = new KeyHandler(); componentListener = new ComponentHandler(); list.addComponentListener(componentListener); //list.addKeyListener(keyListener); }
|
protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); list.addFocusListener(focusListener); if (listDataListener == null) listDataListener = createListDataListener(); list.getModel().addListDataListener(listDataListener); if (listSelectionListener == null) listSelectionListener = createListSelectionListener(); list.addListSelectionListener(listSelectionListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = createPropertyChangeListener(); list.addPropertyChangeListener(propertyChangeListener); // FIXME: Are these two really needed? At least they are not documented. //keyListener = new KeyHandler(); componentListener = new ComponentHandler(); list.addComponentListener(componentListener); //list.addKeyListener(keyListener); }
| 13,815
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList l, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,816
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int maxCellHeight = getCellHeight(0); int visibleRows = list.getHeight() / maxCellHeight; int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,817
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,818
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; catch (ArithmeticException ex) { cellsPerRow = 1; else { cellsPerRow = numberOfItems / visibleRows + 1; // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; return index;
| 13,819
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / maxCellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,820
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,821
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
|
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: // determine visible rows and cells per row int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } // determine index for the given location int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: // determine visible rows and cells per column int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / maxCellHeight2, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
| 13,822
|
protected void maybeUpdateLayoutState() { if (updateLayoutStateNeeded != 0) { updateLayoutState(); updateLayoutStateNeeded = 0; } }
|
protected void maybeUpdateLayoutState() { if (updateLayoutStateNeeded != 0 || !list.isValid()) { updateLayoutState(); updateLayoutStateNeeded = 0; } }
| 13,823
|
public void paint(Graphics g, JComponent c) { int nrows = list.getModel().getSize(); if (nrows == 0) return; maybeUpdateLayoutState(); ListCellRenderer render = list.getCellRenderer(); ListModel model = list.getModel(); ListSelectionModel sel = list.getSelectionModel(); int lead = sel.getLeadSelectionIndex(); Rectangle clip = g.getClipBounds(); int startIndex = list.locationToIndex(new Point(clip.x, clip.y)); int endIndex = list.locationToIndex(new Point(clip.x + clip.width, clip.y + clip.height)); for (int row = startIndex; row <= endIndex; ++row) { Rectangle bounds = getCellBounds(list, row, row); if (bounds.intersects(clip)) paintCell(g, row, bounds, render, model, sel, lead); } }
|
public void paint(Graphics g, JComponent c) { int nrows = list.getModel().getSize(); if (nrows == 0) return; maybeUpdateLayoutState(); ListCellRenderer render = list.getCellRenderer(); ListModel model = list.getModel(); ListSelectionModel sel = list.getSelectionModel(); int lead = sel.getLeadSelectionIndex(); Rectangle clip = g.getClipBounds(); int startIndex = list.locationToIndex(new Point(clip.x, clip.y)); int endIndex = list.locationToIndex(new Point(clip.x + clip.width, clip.y + clip.height)); for (int row = startIndex; row <= endIndex; ++row) { Rectangle bounds = getCellBounds(list, row, row); if (bounds.intersects(clip)) paintCell(g, row, bounds, render, model, sel, lead); } }
| 13,824
|
private static Color getColor(String s) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } catch(NumberFormatException nfe) { return null; } }
|
private static Color getColor(String colorName) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } catch(NumberFormatException nfe) { return null; } }
| 13,825
|
private static Color getColor(String s) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } catch(NumberFormatException nfe) { return null; } }
|
private static Color getColor(String s) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } catch(NumberFormatException nfe) { return null; } }
| 13,826
|
private static Color getColor(String s) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } catch(NumberFormatException nfe) { return null; } }
|
private static Color getColor(String s) { String s2 = (String)colorMap.get(s.toLowerCase()); if( s2 == null ) s2 = s; try { return Color.decode(s2); } } catch (Exception nex) { return null; } }
| 13,827
|
protected void initComponentDefaults(UIDefaults defaults) { super.initComponentDefaults(defaults); Object[] myDefaults = new Object[] { "Button.background", getControl(), "Button.border", MetalBorders.getButtonBorder(), "Button.darkShadow", getControlDarkShadow(), "Button.disabledText", getInactiveControlTextColor(), "Button.focus", getFocusColor(), "Button.font", getControlTextFont(), "Button.foreground", getControlTextColor(), "Button.highlight", getControlHighlight(), "Button.light", getControlHighlight(), "Button.margin", new Insets(2, 14, 2, 14), "Button.select", getControlShadow(), "Button.shadow", getControlShadow(), "CheckBox.background", getControl(), "CheckBox.border", MetalBorders.getButtonBorder(), "CheckBox.disabledText", getInactiveControlTextColor(), "CheckBox.focus", getFocusColor(), "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12), "CheckBox.foreground", getControlTextColor(), "CheckBox.icon", new UIDefaults.ProxyLazyValue ("javax.swing.plaf.metal.MetalCheckBoxIcon"), "CheckBox.checkIcon", new UIDefaults.ProxyLazyValue ("javax.swing.plaf.metal.MetalCheckBoxIcon"), "Checkbox.select", getControlShadow(), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(), "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "CheckBoxMenuItem.background", getMenuBackground(), "CheckBoxMenuItem.borderPainted", new Boolean(true), "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav", "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(), "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(), "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12), "CheckBoxMenuItem.foreground", getMenuForeground(), "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(), "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(), "ColorChooser.background", getControl(), "ColorChooser.foreground", getControlTextColor(), "ColorChooser.rgbBlueMnemonic", new Integer(0), "ColorChooser.rgbGreenMnemonic", new Integer(0), "ColorChooser.rgbRedMnemonic", new Integer(0), "ColorChooser.swatchesDefaultRecentColor", getControl(), "ComboBox.background", getControl(), "ComboBox.buttonBackground", getControl(), "ComboBox.buttonDarkShadow", getControlDarkShadow(), "ComboBox.buttonHighlight", getControlHighlight(), "ComboBox.buttonShadow", getControlShadow(), "ComboBox.disabledBackground", getControl(), "ComboBox.disabledForeground", getInactiveSystemTextColor(), "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12), "ComboBox.foreground", getControlTextColor(), "ComboBox.selectionBackground", getPrimaryControlShadow(), "ComboBox.selectionForeground", getControlTextColor(), "Desktop.background", getDesktopColor(), "DesktopIcon.background", getControl(), "DesktopIcon.foreground", getControlTextColor(), "DesktopIcon.width", new Integer(160), "DesktopIcon.border", MetalBorders.getDesktopIconBorder(), "EditorPane.background", getWindowBackground(), "EditorPane.caretForeground", getUserTextColor(), "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "EditorPane.foreground", getUserTextColor(), "EditorPane.inactiveForeground", getInactiveSystemTextColor(), "EditorPane.selectionBackground", getTextHighlightColor(), "EditorPane.selectionForeground", getHighlightedTextColor(), "FormattedTextField.background", getWindowBackground(), "FormattedTextField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "FormattedTextField.caretForeground", getUserTextColor(), "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "FormattedTextField.foreground", getUserTextColor(), "FormattedTextField.inactiveBackground", getControl(), "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(), "FormattedTextField.selectionBackground", getTextHighlightColor(), "FormattedTextField.selectionForeground", getHighlightedTextColor(), "InternalFrame.activeTitleBackground", getWindowTitleBackground(), "InternalFrame.activeTitleForeground", getWindowTitleForeground(), "InternalFrame.border", new MetalBorders.InternalFrameBorder(), "InternalFrame.borderColor", getControl(), "InternalFrame.borderDarkShadow", getControlDarkShadow(), "InternalFrame.borderHighlight", getControlHighlight(), "InternalFrame.borderLight", getControlHighlight(), "InternalFrame.borderShadow", getControlShadow(), "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(), "InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(16), "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(), "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(), "InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(16), "InternalFrame.iconifyIcon", MetalIconFactory.getInternalFrameMinimizeIcon(16), "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(), "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(), "InternalFrame.paletteTitleHeight", new Integer(11), "Label.background", getControl(), "Label.disabledForeground", getInactiveSystemTextColor(), "Label.disabledShadow", getControlShadow(), "Label.font", getControlTextFont(), "Label.foreground", getSystemTextColor(), "List.background", getWindowBackground(), "List.foreground", getUserTextColor(), "List.selectionBackground", getTextHighlightColor(), "List.selectionForeground", getHighlightedTextColor(), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "Menu.acceleratorForeground", getAcceleratorForeground(), "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "Menu.background", getMenuBackground(), "Menu.border", new MetalBorders.MenuItemBorder(), "Menu.borderPainted", Boolean.TRUE, "Menu.disabledForeground", getMenuDisabledForeground(), "Menu.font", getControlTextFont(), "Menu.foreground", getMenuForeground(), "Menu.selectionBackground", getMenuSelectedBackground(), "Menu.selectionForeground", getMenuSelectedForeground(), "MenuBar.background", getMenuBackground(), "MenuBar.border", new MetalBorders.MenuBarBorder(), "MenuBar.font", getControlTextFont(), "MenuBar.foreground", getMenuForeground(), "MenuBar.highlight", getControlHighlight(), "MenuBar.shadow", getControlShadow(), "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "MenuItem.acceleratorForeground", getAcceleratorForeground(), "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "MenuItem.background", getMenuBackground(), "MenuItem.border", new MetalBorders.MenuItemBorder(), "MenuItem.disabledForeground", getMenuDisabledForeground(), "MenuItem.font", getControlTextFont(), "MenuItem.foreground", getMenuForeground(), "MenuItem.selectionBackground", getMenuSelectedBackground(), "MenuItem.selectionForeground", getMenuSelectedForeground(), "OptionPane.background", getControl(), "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51), "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153), "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0), "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102), "OptionPane.foreground", getControlTextColor(), "OptionPane.messageForeground", getControlTextColor(), "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51), "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153), "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0), "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102), "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51), "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153), "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0), "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102), "Panel.background", getControl(), "Panel.foreground", getUserTextColor(), "PasswordField.background", getWindowBackground(), "PasswordField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "PasswordField.caretForeground", getUserTextColor(), "PasswordField.foreground", getUserTextColor(), "PasswordField.inactiveBackground", getControl(), "PasswordField.inactiveForeground", getInactiveSystemTextColor(), "PasswordField.selectionBackground", getTextHighlightColor(), "PasswordField.selectionForeground", getHighlightedTextColor(), "PopupMenu.background", getMenuBackground(), "PopupMenu.border", new MetalBorders.PopupMenuBorder(), "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12), "PopupMenu.foreground", getMenuForeground(), "ProgressBar.background", getControl(), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1), "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12), "ProgressBar.foreground", getPrimaryControlShadow(), "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(), "ProgressBar.selectionForeground", getControl(), "RadioButton.background", getControl(), "RadioButton.darkShadow", getControlDarkShadow(), "RadioButton.disabledText", getInactiveControlTextColor(), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return MetalIconFactory.getRadioButtonIcon(); } }, "RadioButton.focus", MetalLookAndFeel.getFocusColor(), "RadioButton.font", MetalLookAndFeel.getControlTextFont(), "RadioButton.foreground", getControlTextColor(), "RadioButton.highlight", getControlHighlight(), "RadioButton.light", getControlHighlight(), "RadioButton.select", getControlShadow(), "RadioButton.shadow", getControlShadow(), "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10), "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(), "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "RadioButtonMenuItem.background", getMenuBackground(), "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(), "RadioButtonMenuItem.borderPainted", Boolean.TRUE, "RadioButtonMenuItem.checkIcon", MetalIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(), "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(), "RadioButtonMenuItem.foreground", getMenuForeground(), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", MetalLookAndFeel.getMenuSelectedBackground(), "RadioButtonMenuItem.selectionForeground", MetalLookAndFeel.getMenuSelectedForeground(), "ScrollBar.background", getControl(), "ScrollBar.darkShadow", getControlDarkShadow(), "ScrollBar.foreground", getControl(), "ScrollBar.highlight", getControlHighlight(), "ScrollBar.shadow", getControlShadow(), "ScrollBar.thumb", getPrimaryControlShadow(), "ScrollBar.thumbDarkShadow", getControlDarkShadow(), "ScrollBar.thumbHighlight", getPrimaryControl(), "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(), "ScrollBar.track", getControl(), "ScrollBar.trackHighlight", getControlDarkShadow(), "ScrollPane.background", getControl(), "ScrollPane.border", new MetalBorders.ScrollPaneBorder(), "ScrollPane.foreground", getControlTextColor(), "Separator.background", getSeparatorBackground(), "Separator.foreground", getSeparatorForeground(), "Separator.highlight", getControlHighlight(), "Separator.shadow", getControlShadow(), "Slider.background", getControl(), "Slider.focus", getFocusColor(), "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0), "Slider.foreground", getPrimaryControlShadow(), "Slider.highlight", getControlHighlight(), "Slider.horizontalThumbIcon", MetalIconFactory.getHorizontalSliderThumbIcon(), "Slider.majorTickLength", new Integer(6), "Slider.shadow", getControlShadow(), "Slider.trackWidth", new Integer(7), "Slider.verticalThumbIcon", MetalIconFactory.getVerticalSliderThumbIcon(), "Spinner.background", getControl(), "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12), "Spinner.foreground", getControl(), "SplitPane.background", getControl(), "SplitPane.darkShadow", getControlDarkShadow(), "SplitPane.dividerFocusColor", getPrimaryControl(), "SplitPane.highlight", getControlHighlight(), "SplitPane.shadow", getControlShadow(), "SplitPaneDivider.draggingColor", Color.DARK_GRAY, "TabbedPane.background", getControlShadow(), "TabbedPane.darkShadow", getControlDarkShadow(), "TabbedPane.focus", getPrimaryControlDarkShadow(), "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12), "TabbedPane.foreground", getControlTextColor(), "TabbedPane.highlight", getControlHighlight(), "TabbedPane.light", getControl(), "TabbedPane.selected", getControl(), "TabbedPane.selectHighlight", getControlHighlight(), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", getControlShadow(), "TabbedPane.tabAreaBackground", getControl(), "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6), "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9), "Table.background", getWindowBackground(), "Table.focusCellBackground", getWindowBackground(), "Table.focusCellForeground", getControlTextColor(), "Table.foreground", getControlTextColor(), "Table.focusCellHighlightBorder", getControlShadow(), "Table.focusCellBackground", getWindowBackground(), "Table.gridColor", getControlDarkShadow(), "Table.selectionBackground", new ColorUIResource(204, 204, 255), "Table.selectionForeground", new ColorUIResource(0, 0, 0), "TableHeader.background", getControl(), "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(), "TableHeader.foreground", getControlTextColor(), "TextArea.background", getWindowBackground(), "TextArea.caretForeground", getUserTextColor(), "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextArea.foreground", getUserTextColor(), "TextArea.inactiveForeground", getInactiveSystemTextColor(), "TextArea.selectionBackground", getTextHighlightColor(), "TextArea.selectionForeground", getHighlightedTextColor(), "TextField.background", getWindowBackground(), "TextField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "TextField.caretForeground", getUserTextColor(), "TextField.darkShadow", getControlDarkShadow(), "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextField.foreground", getUserTextColor(), "TextField.highlight", getControlHighlight(), "TextField.inactiveBackground", getControl(), "TextField.inactiveForeground", getInactiveSystemTextColor(), "TextField.light", getControlHighlight(), "TextField.selectionBackground", getTextHighlightColor(), "TextField.selectionForeground", getHighlightedTextColor(), "TextField.shadow", getControlShadow(), "TextPane.background", getWindowBackground(), "TextPane.caretForeground", getUserTextColor(), "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextPane.foreground", getUserTextColor(), "TextPane.inactiveForeground", getInactiveSystemTextColor(), "TextPane.selectionBackground", getTextHighlightColor(), "TextPane.selectionForeground", getHighlightedTextColor(), "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12), "TitledBorder.titleColor", getSystemTextColor(), "ToggleButton.background", getControl(), "ToggleButton.border", MetalBorders.getToggleButtonBorder(), "ToggleButton.darkShadow", getControlDarkShadow(), "ToggleButton.disabledText", getInactiveControlTextColor(), "ToggleButton.focus", getFocusColor(), "ToggleButton.font", getControlTextFont(), "ToggleButton.foreground", getControlTextColor(), "ToggleButton.highlight", getControlHighlight(), "ToggleButton.light", getControlHighlight(), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.select", getControlShadow(), "ToggleButton.shadow", getControlShadow(), "ToolBar.background", getMenuBackground(), "ToolBar.darkShadow", getControlDarkShadow(), "ToolBar.dockingBackground", getMenuBackground(), "ToolBar.dockingForeground", getPrimaryControlDarkShadow(), "ToolBar.floatingBackground", getMenuBackground(), "ToolBar.floatingForeground", getPrimaryControl(), "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12), "ToolBar.foreground", getMenuForeground(), "ToolBar.highlight", getControlHighlight(), "ToolBar.light", getControlHighlight(), "ToolBar.shadow", getControlShadow(), "ToolBar.border", new MetalBorders.ToolBarBorder(), "ToolTip.background", getPrimaryControl(), "ToolTip.backgroundInactive", getControl(), "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1), "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1), "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolTip.foreground", getPrimaryControlInfo(), "ToolTip.foregroundInactive", getControlDarkShadow(), "Tree.background", getWindowBackground(), "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true), "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false), "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Tree.foreground", getUserTextColor(), "Tree.hash", getPrimaryControl(), "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(), "Tree.leftChildIndent", new Integer(7), "Tree.line", getPrimaryControl(), "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", getTextHighlightColor(), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)), "Tree.selectionBorderColor", getFocusColor(), "Tree.selectionForeground", getHighlightedTextColor(), "Tree.textBackground", getWindowBackground(), "Tree.textForeground", getUserTextColor(), "Viewport.background", getControl(), "Viewport.foreground", getUserTextColor() }; defaults.putDefaults(myDefaults); }
|
protected void initComponentDefaults(UIDefaults defaults) { super.initComponentDefaults(defaults); Object[] myDefaults = new Object[] { "Button.background", getControl(), "Button.border", MetalBorders.getButtonBorder(), "Button.darkShadow", getControlDarkShadow(), "Button.disabledText", getInactiveControlTextColor(), "Button.focus", getFocusColor(), "Button.font", getControlTextFont(), "Button.foreground", getControlTextColor(), "Button.highlight", getControlHighlight(), "Button.light", getControlHighlight(), "Button.margin", new Insets(2, 14, 2, 14), "Button.select", getControlShadow(), "Button.shadow", getControlShadow(), "CheckBox.background", getControl(), "CheckBox.border", MetalBorders.getButtonBorder(), "CheckBox.disabledText", getInactiveControlTextColor(), "CheckBox.focus", getFocusColor(), "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12), "CheckBox.foreground", getControlTextColor(), "CheckBox.icon", new UIDefaults.ProxyLazyValue ("javax.swing.plaf.metal.MetalCheckBoxIcon"), "CheckBox.checkIcon", new UIDefaults.ProxyLazyValue ("javax.swing.plaf.metal.MetalCheckBoxIcon"), "Checkbox.select", getControlShadow(), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(), "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "CheckBoxMenuItem.background", getMenuBackground(), "CheckBoxMenuItem.borderPainted", new Boolean(true), "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav", "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(), "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(), "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12), "CheckBoxMenuItem.foreground", getMenuForeground(), "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(), "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(), "ColorChooser.background", getControl(), "ColorChooser.foreground", getControlTextColor(), "ColorChooser.rgbBlueMnemonic", new Integer(0), "ColorChooser.rgbGreenMnemonic", new Integer(0), "ColorChooser.rgbRedMnemonic", new Integer(0), "ColorChooser.swatchesDefaultRecentColor", getControl(), "ComboBox.background", getControl(), "ComboBox.buttonBackground", getControl(), "ComboBox.buttonDarkShadow", getControlDarkShadow(), "ComboBox.buttonHighlight", getControlHighlight(), "ComboBox.buttonShadow", getControlShadow(), "ComboBox.disabledBackground", getControl(), "ComboBox.disabledForeground", getInactiveSystemTextColor(), "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12), "ComboBox.foreground", getControlTextColor(), "ComboBox.selectionBackground", getPrimaryControlShadow(), "ComboBox.selectionForeground", getControlTextColor(), "Desktop.background", getDesktopColor(), "DesktopIcon.background", getControl(), "DesktopIcon.foreground", getControlTextColor(), "DesktopIcon.width", new Integer(160), "DesktopIcon.border", MetalBorders.getDesktopIconBorder(), "EditorPane.background", getWindowBackground(), "EditorPane.caretForeground", getUserTextColor(), "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "EditorPane.foreground", getUserTextColor(), "EditorPane.inactiveForeground", getInactiveSystemTextColor(), "EditorPane.selectionBackground", getTextHighlightColor(), "EditorPane.selectionForeground", getHighlightedTextColor(), "FormattedTextField.background", getWindowBackground(), "FormattedTextField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "FormattedTextField.caretForeground", getUserTextColor(), "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "FormattedTextField.foreground", getUserTextColor(), "FormattedTextField.inactiveBackground", getControl(), "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(), "FormattedTextField.selectionBackground", getTextHighlightColor(), "FormattedTextField.selectionForeground", getHighlightedTextColor(), "InternalFrame.activeTitleBackground", getWindowTitleBackground(), "InternalFrame.activeTitleForeground", getWindowTitleForeground(), "InternalFrame.border", new MetalBorders.InternalFrameBorder(), "InternalFrame.borderColor", getControl(), "InternalFrame.borderDarkShadow", getControlDarkShadow(), "InternalFrame.borderHighlight", getControlHighlight(), "InternalFrame.borderLight", getControlHighlight(), "InternalFrame.borderShadow", getControlShadow(), "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(), "InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(16), "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(), "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(), "InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(16), "InternalFrame.iconifyIcon", MetalIconFactory.getInternalFrameMinimizeIcon(16), "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(), "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(), "InternalFrame.paletteTitleHeight", new Integer(11), "Label.background", getControl(), "Label.disabledForeground", getInactiveSystemTextColor(), "Label.disabledShadow", getControlShadow(), "Label.font", getControlTextFont(), "Label.foreground", getSystemTextColor(), "List.background", getWindowBackground(), "List.foreground", getUserTextColor(), "List.selectionBackground", getTextHighlightColor(), "List.selectionForeground", getHighlightedTextColor(), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "Menu.acceleratorForeground", getAcceleratorForeground(), "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "Menu.background", getMenuBackground(), "Menu.border", new MetalBorders.MenuItemBorder(), "Menu.borderPainted", Boolean.TRUE, "Menu.disabledForeground", getMenuDisabledForeground(), "Menu.font", getControlTextFont(), "Menu.foreground", getMenuForeground(), "Menu.selectionBackground", getMenuSelectedBackground(), "Menu.selectionForeground", getMenuSelectedForeground(), "MenuBar.background", getMenuBackground(), "MenuBar.border", new MetalBorders.MenuBarBorder(), "MenuBar.font", getControlTextFont(), "MenuBar.foreground", getMenuForeground(), "MenuBar.highlight", getControlHighlight(), "MenuBar.shadow", getControlShadow(), "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10), "MenuItem.acceleratorForeground", getAcceleratorForeground(), "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "MenuItem.background", getMenuBackground(), "MenuItem.border", new MetalBorders.MenuItemBorder(), "MenuItem.disabledForeground", getMenuDisabledForeground(), "MenuItem.font", getControlTextFont(), "MenuItem.foreground", getMenuForeground(), "MenuItem.selectionBackground", getMenuSelectedBackground(), "MenuItem.selectionForeground", getMenuSelectedForeground(), "OptionPane.background", getControl(), "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51), "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153), "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0), "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102), "OptionPane.foreground", getControlTextColor(), "OptionPane.messageForeground", getControlTextColor(), "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51), "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153), "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0), "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102), "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51), "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153), "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0), "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102), "Panel.background", getControl(), "Panel.foreground", getUserTextColor(), "PasswordField.background", getWindowBackground(), "PasswordField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "PasswordField.caretForeground", getUserTextColor(), "PasswordField.foreground", getUserTextColor(), "PasswordField.inactiveBackground", getControl(), "PasswordField.inactiveForeground", getInactiveSystemTextColor(), "PasswordField.selectionBackground", getTextHighlightColor(), "PasswordField.selectionForeground", getHighlightedTextColor(), "PopupMenu.background", getMenuBackground(), "PopupMenu.border", new MetalBorders.PopupMenuBorder(), "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12), "PopupMenu.foreground", getMenuForeground(), "ProgressBar.background", getControl(), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1), "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12), "ProgressBar.foreground", getPrimaryControlShadow(), "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(), "ProgressBar.selectionForeground", getControl(), "RadioButton.background", getControl(), "RadioButton.darkShadow", getControlDarkShadow(), "RadioButton.disabledText", getInactiveControlTextColor(), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return MetalIconFactory.getRadioButtonIcon(); } }, "RadioButton.focus", MetalLookAndFeel.getFocusColor(), "RadioButton.font", MetalLookAndFeel.getControlTextFont(), "RadioButton.foreground", getControlTextColor(), "RadioButton.highlight", getControlHighlight(), "RadioButton.light", getControlHighlight(), "RadioButton.select", getControlShadow(), "RadioButton.shadow", getControlShadow(), "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10), "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(), "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(), "RadioButtonMenuItem.background", getMenuBackground(), "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(), "RadioButtonMenuItem.borderPainted", Boolean.TRUE, "RadioButtonMenuItem.checkIcon", MetalIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(), "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(), "RadioButtonMenuItem.foreground", getMenuForeground(), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", MetalLookAndFeel.getMenuSelectedBackground(), "RadioButtonMenuItem.selectionForeground", MetalLookAndFeel.getMenuSelectedForeground(), "ScrollBar.background", getControl(), "ScrollBar.darkShadow", getControlDarkShadow(), "ScrollBar.foreground", getControl(), "ScrollBar.highlight", getControlHighlight(), "ScrollBar.shadow", getControlShadow(), "ScrollBar.thumb", getPrimaryControlShadow(), "ScrollBar.thumbDarkShadow", getControlDarkShadow(), "ScrollBar.thumbHighlight", getPrimaryControl(), "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(), "ScrollBar.track", getControl(), "ScrollBar.trackHighlight", getControlDarkShadow(), "ScrollPane.background", getControl(), "ScrollPane.border", new MetalBorders.ScrollPaneBorder(), "ScrollPane.foreground", getControlTextColor(), "Separator.background", getSeparatorBackground(), "Separator.foreground", getSeparatorForeground(), "Separator.highlight", getControlHighlight(), "Separator.shadow", getControlShadow(), "Slider.background", getControl(), "Slider.focus", getFocusColor(), "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0), "Slider.foreground", getPrimaryControlShadow(), "Slider.highlight", getControlHighlight(), "Slider.horizontalThumbIcon", MetalIconFactory.getHorizontalSliderThumbIcon(), "Slider.majorTickLength", new Integer(6), "Slider.shadow", getControlShadow(), "Slider.trackWidth", new Integer(7), "Slider.verticalThumbIcon", MetalIconFactory.getVerticalSliderThumbIcon(), "Spinner.background", getControl(), "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12), "Spinner.foreground", getControl(), "SplitPane.background", getControl(), "SplitPane.darkShadow", getControlDarkShadow(), "SplitPane.dividerFocusColor", getPrimaryControl(), "SplitPane.highlight", getControlHighlight(), "SplitPane.shadow", getControlShadow(), "SplitPaneDivider.draggingColor", Color.DARK_GRAY, "TabbedPane.background", getControlShadow(), "TabbedPane.darkShadow", getControlDarkShadow(), "TabbedPane.focus", getPrimaryControlDarkShadow(), "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12), "TabbedPane.foreground", getControlTextColor(), "TabbedPane.highlight", getControlHighlight(), "TabbedPane.light", getControl(), "TabbedPane.selected", getControl(), "TabbedPane.selectHighlight", getControlHighlight(), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", getControlShadow(), "TabbedPane.tabAreaBackground", getControl(), "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6), "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9), "Table.background", getWindowBackground(), "Table.focusCellBackground", getWindowBackground(), "Table.focusCellForeground", getControlTextColor(), "Table.foreground", getControlTextColor(), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource(getControlShadow()), "Table.focusCellBackground", getWindowBackground(), "Table.gridColor", getControlDarkShadow(), "Table.selectionBackground", new ColorUIResource(204, 204, 255), "Table.selectionForeground", new ColorUIResource(0, 0, 0), "TableHeader.background", getControl(), "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(), "TableHeader.foreground", getControlTextColor(), "TextArea.background", getWindowBackground(), "TextArea.caretForeground", getUserTextColor(), "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextArea.foreground", getUserTextColor(), "TextArea.inactiveForeground", getInactiveSystemTextColor(), "TextArea.selectionBackground", getTextHighlightColor(), "TextArea.selectionForeground", getHighlightedTextColor(), "TextField.background", getWindowBackground(), "TextField.border", new BorderUIResource(MetalBorders.getTextFieldBorder()), "TextField.caretForeground", getUserTextColor(), "TextField.darkShadow", getControlDarkShadow(), "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextField.foreground", getUserTextColor(), "TextField.highlight", getControlHighlight(), "TextField.inactiveBackground", getControl(), "TextField.inactiveForeground", getInactiveSystemTextColor(), "TextField.light", getControlHighlight(), "TextField.selectionBackground", getTextHighlightColor(), "TextField.selectionForeground", getHighlightedTextColor(), "TextField.shadow", getControlShadow(), "TextPane.background", getWindowBackground(), "TextPane.caretForeground", getUserTextColor(), "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TextPane.foreground", getUserTextColor(), "TextPane.inactiveForeground", getInactiveSystemTextColor(), "TextPane.selectionBackground", getTextHighlightColor(), "TextPane.selectionForeground", getHighlightedTextColor(), "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12), "TitledBorder.titleColor", getSystemTextColor(), "ToggleButton.background", getControl(), "ToggleButton.border", MetalBorders.getToggleButtonBorder(), "ToggleButton.darkShadow", getControlDarkShadow(), "ToggleButton.disabledText", getInactiveControlTextColor(), "ToggleButton.focus", getFocusColor(), "ToggleButton.font", getControlTextFont(), "ToggleButton.foreground", getControlTextColor(), "ToggleButton.highlight", getControlHighlight(), "ToggleButton.light", getControlHighlight(), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.select", getControlShadow(), "ToggleButton.shadow", getControlShadow(), "ToolBar.background", getMenuBackground(), "ToolBar.darkShadow", getControlDarkShadow(), "ToolBar.dockingBackground", getMenuBackground(), "ToolBar.dockingForeground", getPrimaryControlDarkShadow(), "ToolBar.floatingBackground", getMenuBackground(), "ToolBar.floatingForeground", getPrimaryControl(), "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12), "ToolBar.foreground", getMenuForeground(), "ToolBar.highlight", getControlHighlight(), "ToolBar.light", getControlHighlight(), "ToolBar.shadow", getControlShadow(), "ToolBar.border", new MetalBorders.ToolBarBorder(), "ToolTip.background", getPrimaryControl(), "ToolTip.backgroundInactive", getControl(), "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1), "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1), "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolTip.foreground", getPrimaryControlInfo(), "ToolTip.foregroundInactive", getControlDarkShadow(), "Tree.background", getWindowBackground(), "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true), "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false), "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Tree.foreground", getUserTextColor(), "Tree.hash", getPrimaryControl(), "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(), "Tree.leftChildIndent", new Integer(7), "Tree.line", getPrimaryControl(), "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", getTextHighlightColor(), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)), "Tree.selectionBorderColor", getFocusColor(), "Tree.selectionForeground", getHighlightedTextColor(), "Tree.textBackground", getWindowBackground(), "Tree.textForeground", getUserTextColor(), "Viewport.background", getControl(), "Viewport.foreground", getUserTextColor() }; defaults.putDefaults(myDefaults); }
| 13,828
|
public DefaultTreeSelectionModel() { setSelectionMode(SINGLE_TREE_SELECTION); listenerList = new EventListenerList(); }
|
public DefaultTreeSelectionModel() { setSelectionMode(DISCONTIGUOUS_TREE_SELECTION); listenerList = new EventListenerList(); }
| 13,829
|
public void _read(cdrInput c) throws IOException, BAD_PARAM { int endian; endian = c.read_long(); if (endian != 0) throw new BAD_PARAM("Little endian is not yet supported", FAILED, CompletionStatus.COMPLETED_NO ); _read_no_endian(c); }
|
public void _read(cdrInput c) throws IOException, BAD_PARAM { int endian; endian = c.read_long(); if (endian != 0) throw new BAD_PARAM("Little endian is not yet supported", FAILED, CompletionStatus.COMPLETED_NO ); _read_no_endian(c); }
| 13,830
|
public static int[] read(InputStream input) { ULongSeqHolder h = new ULongSeqHolder(); h._read(input); return h.value; }
|
public static int[] read(InputStream input) { ULongSeqHolder h = new ULongSeqHolder(); h._read(input); return h.value; }
| 13,832
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.