import com.tildemh.jgwizard.*;
import org.gnu.gtk.*;
import org.gnu.glib.*;
import org.gnu.gtk.event.*;
import java.io.IOException;


/**
 * Start of the Ordered list settings. Includes settting for sort key and
 * articles
 */
public class OLStartPage extends WizardPage{

	/**
	 * 
	 */
	public OLStartPage(WizardForm wizard, WizardPage parent){
		super(wizard, parent, DomesdayGUI.messages.getString("OLStartTitle") );
	}


	private Combo sortKey;
	private Entry articles;
	/**
	 * Constructs the contents of the page.
	 */
	protected void preShow(){
		System.out.println("ol start preshow.");

		/** Stores the content of the page, to be displayed on the output. */
		VBox mainVBox = new VBox(false, 5);

		Label head = new Label( DomesdayGUI.messages.getString("OLStartHead") );
		head.setLineWrap(true);
		mainVBox.packStart(head, false, false, 0);
		
// Combos seem to be buggy in java-gnome
//		sortKey = new Combo();
//		sortKey.setCaseSensitive(true);
//		sortKey.setPopupdownStrings( new String[] { 
//			DomesdayGUI.project.getLocalName("PH_FILE_AUTHOR"),
//			DomesdayGUI.project.getLocalName("PH_FILE_TITLE"),
//			DomesdayGUI.project.getLocalName("PH_FILE_DESCRIPTION"),
//			DomesdayGUI.project.getLocalName("PH_FILE_KEYWORDS"),
//			DomesdayGUI.project.getLocalName("PH_FILE_SIZE"),
//			DomesdayGUI.project.getLocalName("PH_FILE_TYPE"),
//			DomesdayGUI.project.getLocalName("PH_FILE_NAME"),
//			DomesdayGUI.project.getLocalName("PH_FILE_REL_LOCATION"),
//		} );

		HBox hbox = new HBox(false,0);
		Label key =  new Label( DomesdayGUI.messages.getString("OLStartKey") );
		key.setLineWrap(true);
		hbox.add(key);
//		hbox.add(sortKey);
		mainVBox.packStart(hbox);

		Label art = new Label ( DomesdayGUI.messages.getString("OLStartArt") );
		art.setLineWrap(true);
		mainVBox.packStart(art);
		articles = new Entry();
//		try{
//			articles.setText( DomesdayGUI.project.getStringSetting("OL_ARTICLES") );
//		}catch(IllegalVariableException e){
//			DomesdayGUI.log.addError(203, "ILLEGAL_VAR_EXCEPTION", new Object[] { e.toString() } );
//			e.printStackTrace();
//		}
		mainVBox.add(articles);

		Label foot = new Label( DomesdayGUI.messages.getString("OLStartFoot") );
		foot.setLineWrap(true);
		mainVBox.add(foot);
		
		setContent(mainVBox);
	}


	/**
	 * Save the settings
	 */
	protected void postShow(){
		System.out.println("save output");
//		try{
//			DomesdayGUI.project.storeSettingByVar("OL_ARTICLES", articles.getText());
//		}catch(IllegalVariableException e){
//			DomesdayGUI.log.addError(203, "ILLEGAL_VAR_EXCEPTION", new Object[] { e.toString() } );
//			e.printStackTrace();
//		}
	}

}
