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

bibliothek.gui.dock.support.mode.ModeSetting Maven / Gradle / Ivy

Go to download

DockingFrames is an open source Java Swing docking framework, licenced under LGPL 2.1. This is the same distribution as the original distribution (http://www.docking-frames.org/), only reinstalled in maven

There is a newer version: 1.1.2p20b.fix-1
Show 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) 2009 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.support.mode;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import bibliothek.util.Path;
import bibliothek.util.xml.XElement;

/**
 * A set of properties that belong to some {@link Mode} but are stored independent 
 * from that mode. Each of the read/write methods gets access to the {@link ModeSettingsConverter} that is
 * used by the {@link ModeSettings} to store data in memory. The methods are not required to use the converter,
 * but the implementation may be easier when using the converters read/write methods as well.
 * @author Benjamin Sigg
 * @param  format of data used by the {@link ModeManager} this {@link ModeSetting}
 * is associated with
 */
public interface ModeSetting {
	/**
	 * Gets the unique identifier of the {@link Mode} this setting is
	 * associated with.
	 * @return the identifier
	 */
	public Path getModeId();
	
	/**
	 * Writes the contents of this setting into out.
	 * @param out the stream to write into
	 * @param converter converts data to and from persistent storage
	 * @throws IOException in case of an error
	 */
	public  void write( DataOutputStream out, ModeSettingsConverter converter ) throws IOException;
	
	/**
	 * Reads the contents of this setting from in.
	 * @param in the stream to read from
	 * @param converter converts data to and from persistent storage
	 * @throws IOException in case of an error
	 */
	public  void read( DataInputStream in, ModeSettingsConverter converter ) throws IOException;
	
	/**
	 * Writes the contents of this setting into element. This
	 * method should add children to element, but not change
	 * the attributes of element.
	 * @param element the item to write into
	 * @param converter converts data to and from persistent storage
	 */
	public  void write( XElement element, ModeSettingsConverter converter );
	
	/**
	 * Reads the contents of this setting from element.
	 * @param element the item to read from
	 * @param converter converts data to and from persistent storage
	 */
	public  void read( XElement element, ModeSettingsConverter converter );
}