rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public DataFlavor(String mimeType) throws ClassNotFoundException
public DataFlavor()
public DataFlavor(String mimeType) throws ClassNotFoundException { this(mimeType, null); }
this(mimeType, null);
mimeType = null; representationClass = null; humanPresentableName = null;
public DataFlavor(String mimeType) throws ClassNotFoundException { this(mimeType, null); }
public String getParameter(String paramName)
private static String getParameter(String paramName, String mimeString)
public String getParameter(String paramName) { if ("humanPresentableName".equals(paramName)) return getHumanPresentableName(); return getParameter(paramName, mimeType); }
if ("humanPresentableName".equals(paramName)) return getHumanPresentableName(); return getParameter(paramName, mimeType);
int idx = mimeString.indexOf(paramName + "="); if (idx == -1) return(null); String value = mimeString.substring(idx + paramName.length() + 1); idx = value.indexOf(" "); if (idx == -1) return(value); else return(value.substring(0, idx));
public String getParameter(String paramName) { if ("humanPresentableName".equals(paramName)) return getHumanPresentableName(); return getParameter(paramName, mimeType); }
throws IOException, ClassNotFoundException
throws IOException, ClassNotFoundException, NotImplementedException
public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException { // FIXME: Implement me }
public void writeExternal(ObjectOutput stream) throws IOException
public void writeExternal(ObjectOutput stream) throws IOException, NotImplementedException
public void writeExternal(ObjectOutput stream) throws IOException { // FIXME: Implement me }
throw new PatternSyntaxException(e.getMessage(),
PatternSyntaxException pse; pse = new PatternSyntaxException(e.getMessage(),
private Pattern (String regex, int flags) throws PatternSyntaxException { this.regex = regex; this.flags = flags; int gnuFlags = 0; if ((flags & CASE_INSENSITIVE) != 0) gnuFlags |= RE.REG_ICASE; if ((flags & MULTILINE) != 0) gnuFlags |= RE.REG_MULTILINE; if ((flags & DOTALL) != 0) gnuFlags |= RE.REG_DOT_NEWLINE; // not yet supported: // if ((flags & UNICODE_CASE) != 0) gnuFlags = // if ((flags & CANON_EQ) != 0) gnuFlags = RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4; if ((flags & UNIX_LINES) != 0) { // Use a syntax set with \n for linefeeds? syntax = new RESyntax(syntax); syntax.setLineSeparator("\n"); } if ((flags & COMMENTS) != 0) { // Use a syntax with support for comments? } try { this.re = new RE(regex, gnuFlags, syntax); } catch (REException e) { throw new PatternSyntaxException(e.getMessage(), regex, e.getPosition()); } }
pse.initCause(e); throw pse;
private Pattern (String regex, int flags) throws PatternSyntaxException { this.regex = regex; this.flags = flags; int gnuFlags = 0; if ((flags & CASE_INSENSITIVE) != 0) gnuFlags |= RE.REG_ICASE; if ((flags & MULTILINE) != 0) gnuFlags |= RE.REG_MULTILINE; if ((flags & DOTALL) != 0) gnuFlags |= RE.REG_DOT_NEWLINE; // not yet supported: // if ((flags & UNICODE_CASE) != 0) gnuFlags = // if ((flags & CANON_EQ) != 0) gnuFlags = RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4; if ((flags & UNIX_LINES) != 0) { // Use a syntax set with \n for linefeeds? syntax = new RESyntax(syntax); syntax.setLineSeparator("\n"); } if ((flags & COMMENTS) != 0) { // Use a syntax with support for comments? } try { this.re = new RE(regex, gnuFlags, syntax); } catch (REException e) { throw new PatternSyntaxException(e.getMessage(), regex, e.getPosition()); } }
int len = dst.capacity() - dst.position();
int len = dst.remaining();
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.capacity() - dst.position(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
if (maximum != old) firePropertyChange("maximum", old, maximum);
public void setMaximum(int maximum) { sliderModel.setMaximum(maximum); }
if (minimum != old) firePropertyChange("minimum", old, minimum);
public void setMinimum(int minimum) { sliderModel.setMinimum(minimum); }
boolean oldPaintLabels = paintLabels;
public void setPaintLabels(boolean paint) { if (paint != paintLabels) { boolean oldPaintLabels = paintLabels; paintLabels = paint; firePropertyChange("paintLabels", oldPaintLabels, paintLabels); } }
firePropertyChange("paintLabels", oldPaintLabels, paintLabels);
if (paint && majorTickSpacing > 0) labelTable = createStandardLabels(majorTickSpacing); firePropertyChange("paintLabels", !paint, paint);
public void setPaintLabels(boolean paint) { if (paint != paintLabels) { boolean oldPaintLabels = paintLabels; paintLabels = paint; firePropertyChange("paintLabels", oldPaintLabels, paintLabels); } }
firePropertyChange("paintTrack", !paint, paint); }
public void setPaintTrack(boolean paint) { paintTrack = paint; }
fireStateChanged();
firePropertyChange("snapToTicks", !snap, snap);
public void setSnapToTicks(boolean snap) { if (snap != snapToTicks) { snapToTicks = snap; fireStateChanged(); } }
public boolean intersects(Rectangle2D r)
public boolean intersects(double x, double y, double w, double h)
public boolean intersects(Rectangle2D r) { return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight()); }
return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
if (w <= 0 || h <= 0) return false; double x1 = getX1(); double y1 = getY1(); double x2 = getX2(); double y2 = getY2(); if (x1 >= x && x1 <= x + w && y1 >= y && y1 <= y + h) return true; if (x2 >= x && x2 <= x + w && y2 >= y && y2 <= y + h) return true; double x3 = x + w; double y3 = y + h; return (linesIntersect(x1, y1, x2, y2, x, y, x, y3) || linesIntersect(x1, y1, x2, y2, x, y3, x3, y3) || linesIntersect(x1, y1, x2, y2, x3, y3, x3, y) || linesIntersect(x1, y1, x2, y2, x3, y, x, y));
public boolean intersects(Rectangle2D r) { return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight()); }
repaint();
public FrameWrapper(JInternalFrame iFrame) { this.frame = iFrame; this.setText(iFrame.getTitle()); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { JInternalFrame frame = FrameWrapper.this.frame; frame.setIcon(false); frame.getDesktopPane().setSelectedFrame(frame); } catch (PropertyVetoException ex) { //igonre } } }); this.frame.addInternalFrameListener(new InternalFrameListener() { public void internalFrameActivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.WHITE); } public void internalFrameClosed(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameClosing(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameDeactivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.LIGHT_GRAY); } public void internalFrameDeiconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameIconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameOpened(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } }); final JPopupMenu frameActions = new JPopupMenu(); JMenuItem minimize = new JMenuItem("Minimize"); frameActions.add(minimize); minimize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setIcon(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem maximize = new JMenuItem("Maximize"); frameActions.add(maximize); maximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setMaximum(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem close = new JMenuItem("Close"); frameActions.add(close); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setClosed(true); }catch(PropertyVetoException e){ //ignore } } }); this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { Point p = FrameWrapper.this.getLocationOnScreen(); int h = frameActions.getPreferredSize().height; frameActions.show(frame.getDesktopPane(), p.x, p.y - h); } } } }); }
removeFrame(FrameWrapper.this.frame);
public void internalFrameClosed(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); }
removeFrame(FrameWrapper.this.frame);
public void internalFrameClosing(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); }
repaint();
public void internalFrameDeiconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. }
repaint();
public void internalFrameIconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. }
public boolean add(E o)
public void add(int index, E o)
public boolean add(E o) { add(size(), o); return true; }
add(size(), o); return true;
throw new UnsupportedOperationException();
public boolean add(E o) { add(size(), o); return true; }
final int LEFT_TO_RIGHT = Character.DIRECTIONALITY_LEFT_TO_RIGHT;
public static boolean requiresBidi(char[] text, int start, int end) { final int LEFT_TO_RIGHT = Character.DIRECTIONALITY_LEFT_TO_RIGHT; for (int i = start; i < end; i++) { char c = text[i]; if (Character.getDirectionality(c) != LEFT_TO_RIGHT) return true; } return false; }
char c = text[i]; if (Character.getDirectionality(c) != LEFT_TO_RIGHT)
byte dir = Character.getDirectionality(text[i]); if (dir != Character.DIRECTIONALITY_LEFT_TO_RIGHT && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR && dir != Character.DIRECTIONALITY_ARABIC_NUMBER && dir != Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR && dir != Character.DIRECTIONALITY_SEGMENT_SEPARATOR && dir != Character.DIRECTIONALITY_WHITESPACE)
public static boolean requiresBidi(char[] text, int start, int end) { final int LEFT_TO_RIGHT = Character.DIRECTIONALITY_LEFT_TO_RIGHT; for (int i = start; i < end; i++) { char c = text[i]; if (Character.getDirectionality(c) != LEFT_TO_RIGHT) return true; } return false; }
if (IS_PREFIX_DEFAULTING.equals(name))
if (IS_REPAIRING_NAMESPACES.equals(name))
public Object getProperty(String name) throws IllegalArgumentException { if (IS_PREFIX_DEFAULTING.equals(name)) return new Boolean(prefixDefaulting); throw new IllegalArgumentException(name); }
if (IS_PREFIX_DEFAULTING.equals(name))
if (IS_REPAIRING_NAMESPACES.equals(name))
public boolean isPropertySupported(String name) { if (IS_PREFIX_DEFAULTING.equals(name)) return true; return false; }
if (IS_PREFIX_DEFAULTING.equals(name))
if (IS_REPAIRING_NAMESPACES.equals(name))
public void setProperty(String name, Object value) throws IllegalArgumentException { if (IS_PREFIX_DEFAULTING.equals(name)) prefixDefaulting = ((Boolean) value).booleanValue(); else throw new IllegalArgumentException(name); }
log.setLevel(Level.INFO);
public Ext2FileSystem(Device device, boolean readOnly) throws FileSystemException { super(device, readOnly); blockCache = new BlockCache(50,(float)0.75); inodeCache = new INodeCache(50,(float)0.75); //groupDescriptorLock = new Object(); //superblockLock = new Object(); }
long iNodeTableBlock = groupDescriptors[0].getInodeTable(); INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock);
INodeTable iNodeTable = iNodeTables[0];
protected FSEntry buildRootEntry() throws IOException { //a free inode has been found: create the inode and write it into the inode table long iNodeTableBlock = groupDescriptors[0].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); //byte[] iNodeData = new byte[INode.INODE_LENGTH]; int iNodeNr = Ext2Constants.EXT2_ROOT_INO; INode iNode = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, 0, iNodeNr-1)); int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); iNode.create( Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); //trigger a write to disk iNode.update(); //add the inode to the inode cache synchronized(inodeCache) { inodeCache.put(new Integer(Ext2Constants.EXT2_ROOT_INO), iNode); } modifyUsedDirsCount(0, 1); Ext2Entry rootEntry = new Ext2Entry(iNode,"/",Ext2Constants.EXT2_FT_DIR, this, null); ((Ext2Directory)rootEntry.getDirectory()).addINode(Ext2Constants.EXT2_ROOT_INO, ".", Ext2Constants.EXT2_FT_DIR); ((Ext2Directory)rootEntry.getDirectory()).addINode(Ext2Constants.EXT2_ROOT_INO, "..", Ext2Constants.EXT2_FT_DIR); rootEntry.getDirectory().addDirectory("lost+found"); return rootEntry; }
iNodeTables[i] = new INodeTable(this, (int)iNodeTableBlock);
public void create(int blockSize) throws FileSystemException { try{ //create the superblock superblock = new Superblock(); superblock.create(blockSize, this); //create the group descriptors groupCount = (int)Math.ceil((double)superblock.getBlocksCount() / (double)superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for(int i=0; i<groupCount; i++) { groupDescriptors[i]=new GroupDescriptor(); groupDescriptors[i].create(i, this); } //create each block group: // create the block bitmap // create the inode bitmap // fill the inode table with zeroes for(int i=0; i<groupCount; i++) { log.debug("creating gropup "+i); byte[] blockBitmap = new byte[blockSize]; byte[] inodeBitmap = new byte[blockSize]; //update the block bitmap: mark the metadata blocks allocated long iNodeTableBlock = groupDescriptors[i].getInodeTable(); long firstNonMetadataBlock = iNodeTableBlock + INodeTable.getSizeInBlocks(this); int metadataLength = (int)(firstNonMetadataBlock - (superblock.getFirstDataBlock() + i*superblock.getBlocksPerGroup())); for(int j=0; j<metadataLength; j++) BlockBitmap.setBit(blockBitmap, j); //set the padding at the end of the last block group if(i == groupCount-1) { for(long k=superblock.getBlocksCount(); k<groupCount*superblock.getBlocksPerGroup(); k++) BlockBitmap.setBit(blockBitmap,(int) (k % superblock.getBlocksPerGroup())); } //update the inode bitmap: mark the special inodes allocated in the first block group if(i==0) for(int j=0; j<superblock.getFirstInode()-1; j++) INodeBitmap.setBit(inodeBitmap, j); //create an empty inode table byte[] emptyBlock = new byte[blockSize]; for(long j=iNodeTableBlock; j<firstNonMetadataBlock; j++) writeBlock(j, emptyBlock, false); writeBlock(groupDescriptors[i].getBlockBitmap(), blockBitmap, false); writeBlock(groupDescriptors[i].getInodeBitmap(), inodeBitmap, false); } log.info("superblock.getBlockSize(): "+superblock.getBlockSize()); buildRootEntry(); //write everything to disk flush(); }catch (IOException ioe) { throw new FileSystemException("Unable to create filesystem", ioe); } }
long iNodeTableBlock = groupDescriptors[preferredBlockBroup].getInodeTable(); INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock);
INodeTable iNodeTable = iNodeTables[preferredBlockBroup];
protected INode createINode(int preferredBlockBroup, int fileFormat, int accessRights, int uid, int gid) throws FileSystemException, IOException { if(preferredBlockBroup >= superblock.getBlocksCount()) throw new FileSystemException("Block group "+preferredBlockBroup+" does not exist"); int groupNr = preferredBlockBroup; //first check the preferred block group, if it has any free inodes INodeReservation res = findFreeINode( groupNr ); //if no free inode has been found in the preferred block group, then try the others if(!res.isSuccessful()) { for(groupNr=0; groupNr<superblock.getBlockGroupNr(); groupNr++) { res = findFreeINode( groupNr ); if(res.isSuccessful()){ break; } } } if(!res.isSuccessful()) throw new FileSystemException("No free inodes found!"); //a free inode has been found: create the inode and write it into the inode table long iNodeTableBlock = groupDescriptors[preferredBlockBroup].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); //byte[] iNodeData = new byte[INode.INODE_LENGTH]; int iNodeNr = res.getINodeNr((int)superblock.getINodesPerGroup()); INode iNode = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, groupNr, res.getIndex())); iNode.create( fileFormat, accessRights, uid, gid); //trigger a write to disk iNode.update(); log.debug("** NEW INODE ALLOCATED: inode number: "+iNode.getINodeNr()); //put the inode into the cache synchronized(inodeCache) { Integer key = new Integer(iNodeNr); if(inodeCache.containsKey(key)) throw new FileSystemException("Newly allocated inode is already in the inode cache!?"); else inodeCache.put(key, iNode); } return iNode; }
log.debug("Reading block "+nr+" (offset: "+nr*blockSize+") from disk");
public byte[] getBlock(long nr) throws IOException{ if(isClosed()) throw new IOException("FS closed (fs instance: "+this+")"); //log.debug("blockCache size: "+blockCache.size()); int blockSize = superblock.getBlockSize(); Block result; Integer key=new Integer((int)(nr)); synchronized(blockCache) { //check if the block has already been retrieved if(blockCache.containsKey(key)) { result=(Block)blockCache.get(key); return result.getData(); } } //perform the time-consuming disk read outside of the synchronized block //advantage: // -the lock is held for a shorter time, so other blocks that are // already in the cache can be returned immediately and // do not have to wait for a long disk read //disadvantage: // -a single block can be retrieved more than once. However, // the block will be put in the cache only once in the second // synchronized block byte[] data = new byte[blockSize]; getApi().read( nr*blockSize, data, 0, blockSize ); //synchronize again synchronized(blockCache) { //check if the block has already been retrieved if(!blockCache.containsKey(key)) { result=new Block(this, nr, data); blockCache.put(key, result); return result.getData(); } else { //it is important to ALWAYS return the block that is in //the cache (it is used in synchronization) result=(Block)blockCache.get(key); return result.getData(); } } }
else{ int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup());
}
public INode getINode(int iNodeNr) throws IOException, FileSystemException{ if((iNodeNr<1)||(iNodeNr>superblock.getINodesCount())) throw new FileSystemException("INode number ("+iNodeNr+") out of range (0-"+superblock.getINodesCount()+")"); Integer key=new Integer(iNodeNr); //log.debug("iNodeCache size: "+inodeCache.size()); synchronized(inodeCache) { //check if the inode is already in the cache if(inodeCache.containsKey(key)) return (INode)inodeCache.get(key); else{ int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); //get the part of the inode table that contains the inode long iNodeTableBlock = groupDescriptors[group].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); INode result = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, group, index)); result.read(iNodeTable.getInodeData(index)); inodeCache.put(key, result); return result; } } }
long iNodeTableBlock = groupDescriptors[group].getInodeTable(); INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); INode result = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, group, index)); result.read(iNodeTable.getInodeData(index));
int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); INodeTable iNodeTable = iNodeTables[group]; INode result = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, group, index)); result.read(iNodeTable.getInodeData(index));
public INode getINode(int iNodeNr) throws IOException, FileSystemException{ if((iNodeNr<1)||(iNodeNr>superblock.getINodesCount())) throw new FileSystemException("INode number ("+iNodeNr+") out of range (0-"+superblock.getINodesCount()+")"); Integer key=new Integer(iNodeNr); //log.debug("iNodeCache size: "+inodeCache.size()); synchronized(inodeCache) { //check if the inode is already in the cache if(inodeCache.containsKey(key)) return (INode)inodeCache.get(key); else{ int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); //get the part of the inode table that contains the inode long iNodeTableBlock = groupDescriptors[group].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); INode result = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, group, index)); result.read(iNodeTable.getInodeData(index)); inodeCache.put(key, result); return result; } } }
}
} else return (INode)inodeCache.get(key);
public INode getINode(int iNodeNr) throws IOException, FileSystemException{ if((iNodeNr<1)||(iNodeNr>superblock.getINodesCount())) throw new FileSystemException("INode number ("+iNodeNr+") out of range (0-"+superblock.getINodesCount()+")"); Integer key=new Integer(iNodeNr); //log.debug("iNodeCache size: "+inodeCache.size()); synchronized(inodeCache) { //check if the inode is already in the cache if(inodeCache.containsKey(key)) return (INode)inodeCache.get(key); else{ int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); //get the part of the inode table that contains the inode long iNodeTableBlock = groupDescriptors[group].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int)iNodeTableBlock); INode result = new INode(this, new INodeDescriptor(iNodeTable, iNodeNr, group, index)); result.read(iNodeTable.getInodeData(index)); inodeCache.put(key, result); return result; } } }
iNodeTables[i] = new INodeTable(this, (int)groupDescriptors[i].getInodeTable());
public void read() throws FileSystemException { byte data[]; try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock //TODO: the superblock should read itself getApi().read(1024, data, 0, Superblock.SUPERBLOCK_LENGTH); //superblock = new Superblock(data, this); superblock = new Superblock(); superblock.read(data, this); //read the group descriptors groupCount = (int)Math.ceil((double)superblock.getBlocksCount() / (double)superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for(int i=0; i<groupCount; i++) { //groupDescriptors[i]=new GroupDescriptor(i, this); groupDescriptors[i]=new GroupDescriptor(); groupDescriptors[i].read(i, this); } } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } //check for unsupported filesystem options //(an unsupported INCOMPAT feature means that the fs may not be mounted at all) if( hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_COMPRESSION) ) throw new FileSystemException(getDevice().getId()+" Unsupported filesystem feature (COMPRESSION) disallows mounting"); if( hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_META_BG) ) throw new FileSystemException(getDevice().getId()+" Unsupported filesystem feature (META_BG) disallows mounting"); if( hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) ) throw new FileSystemException(getDevice().getId()+" Unsupported filesystem feature (JOURNAL_DEV) disallows mounting"); if( hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_RECOVER) ) throw new FileSystemException(getDevice().getId()+" Unsupported filesystem feature (RECOVER) disallows mounting"); //an unsupported RO_COMPAT feature means that the filesystem can only be mounted readonly if( hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_LARGE_FILE)) { log.info(getDevice().getId()+" Unsupported filesystem feature (LARGE_FILE) forces readonly mode"); setReadOnly(true); } if( hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_BTREE_DIR)) { log.info(getDevice().getId()+" Unsupported filesystem feature (BTREE_DIR) forces readonly mode"); setReadOnly(true); } //if the filesystem has not been cleanly unmounted, mount it readonly if(superblock.getState()==Ext2Constants.EXT2_ERROR_FS) { log.info(getDevice().getId()+" Filesystem has not been cleanly unmounted, mounting it readonly"); setReadOnly(true); } //if the filesystem has been mounted R/W, set it to "unclean" if(!isReadOnly()) { log.info(getDevice().getId()+" mounting fs r/w"); superblock.setState(Ext2Constants.EXT2_ERROR_FS); } //log.info( "Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: "+superblock.getBlocksCount()+"\n"+ " #blocks/group: "+superblock.getBlocksPerGroup()+"\n"+ " #block groups: "+groupCount+"\n"+ " block size: "+superblock.getBlockSize()+"\n"+ " #inodes: "+superblock.getINodesCount()+"\n"+ " #inodes/group: "+superblock.getINodesPerGroup()); }
return new Ext2Directory( iNode );
return new Ext2Directory( iNode, fs );
public FSDirectory getDirectory() throws IOException { if(isDirectory()) return new Ext2Directory( iNode ); else throw new IOException("Not a directory"); }
abstract public boolean isUserNode();
public boolean isUserNode() { AbstractPreferences root = this; while (root.parent != null) root = root.parent; return root == Preferences.userRoot(); }
abstract public boolean isUserNode();
public abstract ShortBuffer put (short b);
public ShortBuffer put (ShortBuffer src) { if (src == this) throw new IllegalArgumentException (); checkForOverflow(src.remaining ()); if (src.remaining () > 0) { short[] toPut = new short [src.remaining ()]; src.get (toPut); put (toPut); } return this; }
public abstract ShortBuffer put (short b);
Class c = cl.loadClass(className);
Class<?> c = cl.loadClass(className);
private void addEntry(ConfigurationElement element){ final String className = element.getAttribute("class"); final String entryName = element.getAttribute("name"); if (className != null) { try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); Class c = cl.loadClass(className); Object o = c.newInstance(); ExtFSEntry entry = (ExtFSEntry)o; if (entry.getName()==null){ if (entryName!=null){ entry.setName(entryName); } else { entry.setName(className); } } entry.setParent(extdir); FSEntry add = (FSEntry)entry; extdir.addFSE(add); } catch (ClassCastException ex) { log.error( "Given class " + className + " does not implement ."); } catch (ClassNotFoundException ex) { log.error("Cannot load " + className); } catch (IllegalAccessException ex) { log.error("No access to " + className); } catch (InstantiationException ex) { log.error(ex); } catch (IOException ex){ log.error("could not set name of file: "+ entryName ); } } }
{
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new ValueOfNode(select.clone(stylesheet), disableOutputEscaping); 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 ValueOfNode(select.clone(stylesheet), disableOutputEscaping); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
{
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = select.evaluate(context, pos, len); /*if (stylesheet.debug) { System.err.println("value-of: " + select + " -> " + ret); }*/ String value; if (ret instanceof Collection) { StringBuffer buf = new StringBuffer(); for (Iterator i = ((Collection) ret).iterator(); i.hasNext(); ) { Node node = (Node) i.next(); buf.append(Expr.stringValue(node)); } value = buf.toString(); } else { value = Expr._string(context, ret); } if (stylesheet.debug) { System.err.println("value-of: "+context+" "+ select + " -> "+ value); } if (value != null && value.length() > 0) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); Text textNode = doc.createTextNode(value); if (disableOutputEscaping) { textNode.setUserData("disable-output-escaping", "yes", stylesheet); } if (nextSibling != null) { parent.insertBefore(textNode, nextSibling); } else { parent.appendChild(textNode); } } // value-of doesn't process children 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 { Object ret = select.evaluate(context, pos, len); /*if (stylesheet.debug) { System.err.println("value-of: " + select + " -> " + ret); }*/ String value; if (ret instanceof Collection) { StringBuffer buf = new StringBuffer(); for (Iterator i = ((Collection) ret).iterator(); i.hasNext(); ) { Node node = (Node) i.next(); buf.append(Expr.stringValue(node)); } value = buf.toString(); } else { value = Expr._string(context, ret); } if (stylesheet.debug) { System.err.println("value-of: "+context+" "+ select + " -> "+ value); } if (value != null && value.length() > 0) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); Text textNode = doc.createTextNode(value); if (disableOutputEscaping) { textNode.setUserData("disable-output-escaping", "yes", stylesheet); } if (nextSibling != null) { parent.insertBefore(textNode, nextSibling); } else { parent.appendChild(textNode); } } // value-of doesn't process children if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
StringBuffer buf = new StringBuffer(getClass().getName());
StringBuffer buf = new StringBuffer("value-of");
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("select="); buf.append(select); if (disableOutputEscaping) { buf.append(",disableOutputEscaping"); } buf.append(']'); return buf.toString(); }
{
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("select="); buf.append(select); if (disableOutputEscaping) { buf.append(",disableOutputEscaping"); } buf.append(']'); return buf.toString(); }
}
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("select="); buf.append(select); if (disableOutputEscaping) { buf.append(",disableOutputEscaping"); } buf.append(']'); return buf.toString(); }
public CharSeqHolder(char[] initial_value)
public CharSeqHolder()
public CharSeqHolder(char[] initial_value) { value = initial_value; typecode.setLength(value.length); }
value = initial_value; typecode.setLength(value.length);
public CharSeqHolder(char[] initial_value) { value = initial_value; typecode.setLength(value.length); }
return Class.forName(getValue(cmdLine));
final ClassLoader cl = Thread.currentThread().getContextClassLoader(); return cl.loadClass(getValue(cmdLine));
public Class getClass(ParsedArguments cmdLine) throws ClassNotFoundException { return Class.forName(getValue(cmdLine)); }
synchronized (this) { Rectangle newRect = e.getUpdateRect(); if (paintArea == null) paintArea = newRect; else Rectangle.union(paintArea, newRect, paintArea); }
public void coalescePaintEvent(PaintEvent e) { // Nothing to do here yet. }
if (! (this instanceof LightweightPeer)) { Component comp = awtComponent; Container parent = comp.getParent(); while (parent != null && ! (parent.getPeer() instanceof SwingContainerPeer)) { comp = parent; parent = comp.getParent(); } if (parent != null && parent.getPeer() instanceof SwingContainerPeer) { SwingContainerPeer p = (SwingContainerPeer) parent.getPeer(); p.removeHeavyweightDescendent(awtComponent); } }
public void dispose() { awtComponent = null; swingComponent = null; }
ComponentPeer parentPeer = parent.getPeer(); Graphics g = parentPeer.getGraphics();
Graphics g = parent.getGraphics();
public Graphics getGraphics() { Component parent = awtComponent.getParent(); ComponentPeer parentPeer = parent.getPeer(); Graphics g = parentPeer.getGraphics(); g.translate(awtComponent.getX(), awtComponent.getY()); g.setClip(0, 0, awtComponent.getWidth(), awtComponent.getHeight()); return g; }
synchronized (this) { assert paintArea != null;
public void handleEvent(AWTEvent e) { switch (e.getID()) { case PaintEvent.UPDATE: case PaintEvent.PAINT: // This only will work when the component is showing. if (awtComponent.isShowing()) { Graphics g = getGraphics(); Rectangle clip = ((PaintEvent)e).getUpdateRect(); g.clipRect(clip.x, clip.y, clip.width, clip.height); //if (this instanceof LightweightPeer) // { if (e.getID() == PaintEvent.UPDATE) awtComponent.update(g); else awtComponent.paint(g); // } // We paint the 'heavyweights' at last, so that they appear on top of // everything else. peerPaint(g); g.dispose(); } break; case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: handleMouseEvent((MouseEvent) e); break; case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: handleMouseMotionEvent((MouseEvent) e); break; case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: handleKeyEvent((KeyEvent) e); break; default: // Other event types are not handled here. break; } }
Graphics g = getGraphics(); Rectangle clip = ((PaintEvent)e).getUpdateRect();
Graphics g = awtComponent.getGraphics(); try { Rectangle clip = paintArea;
public void handleEvent(AWTEvent e) { switch (e.getID()) { case PaintEvent.UPDATE: case PaintEvent.PAINT: // This only will work when the component is showing. if (awtComponent.isShowing()) { Graphics g = getGraphics(); Rectangle clip = ((PaintEvent)e).getUpdateRect(); g.clipRect(clip.x, clip.y, clip.width, clip.height); //if (this instanceof LightweightPeer) // { if (e.getID() == PaintEvent.UPDATE) awtComponent.update(g); else awtComponent.paint(g); // } // We paint the 'heavyweights' at last, so that they appear on top of // everything else. peerPaint(g); g.dispose(); } break; case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: handleMouseEvent((MouseEvent) e); break; case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: handleMouseMotionEvent((MouseEvent) e); break; case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: handleKeyEvent((KeyEvent) e); break; default: // Other event types are not handled here. break; } }
if (e.getID() == PaintEvent.UPDATE) awtComponent.update(g); else awtComponent.paint(g); peerPaint(g);
peerPaint(g, e.getID() == PaintEvent.UPDATE); } finally {
public void handleEvent(AWTEvent e) { switch (e.getID()) { case PaintEvent.UPDATE: case PaintEvent.PAINT: // This only will work when the component is showing. if (awtComponent.isShowing()) { Graphics g = getGraphics(); Rectangle clip = ((PaintEvent)e).getUpdateRect(); g.clipRect(clip.x, clip.y, clip.width, clip.height); //if (this instanceof LightweightPeer) // { if (e.getID() == PaintEvent.UPDATE) awtComponent.update(g); else awtComponent.paint(g); // } // We paint the 'heavyweights' at last, so that they appear on top of // everything else. peerPaint(g); g.dispose(); } break; case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: handleMouseEvent((MouseEvent) e); break; case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: handleMouseMotionEvent((MouseEvent) e); break; case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: handleKeyEvent((KeyEvent) e); break; default: // Other event types are not handled here. break; } }
paintArea = null; } }
public void handleEvent(AWTEvent e) { switch (e.getID()) { case PaintEvent.UPDATE: case PaintEvent.PAINT: // This only will work when the component is showing. if (awtComponent.isShowing()) { Graphics g = getGraphics(); Rectangle clip = ((PaintEvent)e).getUpdateRect(); g.clipRect(clip.x, clip.y, clip.width, clip.height); //if (this instanceof LightweightPeer) // { if (e.getID() == PaintEvent.UPDATE) awtComponent.update(g); else awtComponent.paint(g); // } // We paint the 'heavyweights' at last, so that they appear on top of // everything else. peerPaint(g); g.dispose(); } break; case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: handleMouseEvent((MouseEvent) e); break; case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: handleMouseMotionEvent((MouseEvent) e); break; case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: handleKeyEvent((KeyEvent) e); break; default: // Other event types are not handled here. break; } }
if (swingComponent != null) { JComponent c = swingComponent.getJComponent(); if (c != null) { c.addNotify(); RepaintManager.currentManager(c).setDoubleBufferingEnabled(false); System.setProperty("gnu.awt.swing.doublebuffering", "true"); } } if (! (this instanceof LightweightPeer)) { Component comp = awtComponent; Container parent = comp.getParent(); while (parent != null && ! (parent.getPeer() instanceof SwingContainerPeer)) { comp = parent; parent = comp.getParent(); } if (parent != null && parent.getPeer() instanceof SwingContainerPeer) { SwingContainerPeer p = (SwingContainerPeer) parent.getPeer(); p.addHeavyweightDescendent(awtComponent); } }
protected void init(Component awtComp, SwingComponent swingComp) { awtComponent = awtComp; swingComponent = swingComp; }
peerPaint(graphics, false);
public void paint(Graphics graphics) { // FIXME: I don't know what this method is supposed to do. }
protected void peerPaint(Graphics g)
protected void peerPaint(Graphics g, boolean update)
protected void peerPaint(Graphics g) { if (swingComponent != null) swingComponent.getJComponent().paint(g); }
if (swingComponent != null) swingComponent.getJComponent().paint(g);
peerPaintComponent(g); Graphics userGraphics = g.create(); try{ if (update) awtComponent.update(userGraphics); else awtComponent.paint(userGraphics); } finally { userGraphics.dispose(); }
protected void peerPaint(Graphics g) { if (swingComponent != null) swingComponent.getJComponent().paint(g); }
peerFont = font;
public void setFont(Font font) { if (swingComponent != null) swingComponent.getJComponent().setFont(font); }
if (portBounds.height >= viewMinimum.height)
if (portBounds.height >= viewPref.height)
public void layoutContainer(Container parent) { // The way to interpret this function is basically to ignore the names // of methods it calls, and focus on the variable names here. getViewRect // doesn't, for example, return the view; it returns the port bounds in // view space. Likwise setViewPosition doesn't reposition the view; it // positions the port, in view coordinates. JViewport port = (JViewport) parent; Component view = port.getView(); if (view == null) return; // These dimensions and positions are in *view space*. Do not mix // variables in here from port space (eg. parent.getBounds()). This // function should be entirely in view space, because the methods on // the viewport require inputs in view space. Rectangle portBounds = port.getViewRect(); Dimension viewPref = view.getPreferredSize(); Dimension viewMinimum = view.getMinimumSize(); Point portLowerRight = new Point(portBounds.x + portBounds.width, portBounds.y + portBounds.height); // vertical implementation of the above rules if (portBounds.height >= viewMinimum.height) { portBounds.y = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight()) viewPref.height = portBounds.height; } else { viewPref.height = viewMinimum.height; int overextension = portLowerRight.y - viewPref.height; if (overextension > 0) portBounds.y -= overextension; } // horizontal implementation of the above rules if (portBounds.width >= viewMinimum.width) { portBounds.x = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth()) viewPref.width = portBounds.width; } else { viewPref.width = viewMinimum.width; int overextension = portLowerRight.x - viewPref.width; if (overextension > 0) portBounds.x -= overextension; } port.setViewPosition(portBounds.getLocation()); port.setViewSize(viewPref); }
viewPref.height = viewMinimum.height;
public void layoutContainer(Container parent) { // The way to interpret this function is basically to ignore the names // of methods it calls, and focus on the variable names here. getViewRect // doesn't, for example, return the view; it returns the port bounds in // view space. Likwise setViewPosition doesn't reposition the view; it // positions the port, in view coordinates. JViewport port = (JViewport) parent; Component view = port.getView(); if (view == null) return; // These dimensions and positions are in *view space*. Do not mix // variables in here from port space (eg. parent.getBounds()). This // function should be entirely in view space, because the methods on // the viewport require inputs in view space. Rectangle portBounds = port.getViewRect(); Dimension viewPref = view.getPreferredSize(); Dimension viewMinimum = view.getMinimumSize(); Point portLowerRight = new Point(portBounds.x + portBounds.width, portBounds.y + portBounds.height); // vertical implementation of the above rules if (portBounds.height >= viewMinimum.height) { portBounds.y = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight()) viewPref.height = portBounds.height; } else { viewPref.height = viewMinimum.height; int overextension = portLowerRight.y - viewPref.height; if (overextension > 0) portBounds.y -= overextension; } // horizontal implementation of the above rules if (portBounds.width >= viewMinimum.width) { portBounds.x = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth()) viewPref.width = portBounds.width; } else { viewPref.width = viewMinimum.width; int overextension = portLowerRight.x - viewPref.width; if (overextension > 0) portBounds.x -= overextension; } port.setViewPosition(portBounds.getLocation()); port.setViewSize(viewPref); }
if (portBounds.width >= viewMinimum.width)
if (portBounds.width >= viewPref.width)
public void layoutContainer(Container parent) { // The way to interpret this function is basically to ignore the names // of methods it calls, and focus on the variable names here. getViewRect // doesn't, for example, return the view; it returns the port bounds in // view space. Likwise setViewPosition doesn't reposition the view; it // positions the port, in view coordinates. JViewport port = (JViewport) parent; Component view = port.getView(); if (view == null) return; // These dimensions and positions are in *view space*. Do not mix // variables in here from port space (eg. parent.getBounds()). This // function should be entirely in view space, because the methods on // the viewport require inputs in view space. Rectangle portBounds = port.getViewRect(); Dimension viewPref = view.getPreferredSize(); Dimension viewMinimum = view.getMinimumSize(); Point portLowerRight = new Point(portBounds.x + portBounds.width, portBounds.y + portBounds.height); // vertical implementation of the above rules if (portBounds.height >= viewMinimum.height) { portBounds.y = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight()) viewPref.height = portBounds.height; } else { viewPref.height = viewMinimum.height; int overextension = portLowerRight.y - viewPref.height; if (overextension > 0) portBounds.y -= overextension; } // horizontal implementation of the above rules if (portBounds.width >= viewMinimum.width) { portBounds.x = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth()) viewPref.width = portBounds.width; } else { viewPref.width = viewMinimum.width; int overextension = portLowerRight.x - viewPref.width; if (overextension > 0) portBounds.x -= overextension; } port.setViewPosition(portBounds.getLocation()); port.setViewSize(viewPref); }
viewPref.width = viewMinimum.width;
public void layoutContainer(Container parent) { // The way to interpret this function is basically to ignore the names // of methods it calls, and focus on the variable names here. getViewRect // doesn't, for example, return the view; it returns the port bounds in // view space. Likwise setViewPosition doesn't reposition the view; it // positions the port, in view coordinates. JViewport port = (JViewport) parent; Component view = port.getView(); if (view == null) return; // These dimensions and positions are in *view space*. Do not mix // variables in here from port space (eg. parent.getBounds()). This // function should be entirely in view space, because the methods on // the viewport require inputs in view space. Rectangle portBounds = port.getViewRect(); Dimension viewPref = view.getPreferredSize(); Dimension viewMinimum = view.getMinimumSize(); Point portLowerRight = new Point(portBounds.x + portBounds.width, portBounds.y + portBounds.height); // vertical implementation of the above rules if (portBounds.height >= viewMinimum.height) { portBounds.y = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight()) viewPref.height = portBounds.height; } else { viewPref.height = viewMinimum.height; int overextension = portLowerRight.y - viewPref.height; if (overextension > 0) portBounds.y -= overextension; } // horizontal implementation of the above rules if (portBounds.width >= viewMinimum.width) { portBounds.x = 0; if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth()) viewPref.width = portBounds.width; } else { viewPref.width = viewMinimum.width; int overextension = portLowerRight.x - viewPref.width; if (overextension > 0) portBounds.x -= overextension; } port.setViewPosition(portBounds.getLocation()); port.setViewSize(viewPref); }
if (servant != null)
if (servant != null && !noRetain)
public InvokeHandler getHandler(String operation, CookieHolder cookie, boolean forwarding_allowed ) throws gnuForwardRequest { if (servant != null) { return servantToHandler(servant); } else { // Use servant locator to locate the servant. if (poa.servant_locator != null) { try { servant = poa.servant_locator.preinvoke(Id, poa, operation, cookie); return servantToHandler(servant); } catch (org.omg.PortableServer.ForwardRequest forw_ex) { if (forwarding_allowed) { throw new gnuForwardRequest(forw_ex.forward_reference); } else { servant = ForwardedServant.create(forw_ex.forward_reference); return servantToHandler(servant); } } } else // Use servant activator to locate the servant. if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) && poa.applies(ServantRetentionPolicyValue.RETAIN) ) { try { poa.activate_object_with_id(Id, servant, forwarding_allowed); servant = poa.id_to_servant(Id); return servantToHandler(servant); } catch (gnuForwardRequest forwarded) { throw forwarded; } catch (Exception ex) { BAD_OPERATION bad = new BAD_OPERATION("Unable to activate", Minor.Activation, CompletionStatus.COMPLETED_NO ); bad.initCause(ex); throw bad; } } else if (poa.default_servant != null) { servant = poa.default_servant; return servantToHandler(servant); } // No servant and no servant manager - throw exception. else { throw new BAD_OPERATION("Unable to activate", Minor.Activation, CompletionStatus.COMPLETED_NO ); } } }
extendedLoaded = false;
private Provider () { // FIXME: We might need to make the name comparison case insensitive. // Verify this with the Sun JDK. canonicalNames = new HashMap (); charsets = new HashMap (); // US-ASCII aka ISO646-US addCharset (new US_ASCII ()); // ISO-8859-1 aka ISO-LATIN-1 addCharset (new ISO_8859_1 ()); // UTF-8 addCharset (new UTF_8 ()); // UTF-16BE addCharset (new UTF_16BE ()); // UTF-16LE addCharset (new UTF_16LE ()); // UTF-16 addCharset (new UTF_16 ()); }
addCharset (new UnicodeLittle ()); addCharset (new Windows1250 ()); addCharset (new Windows1251 ()); addCharset (new Windows1252 ()); addCharset (new Windows1253 ()); addCharset (new Windows1254 ()); addCharset (new Windows1257 ()); addCharset (new ISO_8859_2 ()); addCharset (new ISO_8859_4 ()); addCharset (new ISO_8859_5 ()); addCharset (new ISO_8859_7 ()); addCharset (new ISO_8859_9 ()); addCharset (new ISO_8859_13 ()); addCharset (new ISO_8859_15 ()); addCharset (new KOI_8 ());
private Provider () { // FIXME: We might need to make the name comparison case insensitive. // Verify this with the Sun JDK. canonicalNames = new HashMap (); charsets = new HashMap (); // US-ASCII aka ISO646-US addCharset (new US_ASCII ()); // ISO-8859-1 aka ISO-LATIN-1 addCharset (new ISO_8859_1 ()); // UTF-8 addCharset (new UTF_8 ()); // UTF-16BE addCharset (new UTF_16BE ()); // UTF-16LE addCharset (new UTF_16LE ()); // UTF-16 addCharset (new UTF_16 ()); }
String canonicalName = cs.name ();
String canonicalName = cs.name().toLowerCase();
private void addCharset (Charset cs) { String canonicalName = cs.name (); charsets.put (canonicalName, cs); for (Iterator i = cs.aliases ().iterator (); i.hasNext (); ) canonicalNames.put (i.next (), canonicalName); }
canonicalNames.put (i.next (), canonicalName);
canonicalNames.put (((String) i.next()).toLowerCase(), canonicalName);
private void addCharset (Charset cs) { String canonicalName = cs.name (); charsets.put (canonicalName, cs); for (Iterator i = cs.aliases ().iterator (); i.hasNext (); ) canonicalNames.put (i.next (), canonicalName); }
return (Charset) charsets.get (canonicalize (charsetName));
Charset cs = (Charset) charsets.get(canonicalNames.get(charsetName.toLowerCase())); if(cs == null && !extendedLoaded) { loadExtended(); cs = (Charset) charsets.get(canonicalNames.get(charsetName.toLowerCase())); } return cs;
public Charset charsetForName (String charsetName) { return (Charset) charsets.get (canonicalize (charsetName)); }
loadExtended();
public Iterator charsets () { return Collections.unmodifiableCollection (charsets.values ()) .iterator (); }
if (singleton == null) { singleton = (Provider)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Provider(); } }); }
if (singleton == null) singleton = new Provider ();
public static synchronized Provider provider () { if (singleton == null) { // @classpath-bugfix Security fix singleton = (Provider)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Provider(); } }); } return singleton; }
}
public void setModel(TreeModel newModel) { treeModel = newModel; // The root node is expanded by default. expanded.add(treeModel.getRoot()); dirty = true; }
if (treeModel == null) return;
private final void update() { nodes.clear(); row2node.clear(); totalHeight = maximalWidth = 0; Object root = treeModel.getRoot(); if (rootVisible) { countRows(root, null, 0); } else { int sc = treeModel.getChildCount(root); for (int i = 0; i < sc; i++) { Object child = treeModel.getChild(root, i); countRows(child, root, 0); } } dirty = false; }
getRootPane();
getRootPane(); initStageDone = true;
public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // will do set/create }
else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); }
protected void addImpl(Component comp, Object constraints, int index) { super.addImpl(comp, constraints, index); }
throws NotImplementedException
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { throw new Error("not implemented"); }
throws NotImplementedException
public int getTransparency() { throw new Error("not implemented"); }
BooleanSeqHolder h = new BooleanSeqHolder(); h._read(input); return h.value;
boolean [] value = new boolean[ input.read_long() ]; input.read_boolean_array(value, 0, value.length); return value;
public static boolean[] read(InputStream input) { BooleanSeqHolder h = new BooleanSeqHolder(); h._read(input); return h.value; }
BooleanSeqHolder h = new BooleanSeqHolder(value); h._write(output);
output.write_long(value.length); output.write_boolean_array(value, 0, value.length);
public static void write(OutputStream output, boolean[] value) { BooleanSeqHolder h = new BooleanSeqHolder(value); h._write(output); }
return "JScrollPane";
return "ScrollPaneUI";
public String getUIClassID() { //Returns a string that specifies the name of the L&F class that renders this component. return "JScrollPane"; }
throw new SocketException(e.getMessage());
SocketException se = new SocketException(e.toString()); se.initCause(e); throw se;
private SocketImpl getImpl() throws SocketException { try { if (! implCreated) { impl.create(true); implCreated = true; } } catch (IOException e) { throw new SocketException(e.getMessage()); } return impl; }
opened = false; implCloseChannel ();
if (! closed) { closed = true; implCloseChannel(); }
public final void close () throws IOException { opened = false; implCloseChannel (); }
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) {
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg);
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg);
JDialog a;
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
JDialog a;
if (frame == null) { a = new JDialog((Frame)frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame)null, title, true); }
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !");
p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); a.pack(); a.setVisible(true); Object s = p.getValue();
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
a = new JDialog((Frame) null, title, true); }
System.out.println("RESULT FROM DIALOG = " + s);
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
if (s == null) return null; return s; }
public static Object DoShowOptionDialog(Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }
public String getUIClassID() { return "JOptionPane"; }
public String getUIClassID() { return "OptionPaneUI"; }
public String getUIClassID() { return "JOptionPane"; }
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border"));
LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background", "OptionPane.foreground", "OptionPane.font"); LookAndFeel.installBorder(optionPane, "OptionPane.border");
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border")); optionPane.setOpaque(true); messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder"); minimumSize = defaults.getDimension("OptionPane.minimumSize"); // FIXME: Image icons don't seem to work properly right now. // Once they do, replace the synthetic icons with these ones. /* warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon"); infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon"); errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon"); questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon"); */ }
messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");
messageBorder = UIManager.getBorder("OptionPane.messageAreaBorder"); messageForeground = UIManager.getColor("OptionPane.messageForeground"); buttonBorder = UIManager.getBorder("OptionPane.buttonAreaBorder");
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border")); optionPane.setOpaque(true); messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder"); minimumSize = defaults.getDimension("OptionPane.minimumSize"); // FIXME: Image icons don't seem to work properly right now. // Once they do, replace the synthetic icons with these ones. /* warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon"); infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon"); errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon"); questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon"); */ }
minimumSize = defaults.getDimension("OptionPane.minimumSize");
minimumSize = UIManager.getDimension("OptionPane.minimumSize");
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border")); optionPane.setOpaque(true); messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder"); minimumSize = defaults.getDimension("OptionPane.minimumSize"); // FIXME: Image icons don't seem to work properly right now. // Once they do, replace the synthetic icons with these ones. /* warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon"); infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon"); errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon"); questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon"); */ }
public void layoutContainer(Container parent) { if (parent.countComponents() == 1) { Component c = parent.getComponent(0); }
public void layoutContainer(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); Rectangle portBounds = vp.getBounds(); Dimension viewMinimum = view.getMinimumSize(); int width = Math.max(portBounds.width, viewMinimum.width); int height = Math.max(portBounds.height, viewMinimum.height); int x = Math.min(0, portBounds.width - width); int y = Math.min(0, portBounds.height - height); vp.setViewPosition(new Point(x, y)); vp.setViewSize(new Dimension(width, height));
public void layoutContainer(Container parent) { if (parent.countComponents() == 1) { // This should usually be true, but if it's not it is // probably nicer if we do not panic. Component c = parent.getComponent(0); } }
public Dimension minimumLayoutSize(Container parent) { return null; }
public Dimension minimumLayoutSize(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); return view.getMinimumSize(); }
public Dimension minimumLayoutSize(Container parent) { return null; }
public Dimension preferredLayoutSize(Container parent) { return null;
public Dimension preferredLayoutSize(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); if (view instanceof Scrollable) { Scrollable sc = (Scrollable) view; Dimension d = sc.getPreferredScrollableViewportSize(); return d;
public Dimension preferredLayoutSize(Container parent) { return null; }