Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex
In directory usw-pr-cvs1:/tmp/cvs-serv3862/transitions/latex
Added Files:
WriteGeneralFooterTransition.java
WriteGeneralHeaderTransition.java WriteHeaderTransition.java
WriteSectHeaderTransition.java
Log Message:
another example 2LATEX added
--- NEW FILE: WriteGeneralFooterTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralFooterTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteGeneralFooterTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
html_form.append("\n\\end{document}");
System.out.println(html_form.toString());
return(null);
}
}
--- NEW FILE: WriteGeneralHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @version $Revision: 1.1 $
*/
public class WriteGeneralHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = new StringBuffer();
html_form.append("\\documentclass[a4paper,titlepage]{article}\n\\usepackage{times}\n\n" +
"\\begin{document}\n");
data.putObject(Const.RESULT_BUFFER, html_form);
return(null);
}
}
--- NEW FILE: WriteHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String doc_title = (String)data.getObject("doc_title");
String doc_author = (String)data.getObject("doc_author");
if (doc_title == null)
System.err.println("Error (printing to form): document has no title");
html_form.append("\n\\title{" + doc_title + "}\n");
if (doc_author != null)
html_form.append("\\author{" + doc_author + "}\n");
html_form.append("\\maketitle\n");
return(null);
}
}
--- NEW FILE: WriteSectHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteSectHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/03/18 06:45:54 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.latex;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import edu.iicm.xpg.statemachine.Const;
import java.util.Vector;
import java.util.Enumeration;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteSectHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer result = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String section_name =
data.topXMLElement().getAttributes().getValue("name");
Integer sect_depth_obj = (Integer)data.removeObject("sect_depth");
int sect_depth;
if ( sect_depth_obj == null )
sect_depth = 0;
else sect_depth= sect_depth_obj.intValue();
result.append("\n\\");
for ( int depth = 0; depth < sect_depth; depth++ )
result.append("sub");
result.append("section{" + section_name + "}\n");
data.putObject("sect_depth", new Integer(++sect_depth) );
return(null);
}
}
|