All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bibliothek.gui.dock.layout.MissingDockFactory Maven / Gradle / Ivy

The newest version!
/*
 * Bibliothek - DockingFrames
 * Library built on Java/Swing, allows the user to "drag and drop"
 * panels containing any Swing-Component the developer likes to add.
 * 
 * Copyright (C) 2008 Benjamin Sigg
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Benjamin Sigg
 * [email protected]
 * CH - Switzerland
 */
package bibliothek.gui.dock.layout;

import java.io.DataInputStream;

import bibliothek.util.xml.XElement;
import java.io.IOException;

/**
 * A {@link MissingDockFactory} is used by a {@link DockSituation} to read
 * the contents of a file if the factory that was supposed to read that 
 * content is missing.
 * @author Benjamin Sigg
 */
public interface MissingDockFactory {
    /**
     * Reads up to length bytes from in and returns
     * some object that represents the content of in. Note that if
     * later a factory for id is registered, then that object will
     * be cast to the factories preferred way to look at it. A result of
     * null indicates that this factory does not know how to
     * handle the situation.
     * @param id the id of the factory which was supposed to read the stream
     * @param in the stream to read
     * @param length the maximal number of bytes this factory can read before
     * the end of the stream is reached
     * @return the content of in or null
     * @throws IOException forwarded from in
     */
    public Object read( String id, DataInputStream in, int length ) throws IOException;
    
    /**
     * Reads element and returns an object that represents the
     * content of element. Note that if later a factory for 
     * id is registered, then that object will be cast to the
     * factories preferred way to look at it.
     * @param id the id of the factory which was supposed to read element
     * @param element the contents
     * @return a representation of element or null
     */
    public Object readXML( String id, XElement element );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy