View Javadoc
1 /* 2 * Scope: a generic MVC framework. 3 * Copyright (c) 2000-2002, Steve Meyfroidt 4 * All rights reserved. 5 * Email: smeyfroi@users.sourceforge.net 6 * 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * Neither the name "Scope" nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * 36 * 37 * $Id: LaunchpadView.java,v 1.4 2002/06/17 09:56:00 ludovicc Exp $ 38 */ 39 40 41 package samples; 42 43 44 import org.scopemvc.core.Control; 45 import org.scopemvc.view.swing.SButton; 46 import org.scopemvc.view.swing.SList; 47 import org.scopemvc.view.swing.SListCellRenderer; 48 import org.scopemvc.view.swing.SPanel; 49 import java.awt.BorderLayout; 50 import java.awt.Rectangle; 51 import java.net.URL; 52 import javax.swing.JEditorPane; 53 import javax.swing.JScrollPane; 54 import javax.swing.JSplitPane; 55 import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.Log; 56 57 58 /*** 59 * <P> 60 * List of available applications on left and a HTML viewer on the right. 61 * </P> 62 * 63 * @author <A HREF="mailto:smeyfroi@users.sourceforge.net">Steve Meyfroidt</A> 64 * @version $Revision: 1.4 $ $Date: 2002/06/17 09:56:00 $ 65 */ 66 public class LaunchpadView extends SPanel { 67 68 69 private static final Log LOG = LogFactory.getLog(LaunchpadView.class); 70 71 72 private JEditorPane editorPane; 73 74 75 public LaunchpadView() { 76 77 setLayout(new BorderLayout(0, 12)); 78 79 SList l = new SList(); 80 l.setSelectorString("examples"); 81 ((SListCellRenderer)l.getCellRenderer()).setTextSelectorString("name"); 82 l.setSelectionSelectorString("selectedExample"); 83 l.setChangeSelectionControlID(LaunchpadController.SELECT); 84 l.setDoubleClickControlID(LaunchpadController.LAUNCH); 85 JScrollPane left = new JScrollPane(l); 86 87 editorPane = new JEditorPane(); 88 editorPane.setEditable(false); 89 JScrollPane right = new JScrollPane(editorPane); 90 91 JSplitPane s = new JSplitPane(); 92 s.setLeftComponent(left); 93 s.setRightComponent(right); 94 add(s); 95 96 add(new SButton(LaunchpadController.LAUNCH), BorderLayout.SOUTH); 97 98 setViewBounds(new Rectangle(0, 0, 640, 320)); 99 } 100 101 102 public String getTitle() { 103 return "Examples Launcher"; 104 } 105 106 107 public Control getCloseControl() { 108 return new Control(LaunchpadController.QUIT); // a special Control to differentiate from regular EXIT coming from the example controllers 109 } 110 111 112 public void showURL(URL inURL) { 113 try { 114 editorPane.setPage(inURL); 115 } catch(Exception e) { 116 LOG.fatal("Can't show: " + inURL, e); 117 } 118 } 119 } 120

This page was automatically generated by Maven