bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public static void write(OutputStream output, int[] value) { ULongSeqHolder h = new ULongSeqHolder(value); h._write(output); }
public static void write(OutputStream output, int[] value) { ULongSeqHolder h = new ULongSeqHolder(value); h._write(output); }
13,833
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
13,834
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
13,835
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(commandLine.toStringArray()); if (cmdLine.size() == 0) { Collection<String> resolvers = ResolverImpl.getDnsServers(); if( resolvers == null ) System.out.println("No DNS servers found."); else { System.out.println("DNS servers"); for (String dnsServer : resolvers) { System.out.println(dnsServer); } } } else { String func = ARG_FUNCTION.getValue(cmdLine); IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine); if (FUNC_ADD.equals(func)) { ResolverImpl.addDnsServer(server); } else if (FUNC_DEL.equals(func)) { ResolverImpl.removeDnsServer(server); } } System.out.println(); }
13,836
public AudioClip getAudioClip(URL url) { try { return (url.openConnection() != null ? DUMMY_CLIP : null); } catch (IOException ioe) { return null; } }
public AudioClip getAudioClip(URL url) { try { return (url.openConnection() != null ? DUMMY_CLIP : null); } catch (IOException ioe) { return null; } }
13,837
public void keyPressed(KeyboardEvent e) { int k = e.getKeyCode(); if(e.isControlDown()) switch (k) { case KeyEvent.VK_UP: {if(fy > 0) fy --; break;} case KeyEvent.VK_DOWN: {if(fy < my() - cym) fy ++; break;} case KeyEvent.VK_LEFT: {if(fx > 0) fx --; break;} case KeyEvent.VK_RIGHT: {if(fx < mx()) fx ++; break;} case KeyEvent.VK_HOME: {cx = fx = cy = fy = 0; break;} case KeyEvent.VK_END: { if(my() < cym) cy = my(); else {cy = cym; fy = my() - cy;}; end(); break;} case KeyEvent.VK_Y: { ls.remove(oy()); if(oy() > my()) cy --; break;} case KeyEvent.VK_S: { saveFile(); break;} case KeyEvent.VK_X: { console.getManager().unregisterConsole(console); break;} } else out: switch (k) { case KeyEvent.VK_UP: { cursorUp(); break;} case KeyEvent.VK_DOWN: {cursorDown();break;} case KeyEvent.VK_LEFT: {if(cx > 0) cx--; else if(fx > 0) fx --; else if(cursorUp()) end(); break;} case KeyEvent.VK_RIGHT: {if(ox() < mx()) if(cx < cxm) cx++; else fx ++; else if(cursorDown()) {cx = 0; fx = 0; } break;} case KeyEvent.VK_HOME: {cx = fx = 0; break;} case KeyEvent.VK_END: { end(); break;} case KeyEvent.VK_PAGE_UP: {if(fy > cym) fy -= cym; else fy = 0; break;} case KeyEvent.VK_PAGE_DOWN: {if(my() - fy > cym) fy +=cym; break;} default: char c = e.getKeyChar(); if(c == 0) return; if(cy == ls.size()) ls.add(new StringBuilder()); StringBuilder l = ls.get(oy()); switch(k){ case KeyEvent.VK_ENTER: {c = '\n';ls.add(oy() + 1, new StringBuilder()); break;} case KeyEvent.VK_DELETE: { if(cx == mx()) { if(cy < my()){ l.deleteCharAt(l.length() - 1).append(ls.remove(oy() + 1)); } } else if(cx < mx()) l.deleteCharAt(ox()); break out; } case KeyEvent.VK_BACK_SPACE: { if(ox() == 0) { if(cy > 0){ StringBuilder l2 = ls.get(oy() - 1); cx = l2.length() - 1; l2.deleteCharAt(l2.length() - 1).append(ls.remove(oy())); cy --; } } else if(cx > 0){ cx --; l.deleteCharAt(ox()); } else { fx --; l.deleteCharAt(ox()); } break out; } } if(cx == l.length()) l.append(c); else l.insert(ox(), c); if(c == '\n' ) { if(cy < cym) cy ++; else fy ++; if(cx < l.length() + 1){ StringBuilder l2 = ls.get(oy()); l2.append(l, ox() + 1, l.length()); l.delete(ox() + 1, l.length()); } cx = fx = 0; } else { if(cx == cxm) fx ++; else cx ++; } } if(oy() > cym && cy < 0){ cy = cym; fy = my() - cy; } if(oy() > my()){ fy -= oy() - my(); } if(ox() > mx()) { if(mx() > cxm){ cx = cxm; fx = mx() - cx; } else { cx = mx(); fx = 0; } } updateScreen(); }
public void keyPressed(KeyboardEvent e) { int k = e.getKeyCode(); if(e.isControlDown()) switch (k) { case KeyEvent.VK_UP: {if(fy > 0) fy --; break;} case KeyEvent.VK_DOWN: {if(fy < my() - cym) fy ++; break;} case KeyEvent.VK_LEFT: {if(fx > 0) fx --; break;} case KeyEvent.VK_RIGHT: {if(fx < mx()) fx ++; break;} case KeyEvent.VK_HOME: {cx = fx = cy = fy = 0; break;} case KeyEvent.VK_END: { if(my() < cym) cy = my(); else {cy = cym; fy = my() - cy;}; end(); break;} case KeyEvent.VK_Y: { ls.remove(oy()); if(oy() > my()) cy --; break;} case KeyEvent.VK_S: { saveFile(); break;} case KeyEvent.VK_Q: { console.getManager().unregisterConsole(console); break;} } else out: switch (k) { case KeyEvent.VK_UP: { cursorUp(); break;} case KeyEvent.VK_DOWN: {cursorDown();break;} case KeyEvent.VK_LEFT: {if(cx > 0) cx--; else if(fx > 0) fx --; else if(cursorUp()) end(); break;} case KeyEvent.VK_RIGHT: {if(ox() < mx()) if(cx < cxm) cx++; else fx ++; else if(cursorDown()) {cx = 0; fx = 0; } break;} case KeyEvent.VK_HOME: {cx = fx = 0; break;} case KeyEvent.VK_END: { end(); break;} case KeyEvent.VK_PAGE_UP: {if(fy > cym) fy -= cym; else fy = 0; break;} case KeyEvent.VK_PAGE_DOWN: {if(my() - fy > cym) fy +=cym; break;} default: char c = e.getKeyChar(); if(c == 0) return; if(cy == ls.size()) ls.add(new StringBuilder()); StringBuilder l = ls.get(oy()); switch(k){ case KeyEvent.VK_ENTER: {c = '\n';ls.add(oy() + 1, new StringBuilder()); break;} case KeyEvent.VK_DELETE: { if(cx == mx()) { if(cy < my()){ l.deleteCharAt(l.length() - 1).append(ls.remove(oy() + 1)); } } else if(cx < mx()) l.deleteCharAt(ox()); break out; } case KeyEvent.VK_BACK_SPACE: { if(ox() == 0) { if(cy > 0){ StringBuilder l2 = ls.get(oy() - 1); cx = l2.length() - 1; l2.deleteCharAt(l2.length() - 1).append(ls.remove(oy())); cy --; } } else if(cx > 0){ cx --; l.deleteCharAt(ox()); } else { fx --; l.deleteCharAt(ox()); } break out; } } if(cx == l.length()) l.append(c); else l.insert(ox(), c); if(c == '\n' ) { if(cy < cym) cy ++; else fy ++; if(cx < l.length() + 1){ StringBuilder l2 = ls.get(oy()); l2.append(l, ox() + 1, l.length()); l.delete(ox() + 1, l.length()); } cx = fx = 0; } else { if(cx == cxm) fx ++; else cx ++; } } if(oy() > cym && cy < 0){ cy = cym; fy = my() - cy; } if(oy() > my()){ fy -= oy() - my(); } if(ox() > mx()) { if(mx() > cxm){ cx = cxm; fx = mx() - cx; } else { cx = mx(); fx = 0; } } updateScreen(); }
13,838
public void keyPressed(KeyboardEvent e) { int k = e.getKeyCode(); if(e.isControlDown()) switch (k) { case KeyEvent.VK_UP: {if(fy > 0) fy --; break;} case KeyEvent.VK_DOWN: {if(fy < my() - cym) fy ++; break;} case KeyEvent.VK_LEFT: {if(fx > 0) fx --; break;} case KeyEvent.VK_RIGHT: {if(fx < mx()) fx ++; break;} case KeyEvent.VK_HOME: {cx = fx = cy = fy = 0; break;} case KeyEvent.VK_END: { if(my() < cym) cy = my(); else {cy = cym; fy = my() - cy;}; end(); break;} case KeyEvent.VK_Y: { ls.remove(oy()); if(oy() > my()) cy --; break;} case KeyEvent.VK_S: { saveFile(); break;} case KeyEvent.VK_X: { console.getManager().unregisterConsole(console); break;} } else out: switch (k) { case KeyEvent.VK_UP: { cursorUp(); break;} case KeyEvent.VK_DOWN: {cursorDown();break;} case KeyEvent.VK_LEFT: {if(cx > 0) cx--; else if(fx > 0) fx --; else if(cursorUp()) end(); break;} case KeyEvent.VK_RIGHT: {if(ox() < mx()) if(cx < cxm) cx++; else fx ++; else if(cursorDown()) {cx = 0; fx = 0; } break;} case KeyEvent.VK_HOME: {cx = fx = 0; break;} case KeyEvent.VK_END: { end(); break;} case KeyEvent.VK_PAGE_UP: {if(fy > cym) fy -= cym; else fy = 0; break;} case KeyEvent.VK_PAGE_DOWN: {if(my() - fy > cym) fy +=cym; break;} default: char c = e.getKeyChar(); if(c == 0) return; if(cy == ls.size()) ls.add(new StringBuilder()); StringBuilder l = ls.get(oy()); switch(k){ case KeyEvent.VK_ENTER: {c = '\n';ls.add(oy() + 1, new StringBuilder()); break;} case KeyEvent.VK_DELETE: { if(cx == mx()) { if(cy < my()){ l.deleteCharAt(l.length() - 1).append(ls.remove(oy() + 1)); } } else if(cx < mx()) l.deleteCharAt(ox()); break out; } case KeyEvent.VK_BACK_SPACE: { if(ox() == 0) { if(cy > 0){ StringBuilder l2 = ls.get(oy() - 1); cx = l2.length() - 1; l2.deleteCharAt(l2.length() - 1).append(ls.remove(oy())); cy --; } } else if(cx > 0){ cx --; l.deleteCharAt(ox()); } else { fx --; l.deleteCharAt(ox()); } break out; } } if(cx == l.length()) l.append(c); else l.insert(ox(), c); if(c == '\n' ) { if(cy < cym) cy ++; else fy ++; if(cx < l.length() + 1){ StringBuilder l2 = ls.get(oy()); l2.append(l, ox() + 1, l.length()); l.delete(ox() + 1, l.length()); } cx = fx = 0; } else { if(cx == cxm) fx ++; else cx ++; } } if(oy() > cym && cy < 0){ cy = cym; fy = my() - cy; } if(oy() > my()){ fy -= oy() - my(); } if(ox() > mx()) { if(mx() > cxm){ cx = cxm; fx = mx() - cx; } else { cx = mx(); fx = 0; } } updateScreen(); }
public void keyPressed(KeyboardEvent e) { int k = e.getKeyCode(); if(e.isControlDown()) switch (k) { case KeyEvent.VK_UP: {if(fy > 0) fy --; break;} case KeyEvent.VK_DOWN: {if(fy < my() - cym) fy ++; break;} case KeyEvent.VK_LEFT: {if(fx > 0) fx --; break;} case KeyEvent.VK_RIGHT: {if(fx < mx()) fx ++; break;} case KeyEvent.VK_HOME: {cx = fx = cy = fy = 0; break;} case KeyEvent.VK_END: { if(my() < cym) cy = my(); else {cy = cym; fy = my() - cy;}; end(); break;} case KeyEvent.VK_Y: { ls.remove(oy()); if(oy() > my()) cy --; break;} case KeyEvent.VK_S: { saveFile(); break;} case KeyEvent.VK_X: { console.getManager().unregisterConsole(console); break;} } else out: switch (k) { case KeyEvent.VK_UP: { cursorUp(); break;} case KeyEvent.VK_DOWN: {cursorDown();break;} case KeyEvent.VK_LEFT: {if(cx > 0) cx--; else if(fx > 0) fx --; else if(cursorUp()) end(); break;} case KeyEvent.VK_RIGHT: {if(ox() < mx()) if(cx < cxm) cx++; else fx ++; else if(cursorDown()) {cx = 0; fx = 0; } break;} case KeyEvent.VK_HOME: {cx = fx = 0; break;} case KeyEvent.VK_END: { end(); break;} case KeyEvent.VK_PAGE_UP: {if(fy > cym) fy -= cym; else fy = 0; break;} case KeyEvent.VK_PAGE_DOWN: {if(my() - fy > cym) fy +=cym; break;} default: char c = e.getKeyChar(); if(c == 0 && k != KeyEvent.VK_DELETE) return; if(cy == ls.size()) ls.add(new StringBuilder()); StringBuilder l = ls.get(oy()); switch(k){ case KeyEvent.VK_ENTER: {c = '\n';ls.add(oy() + 1, new StringBuilder()); break;} case KeyEvent.VK_DELETE: { if(cx == mx()) { if(cy < my()){ l.deleteCharAt(l.length() - 1).append(ls.remove(oy() + 1)); } } else if(cx < mx()) l.deleteCharAt(ox()); break out; } case KeyEvent.VK_BACK_SPACE: { if(ox() == 0) { if(cy > 0){ StringBuilder l2 = ls.get(oy() - 1); cx = l2.length() - 1; l2.deleteCharAt(l2.length() - 1).append(ls.remove(oy())); cy --; } } else if(cx > 0){ cx --; l.deleteCharAt(ox()); } else { fx --; l.deleteCharAt(ox()); } break out; } } if(cx == l.length()) l.append(c); else l.insert(ox(), c); if(c == '\n' ) { if(cy < cym) cy ++; else fy ++; if(cx < l.length() + 1){ StringBuilder l2 = ls.get(oy()); l2.append(l, ox() + 1, l.length()); l.delete(ox() + 1, l.length()); } cx = fx = 0; } else { if(cx == cxm) fx ++; else cx ++; } } if(oy() > cym && cy < 0){ cy = cym; fy = my() - cy; } if(oy() > my()){ fy -= oy() - my(); } if(ox() > mx()) { if(mx() > cxm){ cx = cxm; fx = mx() - cx; } else { cx = mx(); fx = 0; } } updateScreen(); }
13,839
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
13,840
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
13,841
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
public void loadFile(File f) throws IOException { ls.clear(); if(!f.exists()) return; BufferedReader br = new BufferedReader(new FileReader(f)); int c; StringBuilder sb = new StringBuilder(); while((c = br.read()) != -1){ if(c == '\n'){ sb.append((char) c); ls.add(sb); sb = new StringBuilder(); } else { sb.append((char) c); } } if(sb.length() > 0) ls.add(sb); file = f; updateScreen(); }
13,842
public ImageReaderIterator(Iterator it) { this.it = it; }
public ImageReaderIterator(Iterator it, Object readerExtension) { this.it = it; }
13,843
public Object next() { try { return ((ImageReaderSpi) it.next()).createReaderInstance(); } catch (IOException e) { return null; } }
public Object next() { try { return ((ImageReaderSpi) it.next()).createReaderInstance(readerExtension); } catch (IOException e) { return null; } }
13,845
public ImageWriterIterator(Iterator it) { this.it = it; }
public ImageWriterIterator(Iterator it, Object writerExtension) { this.it = it; }
13,846
public Object next() { try { return ((ImageWriterSpi) it.next()).createWriterInstance(); } catch (IOException e) { return null; } }
public Object next() { try { return ((ImageWriterSpi) it.next()).createWriterInstance(writerExtension); } catch (IOException e) { return null; } }
13,848
public boolean filter(Object provider) { if (provider instanceof ImageReaderSpi) { ImageReaderSpi spi = (ImageReaderSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
public boolean filter(Object provider) { if (provider instanceof ImageWriterSpi) { ImageReaderSpi spi = (ImageReaderSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
13,849
public boolean filter(Object provider) { if (provider instanceof ImageReaderSpi) { ImageReaderSpi spi = (ImageReaderSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
public boolean filter(Object provider) { if (provider instanceof ImageReaderSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
13,850
public boolean filter(Object provider) { if (provider instanceof ImageReaderSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] mimetypes = spi.getMIMETypes(); for (int i = mimetypes.length - 1; i >= 0; --i) if (MIMEType.equals(mimetypes[i])) return true; } return false; }
public boolean filter(Object provider) { if (provider instanceof ImageWriterSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] mimetypes = spi.getMIMETypes(); for (int i = mimetypes.length - 1; i >= 0; --i) if (MIMEType.equals(mimetypes[i])) return true; } return false; }
13,851
public boolean filter(Object provider) { if (provider instanceof ImageReaderSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] suffixes = spi.getFileSuffixes(); for (int i = suffixes.length - 1; i >= 0; --i) if (fileSuffix.equals(suffixes[i])) return true; } return false; }
public boolean filter(Object provider) { if (provider instanceof ImageWriterSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] suffixes = spi.getFileSuffixes(); for (int i = suffixes.length - 1; i >= 0; --i) if (fileSuffix.equals(suffixes[i])) return true; } return false; }
13,852
public static Iterator getImageReadersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderFormatFilter(formatName)); }
public static Iterator getImageReadersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderFormatFilter(formatName), formatName); }
13,853
public static Iterator getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderMIMETypeFilter(MIMEType)); }
public static Iterator getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderMIMETypeFilter(MIMEType), MIMEType); }
13,854
public static Iterator getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("formatName may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderSuffixFilter(fileSuffix)); }
public static Iterator getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("formatName may not be null"); return getReadersByFilter(ImageReaderSpi.class, new ReaderSuffixFilter(fileSuffix), fileSuffix); }
13,855
public static Iterator getImageWritersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterFormatFilter(formatName)); }
public static Iterator getImageWritersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterFormatFilter(formatName), formatName); }
13,856
public static Iterator getImageWritersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterMIMETypeFilter(MIMEType)); }
public static Iterator getImageWritersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterMIMETypeFilter(MIMEType), MIMEType); }
13,857
public static Iterator getImageWritersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("fileSuffix may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterSuffixFilter(fileSuffix)); }
public static Iterator getImageWritersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("fileSuffix may not be null"); return getWritersByFilter(ImageWriterSpi.class, new WriterSuffixFilter(fileSuffix), fileSuffix); }
13,858
private static Iterator getReadersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageReaderIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
private static Iterator getReadersByFilter(Class type, ServiceRegistry.Filter filter, Object readerExtension) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageReaderIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
13,859
private static Iterator getReadersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageReaderIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
private static Iterator getReadersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageReaderIterator(it, readerExtension); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
13,860
private static Iterator getWritersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageWriterIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
private static Iterator getWritersByFilter(Class type, ServiceRegistry.Filter filter, Object writerExtension) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageWriterIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
13,861
private static Iterator getWritersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageWriterIterator(it); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
private static Iterator getWritersByFilter(Class type, ServiceRegistry.Filter filter) { try { Iterator it = getRegistry().getServiceProviders(type, filter, true); return new ImageWriterIterator(it, writerExtension); } catch (IllegalArgumentException e) { return Collections.EMPTY_SET.iterator(); } }
13,862
public void setOutput(Object output) { if (output != null) { // Check if its a valid output object. boolean found = false; Class[] types = null; if (originatingProvider != null) types = originatingProvider.getOutputTypes(); if (types != null) for (int i = types.length - 1; i >= 0; --i) if (types[i].equals(output.getClass())) found = true; if (! found) throw new IllegalArgumentException("output type not available"); } this.output = output; }
public void setOutput(Object output) { if (output != null) { // Check if its a valid output object. boolean found = false; Class[] types = null; if (originatingProvider != null) types = originatingProvider.getOutputTypes(); if (types != null) for (int i = types.length - 1; i >= 0; --i) if (types[i].isInstance(output)) found = true; if (! found) throw new IllegalArgumentException("output type not available"); } this.output = output; }
13,863
Node getRow(final int index) { int i = 0; Node thead = getChildElement("thead"); if (thead != null) { for (Node ctx = thead.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { if (!"tr".equalsIgnoreCase(ctx.getLocalName())) { continue; } if (index == i) { return ctx; } i++; } } Node tbody = getChildElement("tbody"); if (tbody == null) { tbody = this; } for (Node ctx = tbody.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { if (!"tr".equalsIgnoreCase(ctx.getLocalName())) { continue; } if (index == i) { return ctx; } i++; } Node tfoot = getChildElement("tfoot"); if (tfoot != null) { for (Node ctx = tfoot.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { if (!"tr".equalsIgnoreCase(ctx.getLocalName())) { continue; } if (index == i) { return ctx; } i++; } } return null; }
Node getRow(final int index) { int i = 0; Node thead = getChildElement("thead"); if (thead != null) { for (Node ctx = thead.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { String ctxName = ctx.getLocalName(); if (ctxName == null) { ctxName = ctx.getNodeName(); } if (!"tr".equalsIgnoreCase(ctxName)) { continue; } if (index == i) { return ctx; } i++; } } Node tbody = getChildElement("tbody"); if (tbody == null) { tbody = this; } for (Node ctx = tbody.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { String ctxName = ctx.getLocalName(); if (ctxName == null) { ctxName = ctx.getNodeName(); } if (!"tr".equalsIgnoreCase(ctxName)) { continue; } if (index == i) { return ctx; } i++; } Node tfoot = getChildElement("tfoot"); if (tfoot != null) { for (Node ctx = tfoot.getFirstChild(); ctx != null; ctx = ctx.getNextSibling()) { String ctxName = ctx.getLocalName(); if (ctxName == null) { ctxName = ctx.getNodeName(); } if (!"tr".equalsIgnoreCase(ctxName)) { continue; } if (index == i) { return ctx; } i++; } } return null; }
13,864
public void propertyChange(PropertyChangeEvent e) { JFileChooser filechooser = getFileChooser(); String n = e.getPropertyName(); if (n.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { int mode = -1; if (filechooser.isMultiSelectionEnabled()) mode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION; else mode = ListSelectionModel.SINGLE_SELECTION; if (listView) fileList.setSelectionMode(mode); else fileTable.setSelectionMode(mode); } else if (n.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File file = filechooser.getSelectedFile(); if (file != null && filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { if (file.isDirectory() && filechooser.isTraversable(file)) { filechooser.setApproveButtonText(openButtonText); filechooser.setApproveButtonToolTipText(openButtonToolTipText); } else if (file.isFile()) { filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } } if (file == null || !file.isFile()) setFileName(null); else setFileName(file.getName()); int index = -1; index = getModel().indexOf(file); if (index >= 0) { if (listView) { fileList.setSelectedIndex(index); fileList.ensureIndexIsVisible(index); fileList.revalidate(); fileList.repaint(); } else { fileTable.getSelectionModel().addSelectionInterval(index, index); fileTable.scrollRectToVisible(fileTable.getCellRect(index, 0, true)); fileTable.revalidate(); fileTable.repaint(); } } } else if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { if (listView) { fileList.clearSelection(); fileList.revalidate(); fileList.repaint(); } else { fileTable.clearSelection(); fileTable.revalidate(); fileTable.repaint(); } setDirectorySelected(false); File currentDirectory = filechooser.getCurrentDirectory(); setDirectory(currentDirectory); boolean hasParent = (currentDirectory.getParentFile() != null); getChangeToParentDirectoryAction().setEnabled(hasParent); } else if (n.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY) || n.equals(JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY)) { Window owner = SwingUtilities.windowForComponent(filechooser); if (owner instanceof JDialog) ((JDialog) owner).setTitle(getDialogTitle(filechooser)); approveButton.setText(getApproveButtonText(filechooser)); approveButton.setToolTipText( getApproveButtonToolTipText(filechooser)); approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); } else if (n.equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY)) approveButton.setText(getApproveButtonText(filechooser)); else if (n.equals( JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) approveButton.setToolTipText(getApproveButtonToolTipText(filechooser)); else if (n.equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); else if (n.equals( JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { if (filechooser.getControlButtonsAreShown()) { topPanel.add(controls, BorderLayout.EAST); } else topPanel.remove(controls); topPanel.revalidate(); topPanel.repaint(); topPanel.doLayout(); } else if (n.equals( JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY)) { if (filechooser.isAcceptAllFileFilterUsed()) filechooser.addChoosableFileFilter( getAcceptAllFileFilter(filechooser)); else filechooser.removeChoosableFileFilter( getAcceptAllFileFilter(filechooser)); } else if (n.equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY)) { JComponent old = (JComponent) e.getOldValue(); if (old != null) getAccessoryPanel().remove(old); JComponent newval = (JComponent) e.getNewValue(); if (newval != null) getAccessoryPanel().add(newval); } if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY)) { // Remove editing component if (fileTable != null) fileTable.removeAll(); if (fileList != null) fileList.removeAll(); startEditing = false; // Set text on button back to original. if (filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } rescanCurrentDirectory(filechooser); } filechooser.revalidate(); filechooser.repaint(); }
public void propertyChange(PropertyChangeEvent e) { JFileChooser filechooser = getFileChooser(); String n = e.getPropertyName(); if (n.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { int mode = -1; if (filechooser.isMultiSelectionEnabled()) mode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION; else mode = ListSelectionModel.SINGLE_SELECTION; if (listView) fileList.setSelectionMode(mode); else fileTable.setSelectionMode(mode); } else if (n.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File file = filechooser.getSelectedFile(); if (file != null && filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { if (file.isDirectory() && filechooser.isTraversable(file)) { filechooser.setApproveButtonText(openButtonText); filechooser.setApproveButtonToolTipText(openButtonToolTipText); } else if (file.isFile()) { filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } } if (file == null) setFileName(null); else setFileName(file.getName()); int index = -1; index = getModel().indexOf(file); if (index >= 0) { if (listView) { fileList.setSelectedIndex(index); fileList.ensureIndexIsVisible(index); fileList.revalidate(); fileList.repaint(); } else { fileTable.getSelectionModel().addSelectionInterval(index, index); fileTable.scrollRectToVisible(fileTable.getCellRect(index, 0, true)); fileTable.revalidate(); fileTable.repaint(); } } } else if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { if (listView) { fileList.clearSelection(); fileList.revalidate(); fileList.repaint(); } else { fileTable.clearSelection(); fileTable.revalidate(); fileTable.repaint(); } setDirectorySelected(false); File currentDirectory = filechooser.getCurrentDirectory(); setDirectory(currentDirectory); boolean hasParent = (currentDirectory.getParentFile() != null); getChangeToParentDirectoryAction().setEnabled(hasParent); } else if (n.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY) || n.equals(JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY)) { Window owner = SwingUtilities.windowForComponent(filechooser); if (owner instanceof JDialog) ((JDialog) owner).setTitle(getDialogTitle(filechooser)); approveButton.setText(getApproveButtonText(filechooser)); approveButton.setToolTipText( getApproveButtonToolTipText(filechooser)); approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); } else if (n.equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY)) approveButton.setText(getApproveButtonText(filechooser)); else if (n.equals( JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) approveButton.setToolTipText(getApproveButtonToolTipText(filechooser)); else if (n.equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); else if (n.equals( JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { if (filechooser.getControlButtonsAreShown()) { topPanel.add(controls, BorderLayout.EAST); } else topPanel.remove(controls); topPanel.revalidate(); topPanel.repaint(); topPanel.doLayout(); } else if (n.equals( JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY)) { if (filechooser.isAcceptAllFileFilterUsed()) filechooser.addChoosableFileFilter( getAcceptAllFileFilter(filechooser)); else filechooser.removeChoosableFileFilter( getAcceptAllFileFilter(filechooser)); } else if (n.equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY)) { JComponent old = (JComponent) e.getOldValue(); if (old != null) getAccessoryPanel().remove(old); JComponent newval = (JComponent) e.getNewValue(); if (newval != null) getAccessoryPanel().add(newval); } if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY)) { // Remove editing component if (fileTable != null) fileTable.removeAll(); if (fileList != null) fileList.removeAll(); startEditing = false; // Set text on button back to original. if (filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } rescanCurrentDirectory(filechooser); } filechooser.revalidate(); filechooser.repaint(); }
13,866
void editFile(int index) { Rectangle bounds = list.getCellBounds(index, index); list.scrollRectToVisible(bounds); editFile = (File) list.getModel().getElementAt(index); if (editFile.canWrite()) { startEditing = true; editField = new JTextField(editFile.getName()); editField.addActionListener(new EditingActionListener()); Icon icon = getFileView(fc).getIcon(editFile); if (icon != null) bounds.x += icon.getIconWidth() + 4; editField.setBounds(bounds); list.add(editField); editField.requestFocus(); editField.selectAll(); } else completeEditing(); list.repaint(); }
void editFile(int index) { Rectangle bounds = list.getCellBounds(index, index); list.scrollRectToVisible(bounds); editFile = (File) list.getModel().getElementAt(index); if (editFile.canWrite()) { startEditing = true; editField = new JTextField(editFile.getName()); editField.addActionListener(new EditingActionListener()); Icon icon = getFileView(fc).getIcon(editFile); if (icon != null) { int padding = icon.getIconWidth() + 4; bounds.x += padding; bounds.width -= padding; } editField.setBounds(bounds); list.add(editField); editField.requestFocus(); editField.selectAll(); } else completeEditing(); list.repaint(); }
13,868
protected JPanel createList(JFileChooser fc) { if (fileList == null) { fileListPanel = new JPanel(new BorderLayout()); fileList = new JList(getModel()); scrollPane = new JScrollPane(fileList); // FIXME: fileList.setLayoutOrientation(JList.VERTICAL_WRAP); fileList.setCellRenderer(new FileRenderer()); } else { fileList.setModel(getModel()); fileListPanel.removeAll(); scrollPane.setViewport(new JViewport()); scrollPane.getViewport().setView(fileList); } fileListPanel.add(scrollPane); return fileListPanel; }
protected JPanel createList(JFileChooser fc) { if (fileList == null) { fileListPanel = new JPanel(new BorderLayout()); fileList = new JList(getModel()); scrollPane = new JScrollPane(fileList); // FIXME: fileList.setLayoutOrientation(JList.VERTICAL_WRAP); fileList.setCellRenderer(new FileRenderer()); } else { fileList.setModel(getModel()); fileListPanel.removeAll(); scrollPane.getViewport().setView(fileList); } fileListPanel.add(scrollPane); return fileListPanel; }
13,870
public Dimension getMinimumSize(JComponent c) { Dimension tp = topPanel.getMinimumSize(); Dimension bp = bottomPanel.getMinimumSize(); Dimension bup = buttonPanel.getMinimumSize(); Dimension fl = fileList.getMinimumSize(); return new Dimension((tp.width + bp.width + bup.width + fl.width), (tp.height + bp.height + bup.height + fl.height)); }
public Dimension getMinimumSize(JComponent c) { Dimension tp = topPanel.getMinimumSize(); Dimension bp = bottomPanel.getMinimumSize(); Dimension bup = buttonPanel.getMinimumSize(); Dimension fl = fileList.getMinimumSize(); return new Dimension((tp.width + bp.width + bup.width + fl.width), (tp.height + bp.height + bup.height + fl.height)); }
13,871
public Dimension getPreferredSize(JComponent c) { Dimension tp = topPanel.getPreferredSize(); Dimension bp = bottomPanel.getPreferredSize(); Dimension bup = buttonPanel.getPreferredSize(); Dimension fl = fileList.getPreferredSize(); return new Dimension((tp.width + bp.width + bup.width + fl.width), (tp.height + bp.height + bup.height + fl.height)); }
public Dimension getPreferredSize(JComponent c) { Dimension tp = topPanel.getPreferredSize(); Dimension bp = bottomPanel.getPreferredSize(); Dimension bup = buttonPanel.getPreferredSize(); Dimension fl = fileList.getPreferredSize(); return new Dimension((tp.width + bp.width + bup.width + fl.width), (tp.height + bp.height + bup.height + fl.height)); }
13,872
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); dirLabel = new JLabel(directoryLabel); topPanel.add(dirLabel, BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,873
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,874
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); JPanel list = createList(fc); list.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); fc.add(list, BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,875
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,876
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); row2.add(fileFilterCombo); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,877
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,878
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel); fc.add(bottomPanel, BorderLayout.SOUTH); }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); fc.add(topPanel, BorderLayout.NORTH); fc.add(createList(fc), BorderLayout.CENTER); JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); fileFilterCombo.setRenderer(createFilterComboBoxRenderer()); fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); row1.add(fileNamePanel); bottomPanel.add(row1); JPanel filterPanel = new JPanel(new VerticalMidLayout()); filterPanel.add(fileFilterCombo); JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); row2.add(filterPanel); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); bottomPanel.add(buttonPanel, BorderLayout.SOUTH); bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 8, 8)); fc.add(bottomPanel, BorderLayout.SOUTH); }
13,879
protected void installStrings(JFileChooser fc) { super.installStrings(fc); directoryLabel = "Look In: "; fileLabel = "File Name: "; filterLabel = "Files of Type: "; this.cancelButtonMnemonic = 0; this.cancelButtonText = "Cancel"; this.cancelButtonToolTipText = "Abort file chooser dialog"; this.directoryOpenButtonMnemonic = 0; this.directoryOpenButtonText = "Open"; this.directoryOpenButtonToolTipText = "Open selected directory"; this.helpButtonMnemonic = 0; this.helpButtonText = "Help"; this.helpButtonToolTipText = "Filechooser help"; this.openButtonMnemonic = 0; this.openButtonText = "Open"; this.openButtonToolTipText = "Open selected file"; this.saveButtonMnemonic = 0; this.saveButtonText = "Save"; this.saveButtonToolTipText = "Save selected file"; this.updateButtonMnemonic = 0; this.updateButtonText = "Update"; this.updateButtonToolTipText = "Update directory listing"; }
protected void installStrings(JFileChooser fc) { super.installStrings(fc); look = "Look In: "; save = "Save In: "; if (fc.getDialogType() == JFileChooser.SAVE_DIALOG) directoryLabel = save; else directoryLabel = look; fileLabel = "File Name: "; filterLabel = "Files of Type: "; this.cancelButtonMnemonic = 0; this.cancelButtonText = "Cancel"; this.cancelButtonToolTipText = "Abort file chooser dialog"; this.directoryOpenButtonMnemonic = 0; this.directoryOpenButtonText = "Open"; this.directoryOpenButtonToolTipText = "Open selected directory"; this.helpButtonMnemonic = 0; this.helpButtonText = "Help"; this.helpButtonToolTipText = "Filechooser help"; this.openButtonMnemonic = 0; this.openButtonText = "Open"; this.openButtonToolTipText = "Open selected file"; this.saveButtonMnemonic = 0; this.saveButtonText = "Save"; this.saveButtonToolTipText = "Save selected file"; this.updateButtonMnemonic = 0; this.updateButtonText = "Update"; this.updateButtonToolTipText = "Update directory listing"; }
13,881
JPanel updateTable() { DefaultTableModel mod = (DefaultTableModel) fileTable.getModel(); ListModel lm = fileList.getModel(); DateFormat dt = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); File curr = null; int size = lm.getSize(); int rc = mod.getRowCount(); // If there are not enough rows for (int x = rc; x < size; x++) mod.addRow(new Object[3]); for (int i = 0; i < size; i++) { curr = (File) lm.getElementAt(i); fileTable.setValueAt(curr.getName(), i, 0); fileTable.setValueAt(formatSize(curr.length()), i, 1); fileTable.setValueAt(dt.format(new Date(curr.lastModified())), i, 2); } // If there are too many rows while (rc > size) mod.removeRow(--rc); scrollPane.setViewport(new JViewport()); scrollPane.getViewport().setView(fileTable); scrollPane.setColumnHeaderView(fileTable.getTableHeader()); scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); fileTablePanel.removeAll(); fileTablePanel.add(scrollPane); return fileTablePanel; }
JPanel updateTable() { DefaultTableModel mod = (DefaultTableModel) fileTable.getModel(); ListModel lm = fileList.getModel(); DateFormat dt = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); File curr = null; int size = lm.getSize(); int rc = mod.getRowCount(); // If there are not enough rows for (int x = rc; x < size; x++) mod.addRow(new Object[3]); for (int i = 0; i < size; i++) { curr = (File) lm.getElementAt(i); fileTable.setValueAt(curr.getName(), i, 0); fileTable.setValueAt(formatSize(curr.length()), i, 1); fileTable.setValueAt(dt.format(new Date(curr.lastModified())), i, 2); } // If there are too many rows while (rc > size) mod.removeRow(--rc); scrollPane.getViewport().setView(fileTable); scrollPane.setColumnHeaderView(fileTable.getTableHeader()); scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); fileTablePanel.removeAll(); fileTablePanel.add(scrollPane); return fileTablePanel; }
13,882
JPanel updateTable() { DefaultTableModel mod = (DefaultTableModel) fileTable.getModel(); ListModel lm = fileList.getModel(); DateFormat dt = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); File curr = null; int size = lm.getSize(); int rc = mod.getRowCount(); // If there are not enough rows for (int x = rc; x < size; x++) mod.addRow(new Object[3]); for (int i = 0; i < size; i++) { curr = (File) lm.getElementAt(i); fileTable.setValueAt(curr.getName(), i, 0); fileTable.setValueAt(formatSize(curr.length()), i, 1); fileTable.setValueAt(dt.format(new Date(curr.lastModified())), i, 2); } // If there are too many rows while (rc > size) mod.removeRow(--rc); scrollPane.setViewport(new JViewport()); scrollPane.getViewport().setView(fileTable); scrollPane.setColumnHeaderView(fileTable.getTableHeader()); scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); fileTablePanel.removeAll(); fileTablePanel.add(scrollPane); return fileTablePanel; }
JPanel updateTable() { DefaultTableModel mod = (DefaultTableModel) fileTable.getModel(); ListModel lm = fileList.getModel(); DateFormat dt = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); File curr = null; int size = lm.getSize(); int rc = mod.getRowCount(); // If there are not enough rows for (int x = rc; x < size; x++) mod.addRow(new Object[3]); for (int i = 0; i < size; i++) { curr = (File) lm.getElementAt(i); fileTable.setValueAt(curr.getName(), i, 0); fileTable.setValueAt(formatSize(curr.length()), i, 1); fileTable.setValueAt(dt.format(new Date(curr.lastModified())), i, 2); } // If there are too many rows while (rc > size) mod.removeRow(--rc); scrollPane.setViewport(new JViewport()); scrollPane.getViewport().setView(fileTable); scrollPane.setColumnHeaderView(fileTable.getTableHeader()); fileTablePanel.removeAll(); fileTablePanel.add(scrollPane); return fileTablePanel; }
13,883
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new ProcessingInstructionNode(name); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) TemplateNode ret = new ProcessingInstructionNode(name); if (children != null) ret.children = children.clone(stylesheet); } if (next != null) ret.next = next.clone(stylesheet); } return ret; }
13,884
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new ProcessingInstructionNode(name); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new ProcessingInstructionNode(name); if (children != null) { ret.children = children.clone(stylesheet); if (next != null) { ret.next = next.clone(stylesheet); return ret;
13,885
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { String data = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) { // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment data = Expr.stringValue(fragment); } ProcessingInstruction pi = doc.createProcessingInstruction(name, data); // Insert into result tree if (nextSibling != null) { parent.insertBefore(pi, nextSibling); } else { parent.appendChild(pi); } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException String data = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment data = Expr.stringValue(fragment); } ProcessingInstruction pi = doc.createProcessingInstruction(name, data); // Insert into result tree if (nextSibling != null) parent.insertBefore(pi, nextSibling); } else parent.appendChild(pi); } if (next != null) next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
13,886
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { String data = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) { // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment data = Expr.stringValue(fragment); } ProcessingInstruction pi = doc.createProcessingInstruction(name, data); // Insert into result tree if (nextSibling != null) { parent.insertBefore(pi, nextSibling); } else { parent.appendChild(pi); } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { String data = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) { // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment data = Expr.stringValue(fragment); ProcessingInstruction pi = doc.createProcessingInstruction(name, data); // Insert into result tree if (nextSibling != null) { parent.insertBefore(pi, nextSibling); else { parent.appendChild(pi); if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling);
13,887
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("name="); buf.append(name); buf.append(']'); return buf.toString(); }
public String toString() { StringBuffer buf = new StringBuffer("processing-instruction"); buf.append('['); buf.append("name="); buf.append(name); buf.append(']'); return buf.toString(); }
13,888
public UDPProtocol(IPv4Service ipService) throws NetworkException { this.ipService = ipService; this.icmp = new ICMPUtils(ipService); try { dsiFactory = new UDPDatagramSocketImplFactory(this); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { DatagramSocket.setDatagramSocketImplFactory(dsiFactory); return null; } }); } catch (SecurityException ex) { log.error("No permission to set DatagramSocketImplFactory", ex); } catch (PrivilegedActionException ex) { throw new NetworkException(ex.getException()); } } catch (IOException ex) { throw new NetworkException(ex); } }
public UDPProtocol(IPv4Service ipService) throws NetworkException { this.ipService = ipService; this.icmp = new ICMPUtils(ipService); try { dsiFactory = new UDPDatagramSocketImplFactory(this); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { DatagramSocket.setDatagramSocketImplFactory(dsiFactory); return null; } }); } catch (SecurityException ex) { log.error("No permission to set DatagramSocketImplFactory", ex); } catch (PrivilegedActionException ex) { throw new NetworkException(ex.getException()); } } catch (IOException ex) { throw new NetworkException(ex); } }
13,890
public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException { if (index < -1 || title != null && index >= title.length()) throw new IllegalArgumentException(); if (title == null || title.charAt(index) != mnemonicKey) index = -1; underlinedChar = index; }
public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException { if (index < -1 || title != null && index >= title.length()) throw new IllegalArgumentException(); if (title == null || mnemonicKey == 0 || title.charAt(index) != mnemonicKey) index = -1; underlinedChar = index; }
13,892
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) { sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); } TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); } TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) ret.children = children.clone(stylesheet); } if (next != null) ret.next = next.clone(stylesheet); } return ret; }
13,893
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) { sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); } TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) { sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) { ret.children = children.clone(stylesheet); if (next != null) { ret.next = next.clone(stylesheet); return ret;
13,894
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { // Set current template to null Template saved = stylesheet.currentTemplate; stylesheet.currentTemplate = null; Object ret = select.evaluate(context, pos, len); //System.err.println(toString() + ": " + context+" -> "+ret); if (ret instanceof Collection) { Collection ns = (Collection) ret; List list = new ArrayList(ns); if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { SortKey sortKey = (SortKey) i.next(); sortKey.init(stylesheet, mode, context, pos, len, parent, nextSibling); } Collections.sort(list, new XSLComparator(sortKeys)); } else { Collections.sort(list, documentOrderComparator); } // Perform children for each node int l = list.size(); int p = 1; for (Iterator i = list.iterator(); i.hasNext(); ) { Node node = (Node) i.next(); stylesheet.current = node; children.apply(stylesheet, mode, node, p++, l, parent, nextSibling); } } // Restore current template stylesheet.currentTemplate = saved; } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException if (children != null) // Set current template to null Template saved = stylesheet.currentTemplate; stylesheet.currentTemplate = null; Object ret = select.evaluate(context, pos, len); //System.err.println(toString() + ": " + context+" -> "+ret); if (ret instanceof Collection) Collection ns = (Collection) ret; List list = new ArrayList(ns); if (sortKeys != null) for (Iterator i = sortKeys.iterator(); i.hasNext(); ) SortKey sortKey = (SortKey) i.next(); sortKey.init(stylesheet, mode, context, pos, len, parent, nextSibling); } Collections.sort(list, new XSLComparator(sortKeys)); } else Collections.sort(list, documentOrderComparator); } // Perform children for each node int l = list.size(); int p = 1; for (Iterator i = list.iterator(); i.hasNext(); ) Node node = (Node) i.next(); stylesheet.current = node; children.apply(stylesheet, mode, node, p++, l, parent, nextSibling); } } // Restore current template stylesheet.currentTemplate = saved; } if (next != null) next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
13,895
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { // Set current template to null Template saved = stylesheet.currentTemplate; stylesheet.currentTemplate = null; Object ret = select.evaluate(context, pos, len); //System.err.println(toString() + ": " + context+" -> "+ret); if (ret instanceof Collection) { Collection ns = (Collection) ret; List list = new ArrayList(ns); if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { SortKey sortKey = (SortKey) i.next(); sortKey.init(stylesheet, mode, context, pos, len, parent, nextSibling); } Collections.sort(list, new XSLComparator(sortKeys)); } else { Collections.sort(list, documentOrderComparator); } // Perform children for each node int l = list.size(); int p = 1; for (Iterator i = list.iterator(); i.hasNext(); ) { Node node = (Node) i.next(); stylesheet.current = node; children.apply(stylesheet, mode, node, p++, l, parent, nextSibling); } } // Restore current template stylesheet.currentTemplate = saved; } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { // Set current template to null Template saved = stylesheet.currentTemplate; stylesheet.currentTemplate = null; Object ret = select.evaluate(context, pos, len); //System.err.println(toString() + ": " + context+" -> "+ret); if (ret instanceof Collection) { Collection ns = (Collection) ret; List list = new ArrayList(ns); if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { SortKey sortKey = (SortKey) i.next(); sortKey.init(stylesheet, mode, context, pos, len, parent, nextSibling); Collections.sort(list, new XSLComparator(sortKeys)); else { Collections.sort(list, documentOrderComparator); // Perform children for each node int l = list.size(); int p = 1; for (Iterator i = list.iterator(); i.hasNext(); ) { Node node = (Node) i.next(); stylesheet.current = node; children.apply(stylesheet, mode, node, p++, l, parent, nextSibling); // Restore current template stylesheet.currentTemplate = saved; if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling);
13,896
public boolean references(QName var) { if (select != null && select.references(var)) { return true; } if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { if (((SortKey) i.next()).references(var)) { return true; } } } return super.references(var); }
public boolean references(QName var) if (select != null && select.references(var)) return true; } if (sortKeys != null) for (Iterator i = sortKeys.iterator(); i.hasNext(); ) if (((SortKey) i.next()).references(var)) return true; } } } return super.references(var); }
13,897
public boolean references(QName var) { if (select != null && select.references(var)) { return true; } if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { if (((SortKey) i.next()).references(var)) { return true; } } } return super.references(var); }
public boolean references(QName var) { if (select != null && select.references(var)) { return true; if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { if (((SortKey) i.next()).references(var)) { return true; return super.references(var);
13,898
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("select="); buf.append(select); buf.append(']'); return buf.toString(); }
public String toString() { StringBuffer buf = new StringBuffer("for-each"); buf.append('['); buf.append("select="); buf.append(select); buf.append(']'); return buf.toString(); }
13,899
cObject(org.omg.CORBA.Object _object, int _port, byte[] _key) { object = _object; port = _port; key = _key; }
cObject(org.omg.CORBA.Object _object, int _port, byte[] _key, java.lang.Object an_identity ) { object = _object; port = _port; key = _key; }
13,900
public cObject add(org.omg.CORBA.Object object, int port) { return add(generateObjectKey(object), object, port); }
public cObject add(org.omg.CORBA.Object object, int port) { return add(generateObjectKey(object), object, port, null); }
13,902
public cObject getKey(org.omg.CORBA.Object stored_object) { Map.Entry item; Iterator iter = objects.entrySet().iterator(); cObject ref; while (iter.hasNext()) { item = (Map.Entry) iter.next(); ref = (cObject) item.getValue(); if (stored_object.equals(ref.object)) return ref; } return null; }
public cObject getKey(org.omg.CORBA.Object stored_object) { Map.Entry item; Iterator iter = objects.entrySet().iterator(); cObject ref; while (iter.hasNext()) { item = (Map.Entry) iter.next(); ref = (cObject) item.getValue(); if (stored_object.equals(ref.object) || stored_object._is_equivalent(ref.object) ) return ref; } return null; }
13,904
public Object getProperty(String string) { if (properties == null) return null; return properties.get(string); }
public Object getProperty(String string) { if (properties == null) return null; return properties.get(string); }
13,907
protected void fireValueChanged(TreeSelectionEvent event) { TreeSelectionListener[] listeners = getTreeSelectionListeners(); for (int i = listeners.length - 1; i >= 0; --i) listeners[i].valueChanged(event); }
protected void fireValueChanged(TreeSelectionEvent event) { TreeSelectionListener[] listeners = getTreeSelectionListeners(); for (int i = 0; i < listeners.length; ++i) listeners[i].valueChanged(event); }
13,911
public TreeSelectionListener[] getTreeSelectionListeners() { return (TreeSelectionListener[]) listenerList.getListeners(TreeSelectionListener.class); }
public TreeSelectionListener[] getTreeSelectionListeners() { return (TreeSelectionListener[]) getListeners(TreeSelectionListener.class); }
13,912
public boolean isPathSelected(TreePath value0) { return false; // TODO }
public boolean isPathSelected(TreePath value0) { if (selection == null) return false; for (int i = 0; i < selection.length; i++) { if (selection[i].equals(value0)) return true; } return false; // TODO }
13,913
public final Object getObject(String key) { for (ResourceBundle bundle = this; bundle != null; bundle = bundle.parent) { Object o = bundle.handleGetObject(key); if (o != null) return o; } throw new MissingResourceException("Key not found", getClass().getName(), key); }
public final Object getObject(String key) { for (ResourceBundle bundle = this; bundle != null; bundle = bundle.parent) { Object o = bundle.handleGetObject(key); if (o != null) return o; } throw new MissingResourceException("Key not found", getClass().getName(), key); }
13,916
private static ResourceBundle tryBundle(String localizedName, ClassLoader classloader) { ResourceBundle bundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); // Note that we do the check up front instead of catching // ClassCastException. The reason for this is that some crazy // programs (Eclipse) have classes that do not extend // ResourceBundle but that have the same name as a property // bundle; in fact Eclipse relies on ResourceBundle not // instantiating these classes. if (ResourceBundle.class.isAssignableFrom(rbClass)) bundle = (ResourceBundle) rbClass.newInstance(); } catch (IllegalAccessException ex) {} catch (InstantiationException ex) {} catch (ClassNotFoundException ex) {} if (bundle == null) { try { InputStream is; String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) bundle = new PropertyResourceBundle(is); } catch (IOException ex) { MissingResourceException mre = new MissingResourceException ("Failed to load bundle", localizedName, ""); mre.initCause(ex); throw mre; } } return bundle; }
private static ResourceBundle tryBundle(String localizedName, ClassLoader classloader) { ResourceBundle bundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); // Note that we do the check up front instead of catching // ClassCastException. The reason for this is that some crazy // programs (Eclipse) have classes that do not extend // ResourceBundle but that have the same name as a property // bundle; in fact Eclipse relies on ResourceBundle not // instantiating these classes. if (ResourceBundle.class.isAssignableFrom(rbClass)) bundle = (ResourceBundle) rbClass.newInstance(); } catch (IllegalAccessException ex) {} catch (InstantiationException ex) {} catch (ClassNotFoundException ex) {} if (bundle == null) { try { InputStream is; String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) bundle = new PropertyResourceBundle(is); } catch (IOException ex) { MissingResourceException mre = new MissingResourceException ("Failed to load bundle: " + localizedName, localizedName, ""); mre.initCause(ex); throw mre; } } return bundle; }
13,917
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,918
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,919
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
13,920
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; }
public final void clear() { isTimeSet = false; areFieldsSet = false; int hour = fields[ZONE_OFFSET] / (60 * 60 * 1000); int minute = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour) / (60 * 1000); int seconds = (fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute) / 1000; int millis = fields[ZONE_OFFSET] - 60 * 60 * 1000 * hour - 60 * 1000 * minute - seconds * 1000; int[] tempFields = { 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, hour, hour, minute, seconds, millis, fields[ZONE_OFFSET], fields[DST_OFFSET] }; fields = tempFields; for (int i = 0; i < FIELD_COUNT - 2; i++) isSet[i] = false; }
13,921
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); table.setFont(defaults.getFont("Table.font")); table.setGridColor(defaults.getColor("Table.gridColor")); table.setForeground(defaults.getColor("Table.foreground")); table.setBackground(defaults.getColor("Table.background")); table.setSelectionForeground(defaults.getColor("Table.selectionForeground")); table.setSelectionBackground(defaults.getColor("Table.selectionBackground")); table.setOpaque(true); highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder"); cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); table.setFont(defaults.getFont("Table.font")); table.setGridColor(defaults.getColor("Table.gridColor")); table.setForeground(defaults.getColor("Table.foreground")); table.setBackground(defaults.getColor("Table.background")); table.setSelectionForeground(defaults.getColor("Table.selectionForeground")); table.setSelectionBackground(defaults.getColor("Table.selectionBackground")); table.setOpaque(true); highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder"); cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
13,922
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); table.setFont(defaults.getFont("Table.font")); table.setGridColor(defaults.getColor("Table.gridColor")); table.setForeground(defaults.getColor("Table.foreground")); table.setBackground(defaults.getColor("Table.background")); table.setSelectionForeground(defaults.getColor("Table.selectionForeground")); table.setSelectionBackground(defaults.getColor("Table.selectionBackground")); table.setOpaque(true); highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder"); cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); table.setFont(defaults.getFont("Table.font")); table.setGridColor(defaults.getColor("Table.gridColor")); table.setForeground(defaults.getColor("Table.foreground")); table.setBackground(defaults.getColor("Table.background")); table.setSelectionForeground(defaults.getColor("Table.selectionForeground")); table.setSelectionBackground(defaults.getColor("Table.selectionBackground")); table.setOpaque(true); highlightCellBorder = UIManager.getBorder("Table.focusCellHighlightBorder"); cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
13,923
public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; } x += width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth(); gfx.drawLine(x - gap.width, y0, x - gap.width, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } }
public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; } x += width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth(); gfx.drawLine(x - gap.width, y0, x - gap.width, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } }
13,925
public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; } x += width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth(); gfx.drawLine(x - gap.width, y0, x - gap.width, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } }
public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; } x += width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth(); gfx.drawLine(x - gap.width, y0, x - gap.width, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } }
13,926
public static void main(String[] args) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(args); final File dir = ARG_DIR.getFile(cmdLine); if (dir.exists() && dir.isDirectory()) { System.setProperty("user.dir", dir.getAbsoluteFile().getCanonicalPath()); } else if("/".equals(dir.getCanonicalPath())) { System.getProperties().setProperty("user.dir", "/"); } else { System.err.println(dir + " is not a valid directory"); } }
public static void main(String[] args) throws Exception { ParsedArguments cmdLine = HELP_INFO.parse(args); final File dir = ARG_DIR.getFile(cmdLine); if (dir.exists() && dir.isDirectory()) { System.setProperty("user.dir", dir.getAbsoluteFile().getCanonicalPath()); } else if("/".equals(dir.getCanonicalPath())) { System.getProperties().setProperty("user.dir", "/"); } else { System.err.println(dir + " is not a valid directory"); } }
13,929
private void doAssembly() { for (int i = 0; i < modules.size(); i++) { ((AssemblerModule) modules.get(i)).setNativeStream(nativeStream); } for (Iterator it = instructions.iterator(); it.hasNext();) { Instruction ins = (Instruction) it.next(); //handle prefixes int prefix = ins.getPrefix(); if((prefix & Instruction.LOCK_PREFIX) != 0){ nativeStream.write8(X86Constants.LOCK_PREFIX); } else if ((prefix & Instruction.REP_PREFIX) != 0){ nativeStream.write8(X86Constants.REP_PREFIX); } String label = ins.getLabel(); if (label != null) { if (labels.get(label) != null && pass == 1) throw new IllegalArgumentException("Label already defined: " + label); defineLabel(label, nativeStream); } String mnemo = ins.getMnemonic(); if (mnemo != null) { try{ emmit(ins.getMnemonic(), ins.getOperands(), getOperandSize(ins)); }catch(IllegalArgumentException x){ if(Assembler.THROW){ throw x; } else { System.out.println(x.getMessage() + " at line " + ins.getLineNumber()); } } } } }
private void doAssembly() { for (int i = 0; i < modules.size(); i++) { ((AssemblerModule) modules.get(i)).setNativeStream(nativeStream); } for (Iterator it = instructions.iterator(); it.hasNext();) { Instruction ins = (Instruction) it.next(); //handle prefixes int prefix = ins.getPrefix(); if((prefix & Instruction.LOCK_PREFIX) != 0){ nativeStream.write8(X86Constants.LOCK_PREFIX); } else if ((prefix & Instruction.REP_PREFIX) != 0){ nativeStream.write8(X86Constants.REP_PREFIX); } String label = ins.getLabel(); if (label != null) { if (labels.get(label) != null && pass == 1) throw new IllegalArgumentException("Label already defined: " + label); defineLabel(label, nativeStream); } String mnemo = ins.getMnemonic(); if (mnemo != null) { try{ emit(ins.getMnemonic(), ins.getOperands(), getOperandSize(ins)); }catch(IllegalArgumentException x){ if(Assembler.THROW){ throw x; } else { System.out.println(x.getMessage() + " at line " + ins.getLineNumber()); } } } } }
13,930
public void add(int index, Object element) { elements.add(index, element); fireContentsChanged(this, index, index); }
public void add(int index, Object element) { elements.add(index, element); fireIntervalAdded(this, index, index); }
13,931
public void addElement(Object element) { elements.add(element); fireIntervalAdded(this, elements.size(), elements.size()); }
public void addElement(Object element) { elements.add(element); fireIntervalAdded(this, s, s); }
13,932
public void clear() { elements.clear(); fireIntervalRemoved(this, 0, elements.size()); }
public void clear() { elements.clear(); fireIntervalRemoved(this, 0, s - 1); } }
13,933
public String getAccessibleName() { return accessibleName == null ? getName() : accessibleName; }
public String getAccessibleName() { return accessibleName; }
13,935
void dispatchEventImpl(AWTEvent e) { // Give toolkit a chance to dispatch the event // to globally registered listeners. Toolkit.getDefaultToolkit().globalDispatchEvent(e); // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); } if (peer != null) peer.handleEvent(e); }
void dispatchEventImpl(AWTEvent e) { // Give toolkit a chance to dispatch the event // to globally registered listeners. Toolkit.getDefaultToolkit().globalDispatchEvent(e); // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight() && !e.isConsumed()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); } if (peer != null) peer.handleEvent(e); }
13,936
void dispatchEventImpl(AWTEvent e) { // Give toolkit a chance to dispatch the event // to globally registered listeners. Toolkit.getDefaultToolkit().globalDispatchEvent(e); // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); } if (peer != null) peer.handleEvent(e); }
void dispatchEventImpl(AWTEvent e) { // Give toolkit a chance to dispatch the event // to globally registered listeners. Toolkit.getDefaultToolkit().globalDispatchEvent(e); // This boolean tells us not to process focus events when the focus // opposite component is the same as the focus component. boolean ignoreFocus = (e instanceof FocusEvent && ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); } if (peer != null) peer.handleEvent(e); }
13,937
protected void processMouseEvent(MouseEvent e) { if (mouseListener == null) return; switch (e.id) { case MouseEvent.MOUSE_CLICKED: mouseListener.mouseClicked(e); break; case MouseEvent.MOUSE_ENTERED: mouseListener.mouseEntered(e); break; case MouseEvent.MOUSE_EXITED: mouseListener.mouseExited(e); break; case MouseEvent.MOUSE_PRESSED: mouseListener.mousePressed(e); break; case MouseEvent.MOUSE_RELEASED: mouseListener.mouseReleased(e); break; } e.consume(); }
protected void processMouseEvent(MouseEvent e) { if (mouseListener == null) return; switch (e.id) { case MouseEvent.MOUSE_CLICKED: mouseListener.mouseClicked(e); break; case MouseEvent.MOUSE_ENTERED: mouseListener.mouseEntered(e); break; case MouseEvent.MOUSE_EXITED: mouseListener.mouseExited(e); break; case MouseEvent.MOUSE_PRESSED: mouseListener.mousePressed(e); break; case MouseEvent.MOUSE_RELEASED: mouseListener.mouseReleased(e); break; } }
13,939
protected SoundbankResource(Soundbank soundBank, String name, Class dataClass) { this.soundBank = soundBank; this.name = name; this.dataClass = dataClass; }
protected SoundbankResource(Soundbank soundbank, String name, Class dataClass) { this.soundBank = soundBank; this.name = name; this.dataClass = dataClass; }
13,940
protected SoundbankResource(Soundbank soundBank, String name, Class dataClass) { this.soundBank = soundBank; this.name = name; this.dataClass = dataClass; }
protected SoundbankResource(Soundbank soundBank, String name, Class dataClass) { this.soundbank = soundbank; this.name = name; this.dataClass = dataClass; }
13,941
EventQueue.invokeLater(new Runnable() { public void run() { } });
public void run() { }
13,942
public void setSelectedIndex(int index) { checkIndex(index, -1, tabs.size()); if (index != getSelectedIndex()) { if (getSelectedIndex() != -1 && getSelectedComponent() != null) getSelectedComponent().hide(); if (index != -1 && getComponentAt(index) != null) getComponentAt(index).show(); model.setSelectedIndex(index); } }
public void setSelectedIndex(int index) { checkIndex(index, -1, tabs.size()); if (index != getSelectedIndex()) { if (getSelectedIndex() != -1 && getSelectedComponent() != null) getSelectedComponent().hide(); if (index != -1 && getComponentAt(index) != null) getComponentAt(index).show(); model.setSelectedIndex(index); } }
13,943
public void addActionListener(ActionListener listener) { actions.addElement(listener); }
public void addActionListener(ActionListener listener) { listenerList.add (ActionListener.class, listener); }
13,944
void fireActionPerformed() { for (int i=0;i<actions.size();i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
protected void fireActionPerformed (ActionEvent event) { for (int i=0;i<actions.size();i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
13,945
void fireActionPerformed() { for (int i=0;i<actions.size();i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
void fireActionPerformed() { ActionListener[] listeners = getActionListeners(); for (int i = 0; i < listeners.length; i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
13,946
void fireActionPerformed() { for (int i=0;i<actions.size();i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
void fireActionPerformed() { for (int i=0;i<actions.size();i++) { ActionListener a = (ActionListener) actions.elementAt(i); a.actionPerformed(new ActionEvent(this, ticks, "Timer")); } }
13,947
public void removeActionListener(ActionListener listener) { actions.removeElement(listener); }
public void removeActionListener(ActionListener listener) { listenerList.remove (ActionListener.class, listener); }
13,948
protected void init(String text, Icon icon) { super.init(text, icon); setModel(new DefaultButtonModel()); // Initializes properties for this menu item, that are different // from Abstract button properties. /* NOTE: According to java specifications paint_border should be set to false, since menu item should not have a border. However running few java programs it seems that menu items and menues can have a border. Commenting out statement below for now. */ //borderPainted = false; focusPainted = false; horizontalAlignment = JButton.LEFT; horizontalTextPosition = JButton.LEFT; }
protected void init(String text, Icon icon) { super.init(text, icon); setModel(new DefaultButtonModel()); // Initializes properties for this menu item, that are different // from Abstract button properties. /* NOTE: According to java specifications paint_border should be set to false, since menu item should not have a border. However running few java programs it seems that menu items and menues can have a border. Commenting out statement below for now. */ //borderPainted = false; focusPainted = false; horizontalAlignment = JButton.LEFT; horizontalTextPosition = JButton.TRAILING; }
13,949
public boolean filter (Object provider) { if (provider instanceof ImageReaderSpi) { ImageWriterSpi spi = (ImageWriterSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
public boolean filter (Object provider) { if (provider instanceof ImageReaderSpi) { ImageReaderSpi spi = (ImageReaderSpi) provider; String[] formatNames = spi.getFormatNames(); for (int i = formatNames.length - 1; i >= 0; --i) if (formatName.equals(formatNames[i])) return true; } return false; }
13,950
public EntityReference createEntityReference(String name, //EntityDeclaration declaration) String replacementText) { //return new EntityReferenceImpl(location, declaration, name); return new EntityReferenceImpl(location, name, null, null, null, replacementText); }
public EntityReference createEntityReference(String name, //EntityDeclaration declaration) EntityDeclaration declaration) { //return new EntityReferenceImpl(location, declaration, name); return new EntityReferenceImpl(location, name, null, null, null, replacementText); }
13,951
public EntityReference createEntityReference(String name, //EntityDeclaration declaration) String replacementText) { //return new EntityReferenceImpl(location, declaration, name); return new EntityReferenceImpl(location, name, null, null, null, replacementText); }
public EntityReference createEntityReference(String name, //EntityDeclaration declaration) String replacementText) { //return new EntityReferenceImpl(location, declaration, name); return new EntityReferenceImpl(location, name, null, null, null, replacementText); }
13,952
private String parseXMLDecl(boolean ignoreEncoding) throws SAXException, IOException { String version; String encodingName = null; String standalone = null; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; String inputEncoding = null; switch (this.encoding) { case ENCODING_EXTERNAL: case ENCODING_UTF_8: inputEncoding = "UTF-8"; break; case ENCODING_ISO_8859_1: inputEncoding = "ISO-8859-1"; break; case ENCODING_UCS_2_12: inputEncoding = "UTF-16BE"; break; case ENCODING_UCS_2_21: inputEncoding = "UTF-16LE"; break; } // Read the version. require("version"); parseEq(); checkLegalVersion(version = readLiteral(flags)); if (!version.equals("1.0")) { if (version.equals("1.1")) { handler.warn("expected XML version 1.0, not: " + version); xmlVersion = XML_11; } else { error("illegal XML version", version, "1.0 or 1.1"); } } else { xmlVersion = XML_10; } // Try reading an encoding declaration. boolean white = tryWhitespace(); if (tryRead("encoding")) { if (!white) { error("whitespace required before 'encoding='"); } parseEq(); encodingName = readLiteral(flags); if (!ignoreEncoding) { setupDecoding(encodingName); } } // Try reading a standalone declaration if (encodingName != null) { white = tryWhitespace(); } if (tryRead("standalone")) { if (!white) { error("whitespace required before 'standalone='"); } parseEq(); standalone = readLiteral(flags); if ("yes".equals(standalone)) { docIsStandalone = true; } else if (!"no".equals(standalone)) { error("standalone flag must be 'yes' or 'no'"); } } skipWhitespace(); require("?>"); if (inputEncoding == null) { inputEncoding = encodingName; } handler.xmlDecl(version, encodingName, docIsStandalone, inputEncoding); return encodingName; }
private String parseXMLDecl(boolean ignoreEncoding) throws SAXException, IOException { String version; String encodingName = null; String standalone = null; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; String inputEncoding = null; switch (this.encoding) { case ENCODING_EXTERNAL: case ENCODING_UTF_8: inputEncoding = "UTF-8"; break; case ENCODING_ISO_8859_1: inputEncoding = "ISO-8859-1"; break; case ENCODING_UCS_2_12: inputEncoding = "UTF-16BE"; break; case ENCODING_UCS_2_21: inputEncoding = "UTF-16LE"; break; } // Read the version. require("version"); parseEq(); checkLegalVersion(version = readLiteral(flags)); if (!version.equals("1.0")) { if (version.equals("1.1")) { handler.warn("expected XML version 1.0, not: " + version); xmlVersion = XML_11; } else { error("illegal XML version", version, "1.0 or 1.1"); } } else { xmlVersion = XML_10; } // Try reading an encoding declaration. boolean white = tryWhitespace(); if (tryRead("encoding")) { if (!white) { error("whitespace required before 'encoding='"); } parseEq(); encodingName = readLiteral(flags); if (!ignoreEncoding) { setupDecoding(encodingName); } } // Try reading a standalone declaration if (encodingName != null) { white = tryWhitespace(); } if (tryRead("standalone")) { if (!white) { error("whitespace required before 'standalone='"); } parseEq(); standalone = readLiteral(flags); if ("yes".equals(standalone)) { docIsStandalone = true; } else if (!"no".equals(standalone)) { error("standalone flag must be 'yes' or 'no'"); } } skipWhitespace(); require("?>"); if (inputEncoding == null) { inputEncoding = encodingName; } handler.xmlDecl(version, encodingName, docIsStandalone, inputEncoding); return encodingName; }
13,953
public Response dispatch() throws IOException { if (dispatched) { throw new ProtocolException("request already dispatched"); } final String CRLF = "\r\n"; final String HEADER_SEP = ": "; final String US_ASCII = "US-ASCII"; final String version = connection.getVersion(); Response response; int contentLength = -1; boolean retry = false; int attempts = 0; boolean expectingContinue = false; if (requestBodyWriter != null) { contentLength = requestBodyWriter.getContentLength(); if (contentLength > requestBodyNegotiationThreshold) { expectingContinue = true; setHeader("Expect", "100-continue"); } else { setHeader("Content-Length", Integer.toString(contentLength)); } } try { // Loop while authentication fails or continue do { retry = false; // Send request connection.fireRequestEvent(RequestEvent.REQUEST_SENDING, this); // Get socket output and input streams OutputStream out = connection.getOutputStream(); LineInputStream in = new LineInputStream(connection.getInputStream()); // Request line String requestUri = path; if (connection.isUsingProxy() && !"*".equals(requestUri) && !"CONNECT".equals(method)) { requestUri = getRequestURI(); } String line = method + ' ' + requestUri + ' ' + version + CRLF; out.write(line.getBytes(US_ASCII)); // Request headers for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) { String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; out.write(line.getBytes(US_ASCII)); } out.write(CRLF.getBytes(US_ASCII)); // Request body if (requestBodyWriter != null && !expectingContinue) { byte[] buffer = new byte[4096]; int len; int count = 0; requestBodyWriter.reset(); do { len = requestBodyWriter.write(buffer); if (len > 0) { out.write(buffer, 0, len); } count += len; } while (len > -1 && count < contentLength); out.write(CRLF.getBytes(US_ASCII)); } out.flush(); // Sent event connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this); // Get response response = readResponse(in); int sc = response.getCode(); if (sc == 401 && authenticator != null) { if (authenticate(response, attempts++)) { retry = true; } } else if (sc == 100 && expectingContinue) { requestHeaders.remove("Expect"); setHeader("Content-Length", Integer.toString(contentLength)); expectingContinue = false; retry = true; } } while (retry); } catch (IOException e) { connection.close(); throw e; } return response; }
public Response dispatch() throws IOException { if (dispatched) { throw new ProtocolException("request already dispatched"); } final String CRLF = "\r\n"; final String HEADER_SEP = ": "; final String US_ASCII = "US-ASCII"; final String version = connection.getVersion(); Response response; int contentLength = -1; boolean retry = false; int attempts = 0; boolean expectingContinue = false; if (requestBodyWriter != null) { contentLength = requestBodyWriter.getContentLength(); if (contentLength > requestBodyNegotiationThreshold) { expectingContinue = true; setHeader("Expect", "100-continue"); } else { setHeader("Content-Length", Integer.toString(contentLength)); } } try { // Loop while authentication fails or continue do { retry = false; // Send request // Get socket output and input streams OutputStream out = connection.getOutputStream(); LineInputStream in = new LineInputStream(connection.getInputStream()); // Request line String requestUri = path; if (connection.isUsingProxy() && !"*".equals(requestUri) && !"CONNECT".equals(method)) { requestUri = getRequestURI(); } String line = method + ' ' + requestUri + ' ' + version + CRLF; out.write(line.getBytes(US_ASCII)); // Request headers for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) { String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; out.write(line.getBytes(US_ASCII)); } out.write(CRLF.getBytes(US_ASCII)); // Request body if (requestBodyWriter != null && !expectingContinue) { byte[] buffer = new byte[4096]; int len; int count = 0; requestBodyWriter.reset(); do { len = requestBodyWriter.write(buffer); if (len > 0) { out.write(buffer, 0, len); } count += len; } while (len > -1 && count < contentLength); out.write(CRLF.getBytes(US_ASCII)); } out.flush(); // Sent event connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this); // Get response response = readResponse(in); int sc = response.getCode(); if (sc == 401 && authenticator != null) { if (authenticate(response, attempts++)) { retry = true; } } else if (sc == 100 && expectingContinue) { requestHeaders.remove("Expect"); setHeader("Content-Length", Integer.toString(contentLength)); expectingContinue = false; retry = true; } } while (retry); } catch (IOException e) { connection.close(); throw e; } return response; }
13,954