|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ConsoleServiceInternalFrame.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.adwt.service;
|
|
| 8 |
|
|
| 9 |
import java.awt.BorderLayout;
|
|
| 10 |
import java.beans.beancontext.BeanContext;
|
|
| 11 |
import java.util.ResourceBundle;
|
|
| 12 |
|
|
| 13 |
import javax.swing.JMenuBar;
|
|
| 14 |
import javax.swing.JScrollPane;
|
|
| 15 |
import javax.swing.JTextArea;
|
|
| 16 |
|
|
| 17 |
import org.ejtools.adwt.action.Command;
|
|
| 18 |
import org.ejtools.adwt.action.edit.CopyAction;
|
|
| 19 |
import org.ejtools.adwt.action.edit.CutAction;
|
|
| 20 |
import org.ejtools.adwt.action.edit.DeleteAction;
|
|
| 21 |
|
|
| 22 |
/**
|
|
| 23 |
* @author Laurent Etiemble
|
|
| 24 |
* @version $Revision: 1.6 $
|
|
| 25 |
*/
|
|
| 26 |
public class ConsoleServiceInternalFrame extends BeanContextInternalFrame implements ConsoleService |
|
| 27 |
{
|
|
| 28 |
/** Description of the Field */
|
|
| 29 |
protected BeanContext context = null; |
|
| 30 |
/** Description of the Field */
|
|
| 31 |
protected MenuBarServiceProvider menubarProvider;
|
|
| 32 |
/** Description of the Field */
|
|
| 33 |
protected JTextArea textarea = null; |
|
| 34 |
/** Description of the Field */
|
|
| 35 |
protected ToolBarServiceProvider toolbarProvider;
|
|
| 36 |
/** Description of the Field */
|
|
| 37 |
private final static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.adwt.service.ConsoleService"); |
|
| 38 |
|
|
| 39 |
|
|
| 40 |
/**
|
|
| 41 |
* Constructor for ConsoleServiceInternalFrame.
|
|
| 42 |
*
|
|
| 43 |
* @param context Description of the Parameter
|
|
| 44 |
*/
|
|
| 45 | 0 |
public ConsoleServiceInternalFrame(BeanContext context)
|
| 46 |
{
|
|
| 47 | 0 |
super();
|
| 48 | 0 |
this.context = context;
|
| 49 | 0 |
this.textarea = new JTextArea(); |
| 50 |
|
|
| 51 | 0 |
this.menubarProvider = new MenuBarServiceProvider(); |
| 52 | 0 |
this.toolbarProvider = new ToolBarServiceProvider(); |
| 53 |
|
|
| 54 | 0 |
this.add(this.toolbarProvider); |
| 55 | 0 |
this.add(this.menubarProvider); |
| 56 |
|
|
| 57 | 0 |
this.add(new CutAction( |
| 58 |
new Command()
|
|
| 59 |
{
|
|
| 60 |
/** */
|
|
| 61 | 0 |
public void execute() |
| 62 |
{
|
|
| 63 | 0 |
ConsoleServiceInternalFrame.this.cut();
|
| 64 |
} |
|
| 65 |
})); |
|
| 66 |
|
|
| 67 | 0 |
this.add(new CopyAction( |
| 68 |
new Command()
|
|
| 69 |
{
|
|
| 70 |
/** */
|
|
| 71 | 0 |
public void execute() |
| 72 |
{
|
|
| 73 | 0 |
ConsoleServiceInternalFrame.this.copy();
|
| 74 |
} |
|
| 75 |
})); |
|
| 76 |
|
|
| 77 | 0 |
this.add(new DeleteAction( |
| 78 |
new Command()
|
|
| 79 |
{
|
|
| 80 |
/** */
|
|
| 81 | 0 |
public void execute() |
| 82 |
{
|
|
| 83 | 0 |
ConsoleServiceInternalFrame.this.delete();
|
| 84 |
} |
|
| 85 |
})); |
|
| 86 |
|
|
| 87 | 0 |
this.frame.setJMenuBar((JMenuBar) this.menubarProvider.getContainer()); |
| 88 | 0 |
this.frame.getContentPane().add(BorderLayout.NORTH, this.toolbarProvider.getContainer()); |
| 89 | 0 |
this.frame.getContentPane().add(BorderLayout.CENTER, new JScrollPane(this.textarea)); |
| 90 |
|
|
| 91 | 0 |
this.setTitle(resources.getString("frame.title")); |
| 92 |
} |
|
| 93 |
|
|
| 94 |
|
|
| 95 |
/**
|
|
| 96 |
* @param message Description of the Parameter
|
|
| 97 |
*/
|
|
| 98 | 0 |
public void append(String message) |
| 99 |
{
|
|
| 100 | 0 |
this.textarea.append(message);
|
| 101 | 0 |
this.textarea.append("\n"); |
| 102 | 0 |
this.show();
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
|
|
| 106 |
/** */
|
|
| 107 | 0 |
public void copy() |
| 108 |
{
|
|
| 109 | 0 |
this.textarea.copy();
|
| 110 |
} |
|
| 111 |
|
|
| 112 |
|
|
| 113 |
/** */
|
|
| 114 | 0 |
public void cut() |
| 115 |
{
|
|
| 116 | 0 |
this.textarea.cut();
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
|
|
| 120 |
/** */
|
|
| 121 | 0 |
public void delete() |
| 122 |
{
|
|
| 123 | 0 |
this.textarea.setText(""); |
| 124 |
} |
|
| 125 |
|
|
| 126 |
|
|
| 127 |
/** */
|
|
| 128 | 0 |
public void hide() |
| 129 |
{
|
|
| 130 | 0 |
if (this.context.contains(this)) |
| 131 |
{
|
|
| 132 | 0 |
this.close();
|
| 133 |
} |
|
| 134 |
} |
|
| 135 |
|
|
| 136 |
|
|
| 137 |
/** */
|
|
| 138 | 0 |
public void show() |
| 139 |
{
|
|
| 140 | 0 |
if (!this.context.contains(this)) |
| 141 |
{
|
|
| 142 | 0 |
this.context.add(this); |
| 143 |
} |
|
| 144 | 0 |
this.activate();
|
| 145 |
} |
|
| 146 |
} |
|
| 147 |
|
|
||||||||||