Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder In directory sc8-pr-cvs1:/tmp/cvs-serv19450/com/babeldoc/gui/pipeline/builder Modified Files: AddPipelineAction.java AddPipelineStageAction.java AddPipelineStageConfigAction.java PipelineBuilderController.java PipelineBuilderModel.java PipelineBuilderPanel.java PipelineTree.java PipelineTreeCellRenderer.java RemovePipelineAction.java RemovePipelineStageAction.java Added Files: EditPipelineStageConfigAction.java Log Message: Lots of GUI loving! Been working on the pipeline builder tool and getting into some shape. Now the pipeline stage configuration editing is looking a whole lot better. --- NEW FILE: EditPipelineStageConfigAction.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/EditPipelineStageConfigAction.java,v 1.1 2003/09/13 15:33:11 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.gui.pipeline.builder; import com.babeldoc.gui.config.ConfigOptionPanel; import com.babeldoc.core.pipeline.PipelineException; import com.babeldoc.core.option.IConfigInfo; import com.babeldoc.core.LogService; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; import javax.swing.*; /** * Handle an Add Pipeline action event. */ public class EditPipelineStageConfigAction extends BuilderAction { public static final String ACTION_ADD_CONFIG = "Edit configuration"; private String pipeline; private String stage; /** * Creates a new EditPipelineStageConfigAction object. * * @param model DOCUMENT ME! * @param frame DOCUMENT ME! * @param pipeline DOCUMENT ME! * @param stage DOCUMENT ME! */ public EditPipelineStageConfigAction(PipelineBuilderModel model, PipelineBuilderPanel frame, PipelineTreeNode pipeline, PipelineTreeNode stage) { super(ACTION_ADD_CONFIG, null, model, frame); this.pipeline = pipeline.toString(); this.stage = stage.toString(); } /** * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { final IConfigInfo info; try { info = PipelineBuilderModel.getPipelineStageConfigInfo(pipeline, stage); final JDialog dialog = new JDialog(); final ConfigOptionPanel panel = new ConfigOptionPanel(info); JPanel contents = new JPanel(); contents.setLayout(new BorderLayout()); contents.add(panel); JButton button = new JButton("close"); button.addActionListener(new ActionListener() { /** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { dialog.dispose(); try { PipelineBuilderModel.updatePipelineStageConfig(pipeline, stage, info); } catch (PipelineException pe) { LogService.getInstance().logError(pe); } } }); JPanel buttons = new JPanel(); buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS)); buttons.add(Box.createHorizontalGlue()); buttons.add(button); buttons.add(Box.createHorizontalGlue()); contents.add(buttons, BorderLayout.SOUTH); dialog.setContentPane(contents); dialog.pack(); dialog.show(); } catch (PipelineException pe) { LogService.getInstance().logError(pe); } } } Index: AddPipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Index: AddPipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AddPipelineStageAction.java 9 Sep 2003 21:50:50 -0000 1.6 --- AddPipelineStageAction.java 13 Sep 2003 15:33:11 -0000 1.7 *************** *** 67,70 **** --- 67,74 ---- import com.babeldoc.gui.wizard.addstage.AddPipelineStageWizard; + import com.babeldoc.gui.wizard.addstage.AddPipelineStageModel; + import com.babeldoc.core.pipeline.PipelineException; + import com.babeldoc.core.LogService; + import com.babeldoc.core.option.IConfigInfo; import javax.swing.tree.TreeNode; *************** *** 101,107 **** */ public void actionPerformed(ActionEvent e) { ! String stage = AddPipelineStageWizard.run(treenode.toString()).getModel().getStage(); if(stage!=null) { TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(treenode.toString()); getFrame().getTree().addPipelineStage(pipeNode, stage); --- 105,118 ---- */ public void actionPerformed(ActionEvent e) { ! AddPipelineStageModel model = AddPipelineStageWizard.run(treenode.toString()).getModel(); ! String stage = model.getStage(); if(stage!=null) { + try { + IConfigInfo info = model.getPipelineStageConfigInfo(); + PipelineBuilderModel.updatePipelineStageConfig(treenode.toString(), stage, info); + } catch (PipelineException e1) { + LogService.getInstance().logError(e1); + } TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(treenode.toString()); getFrame().getTree().addPipelineStage(pipeNode, stage); Index: AddPipelineStageConfigAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageConfigAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Index: PipelineBuilderController.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderController.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Index: PipelineBuilderModel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderModel.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PipelineBuilderModel.java 9 Sep 2003 21:50:50 -0000 1.9 --- PipelineBuilderModel.java 13 Sep 2003 15:33:11 -0000 1.10 *************** *** 68,71 **** --- 68,74 ---- import com.babeldoc.core.EnvironmentLoader; import com.babeldoc.core.option.IConfigData; + import com.babeldoc.core.option.IConfigInfo; + import com.babeldoc.core.option.ConfigData; + import com.babeldoc.core.option.ConfigInfo; import com.babeldoc.core.config.ConfigService; import com.babeldoc.core.config.IConfig; *************** *** 329,334 **** /** ! * Returns the configuration that defines this pipeline stage. It is to ! * create a pipeline stage from this information. * * @param pipeline --- 332,336 ---- /** ! * Returns the configuration data from this pipeline stage * * @param pipeline *************** *** 339,343 **** * @throws PipelineException */ ! public static IConfigData getPipelineStageConfig(String pipeline, String stage) throws PipelineException { IPipelineStageFactory pfactory = PipelineFactoryFactory.getPipelineStageFactory(pipeline); --- 341,345 ---- * @throws PipelineException */ ! public static IConfigData getPipelineStageConfigData(String pipeline, String stage) throws PipelineException { IPipelineStageFactory pfactory = PipelineFactoryFactory.getPipelineStageFactory(pipeline); *************** *** 347,350 **** --- 349,370 ---- /** + * Returns the configuration data from this pipeline stage + * + * @param pipeline + * @param stage + * + * @return + * + * @throws PipelineException + */ + public static IConfigInfo getPipelineStageConfigInfo(String pipeline, + String stage) throws PipelineException { + IPipelineStageFactory pfactory = PipelineFactoryFactory. + getPipelineStageFactory(pipeline); + return ((PipelineStageFactory)pfactory).getProcessor(). + getPipelineStage(stage).getInfo(); + } + + /** * This sets the properteis for the pipeline stage. * *************** *** 472,475 **** --- 492,508 ---- config.setString(pipeline + DOT_CONFIGFILE, configName); saveConfig(config); + } + + + public static void updatePipelineStageConfig(String pipeline, String stage, IConfigInfo info ) + throws PipelineException { + // Create the pipeline config and write it down + String configName = PIPELINE_SLASH + pipeline; + IConfig pipeconfig = ConfigService.getInstance().getConfig(configName); + System.out.println("Got config "+pipeconfig); + + IConfigData data = info.getConfigData(); + System.out.println("PIpelinestage data: "+data); + ConfigData.getConfigFromData(pipeconfig, data); } Index: PipelineBuilderPanel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PipelineBuilderPanel.java 9 Sep 2003 21:50:50 -0000 1.2 --- PipelineBuilderPanel.java 13 Sep 2003 15:33:11 -0000 1.3 *************** *** 214,225 **** popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! // popup.add(new AddPipelineStageConfigAction(getController().getModel(), ! // this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); - // } else if (currentNode.isConfig()) { - // menuItem = new JMenuItem(ACTION_REMOVE_CONFIG); - // menuItem.addActionListener(this); - // popup.add(menuItem); } } --- 214,221 ---- popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! popup.add(new EditPipelineStageConfigAction(getController().getModel(), ! this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); } } Index: PipelineTree.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTree.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Index: PipelineTreeCellRenderer.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTreeCellRenderer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Index: RemovePipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Index: RemovePipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineStageAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 |