View Javadoc

1   /*
2    * $Id: InputURIsPanel.java,v 1.10 2006/09/06 17:48:19 edankert Exp $
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is XML Hammer code. (org.xmlhammer.*)
14   *
15   * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
16   * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. 
17   * All Rights Reserved.
18   *
19   * Contributor(s): Edwin Dankert <edankert@gmail.com>
20   */
21  
22  package org.xmlhammer.gui.input;
23  
24  import java.awt.BorderLayout;
25  import java.net.URI;
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  import javax.swing.JPanel;
30  import javax.swing.border.EmptyBorder;
31  
32  import org.xmlhammer.gui.history.HistoryUtilities;
33  import org.xmlhammer.gui.overview.OverviewNode;
34  import org.xmlhammer.gui.util.URIsPanel;
35  import org.xmlhammer.model.project.Document;
36  
37  /***
38   * Input Panel.
39   * 
40   * Allows to select either one URI, multiple URIs or 
41   * a range of files.
42   * 
43   * @version $Revision: 1.10 $, $Date: 2006/09/06 17:48:19 $
44   * @author Edwin Dankert <edankert@gmail.com>
45   */
46  
47  public class InputURIsPanel extends JPanel {
48  	private static final long serialVersionUID = 3257852090755134776L;
49  
50  	private URIsPanel urisPanel 		= null;
51  
52      /***
53       * @param parent the parent page or null if no parent page.
54       */
55      public InputURIsPanel(InputPage parent) {
56          this(parent, false);
57      }
58  
59      /***
60  	 * Constructs a new Input Panel.
61  	 */
62  	public InputURIsPanel(InputPage parent, boolean resultEnabled) {
63  		super( new BorderLayout());
64          setBorder( new EmptyBorder( 10, 10, 10, 10));
65          
66          urisPanel = new URIsPanel(parent, HistoryUtilities.getInstance().getSourcesModel(), resultEnabled);
67          add(urisPanel, BorderLayout.NORTH);
68  	}
69  	
70      public ArrayList<OverviewNode> getNodes() {
71          return urisPanel.getNodes();
72      }
73  
74  	public void setURIs( URI base, List uris) {
75          urisPanel.reset();
76          urisPanel.setURIs(base, uris);
77  	}
78  
79      public List<Document> getURIs(URI base) { 
80  		return urisPanel.getURIs(base);
81  	}
82      
83      public void dispose() {
84          urisPanel.dispose();
85      }
86  }