View Javadoc

    1   /*
    2    *  soapUI, copyright (C) 2004-2007 eviware.com
    3    *
    4    *  soapUI is free software; you can redistribute it and/or modify it under the
    5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
    6    *  the Free Software Foundation.
    7    *
    8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
    9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    10   *  See the GNU Lesser General Public License for more details at gnu.org.
    11   */
    12
    13  package com.eviware.soapui.impl;
    14
    15  import java.awt.Component;
    16
    17  import com.eviware.soapui.model.ModelItem;
    18  import com.eviware.soapui.model.PanelBuilder;
    19  import com.eviware.soapui.support.components.JPropertiesTable;
    20  import com.eviware.soapui.ui.desktop.DesktopPanel;
    21
    22  /***
    23   * Empty PanelBuilder implementation for extension.
    24   *
    25   * @author Ole.Matzura
    26   */
    27
    28  public class EmptyPanelBuilder<T extends ModelItem> implements PanelBuilder<T>
    29  {
    30  	private static final EmptyPanelBuilder instance = new EmptyPanelBuilder();
    31
    32  	public static EmptyPanelBuilder get()
    33  	{
    34  		return instance;
    35  	}
    36
    37  	public Component buildOverviewPanel(T modelItem)
    38     {
    39  		String caption = "Properties";
    40  		if( modelItem.getClass().getSimpleName().startsWith( "Wsdl" ))
    41  		{
    42  			caption = modelItem.getClass().getSimpleName().substring( 4 );
    43
    44  			if( caption.endsWith( "TestStep" ))
    45  				caption = caption.substring( 0, caption.length()-8 );
    46
    47  			caption += " Properties";
    48  		}
    49
    50     	return buildDefaultProperties( modelItem, caption );
    51     }
    52
    53  	protected JPropertiesTable<T> buildDefaultProperties( T modelItem, String caption )
    54  	{
    55  		JPropertiesTable<T> table = new JPropertiesTable<T>( caption, modelItem );
    56
    57     	table.addProperty( "Name", "name", true );
    58     	table.addProperty( "Description", "description", true );
    59
    60     	table.setPropertyObject( modelItem );
    61
    62     	return table;
    63  	}
    64
    65     public boolean hasOverviewPanel()
    66     {
    67        return true;
    68     }
    69
    70     public boolean hasDesktopPanel()
    71     {
    72        return false;
    73     }
    74
    75     public DesktopPanel buildDesktopPanel( T modelItem )
    76     {
    77        return null;
    78     }
    79  }