SlideShare ist ein Scribd-Unternehmen logo
1 von 98
asmt7/~$sc_210_-_assignment_7_fall_15.doc
asmt7/cosc_210_-_assignment_7_fall_15.doc
COSC 210 - Object Oriented Programming
Assignment 7
The objectives of this assignment are to:
1) Gain further understanding and experience with inheritance.
2) Gain understanding and experience with polymorphism.
3) Gain further understanding and experience with interfaces.
4) Gain understanding and experience with low level graphics.
5) Modify an existing program to meet new requirements
applying concepts of objectives 1 through 4.
6) Gain experience with medium-size Java program.
7) Continue to practice good programming techniques.
AFTER YOU HAVE COMPLETED, create a zip file named
[your name]Assignment7.zip containing your entire project.
Upload the .zip file to Moodle. Printout all source files you
created or modified. Include a screen shot of the editor with
boxes, ellipses, lines and images shown in the editor. Turn-in
all printouts.
COSC 210 – Fundamentals of Computer Science
Assignment 7 Problem Statement
Updated
On the tomcat drive in folder cosc210 you will find file named
PainterStartup.zip. This file contains the source code for the
start of a Painter program. In its current state, Painter can
create boxes and text objects at given locations. Both boxes
and text objects can be repositioned and resized using a mouse.
The task is to add to the program the implementation for an
ellipse, line, image, and group objects.
Instructions:
1) Add an ellipse object. An ellipse is very similar in
implementation as the box, except it renders an oval instead of a
rectangle. The ellipse can be repositioned by dragging the
object to a new location. The ellipse can be resized by first
clicking over the ellipse to display grab handles and then
dragging a grab handle to a new position. The grab handles are
to be rendered at the same positions as the box. Likewise,
clicking anywhere in the smallest rectangle that encloses the
ellipse performs selection.
2) Add a Line object. A Line is to be created by selecting a
Line tool and then click and drag over the canvas. The line is
rendered from the point of the initial click to the mouse pointer.
On releasing the mouse the construction of the line object is
completed. Have the Line object inherit from
PtrDrawAbstractAreaObject. Thus it will have only two grab
handles.
A Line is selected by clicking anywhere over the line. Right
now if you click anywhere in the rectangular region hold the
line, then the line is selected. To accomplish this task,
override the isOver method in PtrDrawAbstractAreaObject.
Given below is a partial solution to determine if a mouse click
position (the x and y parameters to the isOver method) is over a
line:
double ratio = (double) getWidth() / (double) getHeight();
if (Math.abs((x - getX()) * ratio) - (y - getY()) <= 1) {
return true;
}
You need to modify this code when the y to x ratio is less than -
1 or greater than 1. (Hint: Inverse the roles of width and
height, and the roles of x and y)
3) Add an Image object. An Image object is created by
selecting an Image tool and then clicking anywhere on the
canvas. On clicking the canvas, a File Selection Dialog should
be displayed. The dialog prompts for selection of .gif and .jpg
files. On selecting a .gif or .jpg file and clicking “Open”, an
Image object that renders the image of the selected file is
created at the click position. Image selection and drag
behaviors are the same as a Box object. The image object
additionally renders lines at the edges of the image (as done in
Box).
The code for displaying a File Selection Dialog is:
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory() ||
f.getName().toLowerCase().endsWith(".jpg")
|| f.getName().toLowerCase().endsWith(".gif");
}
public String getDescription() {
return "JPG & GIF Images";
}
});
if (fileChooser.showOpenDialog(editor) ==
JFileChooser.APPROVE_OPTION) {
ImageIcon image = new
ImageIcon(fileChooser.getSelectedFile().getAbsolutePath());
/* you will need to do stuff with your image here
*/
/* note the Graphics object has a method drawImage() */
}
Make sure to import FileFilter from the javax.swing.filechooser.
The above code is added to the PtrDrawImageTool
4) Add a group object. A group object represents a set of
objects that have been grouped together. A partial
implementation is provided. Your task is to fix the rendering.
The group object should draw each of the objects in the
groupedObjects list.
Before drawing any object your will need to create a new
graphics object that is transposed to the dimensions if the group
object itself. To do this use:
Graphics2D g2 = (Graphics2D) g.create(getX(), getY(),
getWidth(),
getHeight());
After drawing each of the objects in groupedObjects list, release
the resources used by the created graphics object by calling
dispose:
g2.dispose();
One more item, after creating the new graphics context and
before drawing each of the objects in the group, use scale as
follows:
g2.scale(getXScale(), getYScale());
This will insure that all objects get rendered as at the right scale
when the group object itself is resized.
5) Have the box, ellipse, line, and image implement the
Lineable and Colorable interface. Create instance variables as
needed to hold the values of the parameters. Before doing any
rendering of lines (e.g., any g.drawXXXX method) create a new
graphics context as follows:
Graphics2D g2 = (Graphics2D) g.create();
Then set the line width by:
g2.setStroke(new BasicStroke(lineWidth));
Also set the color to the lineColor:
g2.setColor(lineColor);
Use g2 to do the rendering of the lines. After all line rendering,
release the resources of the graphics context by calling
dispose();
In the corresponding tool object (e.g., PtrDrawBoxTool for
PtrDrawBox), after creating the draw object add the following
calls in the object:
box.setLineColor(editor.getLineColor());
box.setLineWidth(editor.getLineWidth());
6) Have the box and ellipse, line implement the Colorable
interface. Create instance variables as need to hold the value of
the parameter (color). Before doing any rendering of filled
areas (e.g., any g.fillXXXX method) set the graphics color to
the color instance variable:
g.setColor(color); // or use g2 if you have created a new
graphics context
In the corresponding tool object (e.g., PtrDrawBoxTool for
PtrDrawBox), after creating the draw object add the following
calls in the object:
box.setColor(editor.getColor());
Warning:
Your objects may not render correctly whenever they are
resized such that either the height or width is negative.
Bonus:
1) Bonus 5 points -The isInside method provides the
implementation for determining if the line is inside a
rectangular area as specified by the parameters. This code may
not work right if the ending point of the line is to the left or
above the starting point. Fix this to work in all cases for 3
bonus points.
2) Currently, if you click in the area where two objects overlap,
the object on the bottom is selected. Change this so that the top
object is selected. 3 bonus points.
3) On the Group object, clicking in anywhere in the bounding
rectangle will select the object. Change this so that a group is
only selected with clicking over an object in the group. 3 bonus
points
4) The south east grab handle processing is broken. Fix this to
behave as the other grab handles for 3 bonus points
5) Currently, if you drag the right hand side smaller than the
left (likewise the bottom smaller that the top) the objects may
not be displayed correctly (or even at all). Once in the bad
display state, clicking over the object no longer works. Second,
if you click in the region of overlapping object, the object on
the bottom gets selected. It should be the top object. Fix these
bugs. One possible solution is to add a normalizeRect method to
PtrDrawRect. This will adjust the x, y, width, and height
variables so that width and height are never negative. For
example if width is negative then change x to be the value of x
plus width and then change width to be the absolute value.
Place a call to this method in the corresponding setter methods
after updating the instance variables. (Note there may be
problems with the grab handles). 3 points bonus.
asmt7/image_0.jpeg
asmt7/image_2.jpeg
asmt7/image_4.jpeg
asmt7/image_5.jpeg
asmt7/painterstartupasmt7.zip
PainterStartup/.classpath
PainterStartup/.project
Painter
org.eclipse.jdt.core.javabuilder
org.eclipse.jdt.core.javanature
PainterStartup/.settings/org.eclipse.jdt.core.prefs
#Fri Apr 27 08:03:31 EDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enable
d
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
PainterStartup/com/javera/ui/actions/ActionUtilities.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass ActionUtilities {
public void ActionUtilities();
publicstatic javax.swing.JFrame
getFrame(java.util.EventObject);
publicstatic javax.swing.JDialog
getDialog(java.util.EventObject);
publicstatic Object getCommandTarget(java.util.EventObject,
Class);
}
PainterStartup/com/javera/ui/actions/ActionUtilities.javaPainter
Startup/com/javera/ui/actions/ActionUtilities.javapackage com.j
avera.ui.actions;
import java.awt.Component;
import java.util.EventObject;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
publicclassActionUtilities{
publicstaticJFrame getFrame(EventObject e){
if(!(e.getSource()instanceofComponent)){
returnnull;
}
Component comp =(Component) e.getSource();
JFrame frame =(JFrame)SwingUtilities.getAncestorOfClass(JFra
me.class, comp);
while(frame ==null){
JPopupMenu popupMenu =
(JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu.
class, comp);
if(popupMenu ==null){
returnnull;
}
comp = popupMenu.getInvoker();
frame =(JFrame)SwingUtilities.getAncestorOfClass(JFr
ame.class, comp);
}
return frame;
}
publicstaticJDialog getDialog(EventObject e){
if(!(e.getSource()instanceofComponent)){
returnnull;
}
Component comp =(Component) e.getSource();
JDialog dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD
ialog.class, comp);
while(dialog ==null){
JPopupMenu popupMenu =
(JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu.
class, comp);
if(popupMenu ==null){
returnnull;
}
comp = popupMenu.getInvoker();
dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD
ialog.class, comp);
}
return dialog;
}
publicstaticObject getCommandTarget(EventObject e,Class com
mandClass){
Object target = getDialog(e);
if(target ==null){
target = getFrame(e);
}
for(;;){
if(target ==null){
returnnull;
}
if(commandClass.isInstance(target)){
return target;
}
if(!(target instanceofSelectable))
returnnull;
target =((Selectable) target).getSelectedItem();
}
}
}
PainterStartup/com/javera/ui/actions/Addable.classpackage
com.javera.ui.actions;
publicabstractinterface Addable {
publicabstract void add(java.awt.event.ActionEvent);
publicabstract boolean isAddable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Addable.javaPainterStartu
p/com/javera/ui/actions/Addable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Things that support adding a new item (AddAction) should i
mplement this interface.
*/
publicinterfaceAddable{
publicvoid add(ActionEvent e);
publicboolean isAddable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/AddAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass AddAction extends
ManagedStateAction {
privatestatic AddAction addAction;
static void <clinit>();
private void AddAction();
publicstatic AddAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/AddAction.javaPainterStar
tup/com/javera/ui/actions/AddAction.javapackage com.javera.ui
.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassAddActionextendsManagedStateAction{
privatestaticAddAction addAction =newAddAction();
privateAddAction(){
super("New...",IconManager.getIcon("Add.gif"));
putValue(Action.SHORT_DESCRIPTION,"New");
}
publicstaticAddAction getAction(){
return addAction;
}
publicvoid actionPerformed(ActionEvent e ){
Addable target =(Addable)ActionUtilities.getCommandTarget( e
,
Addable.class);
if( target !=null&& target.isAddable( e )){
target.add( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Addable target =(Addable)ActionUtilities.getCommandTarget( e
vt,
Addable.class);
if( target !=null){
return target.isAddable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Closeable.classpackage
com.javera.ui.actions;
publicabstractinterface Closeable {
publicabstract void close(java.awt.event.ActionEvent);
publicabstract boolean isCloseable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Closeable.javaPainterStart
up/com/javera/ui/actions/Closeable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceCloseable{
publicvoid close(ActionEvent evt);
publicboolean isCloseable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/CloseAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CloseAction extends
ManagedStateAction {
privatestatic CloseAction saveAction;
static void <clinit>();
private void CloseAction();
publicstatic CloseAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAction.javaPainterSt
artup/com/javera/ui/actions/CloseAction.java//Copyright 2004, (
c) Javera Software, LLC. as an unpublished work. All rights res
erved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicclassCloseActionextendsManagedStateAction{
privatestaticCloseAction saveAction =newCloseAction();
privateCloseAction(){
super("Close");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl
ose");
}
publicstaticCloseAction getAction(){
return saveAction;
}
publicvoid actionPerformed(ActionEvent e){
Closeable target =
(Closeable)ActionUtilities.getCommandTarget(e,Closeable.class
);
if(target !=null&& target.isCloseable(e)){
target.close(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
Closeable target =
(Closeable)ActionUtilities.getCommandTarget(evt,Closeable.cla
ss);
if(target !=null){
return target.isCloseable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/CloseAllable.classpackage
com.javera.ui.actions;
publicabstractinterface CloseAllable {
publicabstract boolean closeAll(java.awt.event.ActionEvent);
publicabstract boolean isCloseAllable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAllable.javaPainterSt
artup/com/javera/ui/actions/CloseAllable.javapackage com.javer
a.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceCloseAllable{
publicboolean closeAll(ActionEvent evt);
publicboolean isCloseAllable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/CloseAllAction.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass CloseAllAction extends
javax.swing.AbstractAction {
privatestatic CloseAllAction saveAllAction;
static void <clinit>();
private void CloseAllAction();
publicstatic CloseAllAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAllAction.javaPainte
rStartup/com/javera/ui/actions/CloseAllAction.javapackage com
.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassCloseAllActionextendsAbstractAction{
privatestaticCloseAllAction saveAllAction =newCloseAllAction
();
privateCloseAllAction(){
super("Close All...");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl
ose All");
}
publicstaticCloseAllAction getAction(){
return saveAllAction;
}
publicvoid actionPerformed(ActionEvent e){
CloseAllable target =
(CloseAllable)ActionUtilities.getCommandTarget(e,CloseAllabl
e.class);
if(target !=null&& target.isCloseAllable(e)){
target.closeAll(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
CloseAllable target =
(CloseAllable)ActionUtilities.getCommandTarget(evt,CloseAlla
ble.class);
if(target !=null){
return target.isCloseAllable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Copyable.classpackage
com.javera.ui.actions;
publicabstractinterface Copyable {
publicabstract void copy(java.awt.event.ActionEvent);
publicabstract boolean isCopyable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Copyable.javaPainterStartu
p/com/javera/ui/actions/Copyable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Components interested in interacting with CopyAction (e.g. h
ave UI-level
* Copy support) should implement this.
*/
publicinterfaceCopyable{
/**
* Tells the Component to do the Copy.
*/
publicvoid copy(ActionEvent evt );
/** Return true if a Copy is current possible. */
publicboolean isCopyable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/CopyAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CopyAction extends
ManagedStateAction implements
java.awt.datatransfer.ClipboardOwner {
privatestatic CopyAction copyAction;
static void <clinit>();
private void CopyAction();
publicstatic CopyAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
public void lostOwnership(java.awt.datatransfer.Clipboard,
java.awt.datatransfer.Transferable);
}
PainterStartup/com/javera/ui/actions/CopyAction.javaPainterSta
rtup/com/javera/ui/actions/CopyAction.javapackage com.javera.
ui.actions;
import java.awt.Event;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassCopyActionextendsManagedStateActionimplementsC
lipboardOwner{
privatestaticCopyAction copyAction =newCopyAction();
privateCopyAction(){
super("Copy",IconManager.getIcon("Copy.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('C'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_C,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Copy");
}
publicstaticCopyAction getAction(){return copyAction;}
publicvoid actionPerformed(ActionEvent e ){
Copyable copyable =(Copyable)
ActionUtilities.getCommandTarget( e,Copyable.class);
if( copyable !=null){
copyable.copy( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Copyable copyable =(Copyable)
ActionUtilities.getCommandTarget( evt,Copyable.class);
if( copyable !=null){
return copyable.isCopyable( evt );
}else{
returnfalse;
}
}
publicvoid lostOwnership(Clipboard clipboard,Transferable t ){
// no need to do anything here, but required to put data on Clipb
oard
}
}
PainterStartup/com/javera/ui/actions/Cutable.classpackage
com.javera.ui.actions;
publicabstractinterface Cutable {
publicabstract void cut(java.awt.event.ActionEvent);
publicabstract boolean isCutable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Cutable.javaPainterStartup
/com/javera/ui/actions/Cutable.javapackage com.javera.ui.action
s;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceCutable{
/**
* Tells the component to do the Cut.
*/
publicvoid cut(ActionEvent evt );
/** Returns true if a Cut is currently possible. */
publicboolean isCutable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/CutAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CutAction extends
ManagedStateAction implements
java.awt.datatransfer.ClipboardOwner {
privatestatic CutAction cutAction;
static void <clinit>();
private void CutAction();
publicstatic CutAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
public void lostOwnership(java.awt.datatransfer.Clipboard,
java.awt.datatransfer.Transferable);
}
PainterStartup/com/javera/ui/actions/CutAction.javaPainterStart
up/com/javera/ui/actions/CutAction.javapackage com.javera.ui.a
ctions;
import java.awt.Event;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassCutActionextendsManagedStateActionimplementsCli
pboardOwner{
privatestaticCutAction cutAction =newCutAction();
privateCutAction(){
super("Cut",IconManager.getIcon("Cut.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('t'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_X,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Cut");
}
publicstaticCutAction getAction(){return cutAction;}
publicvoid actionPerformed(ActionEvent e ){
Cutable cutable =(Cutable)
ActionUtilities.getCommandTarget( e,Cutable.class);
if( cutable !=null){
cutable.cut( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Cutable cutable =(Cutable)
ActionUtilities.getCommandTarget( evt,Cutable.class);
if( cutable !=null){
return cutable.isCutable( evt );
}else{
returnfalse;
}
}
publicvoid lostOwnership(Clipboard par1,Transferable par2 ){
// following a paste, cut should probably be disabled at least unt
il
// a new event re-enables it
this.setEnabled(false);
}
}
PainterStartup/com/javera/ui/actions/Deleteable.classpackage
com.javera.ui.actions;
publicabstractinterface Deleteable {
publicabstract void delete(java.awt.event.ActionEvent);
publicabstract boolean isDeleteable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Deleteable.javaPainterStart
up/com/javera/ui/actions/Deleteable.javapackage com.javera.ui.
actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceDeleteable{
publicvoid delete(ActionEvent evt);
publicboolean isDeleteable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/DeleteAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass DeleteAction extends
ManagedStateAction {
privatestatic DeleteAction deleteAction;
static void <clinit>();
private void DeleteAction();
publicstatic DeleteAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/DeleteAction.javaPainterSt
artup/com/javera/ui/actions/DeleteAction.javapackage com.jave
ra.ui.actions;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassDeleteActionextendsManagedStateAction{
privatestaticDeleteAction deleteAction =newDeleteAction();
privateDeleteAction(){
super("Delete",IconManager.getIcon("Delete.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('D'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
putValue(Action.SHORT_DESCRIPTION,"Delete");
}
publicstaticDeleteAction getAction(){return deleteAction;}
publicvoid actionPerformed(ActionEvent evt ){
Deleteable deletable =(Deleteable)
ActionUtilities.getCommandTarget( evt,Deleteable.class);
if( deletable !=null){
deletable.delete( evt );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Deleteable deletable =(Deleteable)
ActionUtilities.getCommandTarget( evt,Deleteable.class);
if( deletable !=null){
return deletable.isDeleteable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Exitable.classpackage
com.javera.ui.actions;
publicabstractinterface Exitable {
publicabstract void exit(java.awt.event.ActionEvent);
publicabstract boolean isExitable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Exitable.javaPainterStartu
p/com/javera/ui/actions/Exitable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceExitable{
publicvoid exit(ActionEvent evt);
publicboolean isExitable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/ExitAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass ExitAction extends
javax.swing.AbstractAction {
privatestatic ExitAction exitAction;
static void <clinit>();
private void ExitAction();
publicstatic ExitAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ExitAction.javaPainterStar
tup/com/javera/ui/actions/ExitAction.javapackage com.javera.ui
.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassExitActionextendsAbstractAction{
privatestaticExitAction exitAction =newExitAction();
privateExitAction(){
super("Exit");
putValue(Action.MNEMONIC_KEY,newInteger('x'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_F4,Event.ALT_MASK )
);
}
publicstaticExitAction getAction(){return exitAction;}
publicvoid actionPerformed(ActionEvent e ){
Exitable exitable =(Exitable)
ActionUtilities.getCommandTarget( e,Exitable.class);
if( exitable !=null){
exitable.exit( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Exitable exitable =(Exitable)
ActionUtilities.getCommandTarget( evt,Exitable.class);
if( exitable !=null){
return exitable.isExitable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Exportable.classpackage
com.javera.ui.actions;
publicabstractinterface Exportable {
publicabstract void export(java.awt.event.ActionEvent);
publicabstract boolean isExportable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Exportable.javaPainterStar
tup/com/javera/ui/actions/Exportable.java/* Generated by Toget
her */
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Export actions.
*/
publicinterfaceExportable{
/**
* Performs the Export action.
*/
publicvoid export(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether an Export
* is currently performable.
*/
publicboolean isExportable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/ExportAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass ExportAction extends
ManagedStateAction {
privatestatic ExportAction exportAction;
static void <clinit>();
private void ExportAction();
publicstatic ExportAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ExportAction.javaPainterS
tartup/com/javera/ui/actions/ExportAction.java/* Generated by
Together */
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassExportActionextendsManagedStateAction{
privatestaticExportAction exportAction =newExportAction();
privateExportAction(){
super("Export...");
putValue(Action.MNEMONIC_KEY,newInteger('t'));
putValue(Action.SHORT_DESCRIPTION,"Export");
}
publicstaticExportAction getAction(){
return exportAction;
}
publicvoid actionPerformed(ActionEvent e ){
Exportable exportable =(Exportable)
ActionUtilities.getCommandTarget( e,Exportable.class);
if( exportable !=null)
exportable.export( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Object target =ActionUtilities.getCommandTarget( evt,
Exportable.class);
if( target !=null){
if(((Exportable)target ).isExportable( evt )){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Filterable.classpackage
com.javera.ui.actions;
publicabstractinterface Filterable {
publicabstract void filter(java.awt.event.ActionEvent);
publicabstract boolean isFilterable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Filterable.javaPainterStart
up/com/javera/ui/actions/Filterable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceFilterable{
publicvoid filter(ActionEvent evt);
publicboolean isFilterable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/FilterAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass FilterAction extends
ManagedStateAction {
privatestatic FilterAction filterAction;
static void <clinit>();
private void FilterAction();
publicstatic FilterAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/FilterAction.javaPainterSta
rtup/com/javera/ui/actions/FilterAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassFilterActionextendsManagedStateAction{
privatestaticFilterAction filterAction =newFilterAction();
privateFilterAction(){
super("Filter...",IconManager.getIcon("filter.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Filter");
}
publicstaticFilterAction getAction(){return filterAction;}
publicvoid actionPerformed(ActionEvent e ){
Filterable filterable =(Filterable)
ActionUtilities.getCommandTarget( e,Filterable.class);
if( filterable !=null){
filterable.filter( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Filterable filterable =(Filterable)
ActionUtilities.getCommandTarget( evt,Filterable.class);
if( filterable !=null){
return filterable.isFilterable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Findable.classpackage
com.javera.ui.actions;
publicabstractinterface Findable {
publicabstract void find(java.awt.event.ActionEvent);
publicabstract boolean isFindable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Findable.javaPainterStartu
p/com/javera/ui/actions/Findable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Find actions.
*/
publicinterfaceFindable{
/** Performs the Find action. */
publicvoid find(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Find
* is currently performable.
*/
publicboolean isFindable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/FindAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass FindAction extends
ManagedStateAction {
privatestatic FindAction findAction;
static void <clinit>();
private void FindAction();
publicstatic FindAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/FindAction.javaPainterStar
tup/com/javera/ui/actions/FindAction.javapackage com.javera.ui
.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
/** A managed state action for Find operations. */
publicclassFindActionextendsManagedStateAction{
privatestaticFindAction findAction =newFindAction();
privateFindAction(){
super("Find...",IconManager.getIcon("search.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Find");
putValue(Action.LONG_DESCRIPTION,"Finds text value
s");
}
publicstaticFindAction getAction(){return findAction;}
publicvoid actionPerformed(ActionEvent e ){
Findable findable =(Findable)
ActionUtilities.getCommandTarget( e,Findable.class);
if( findable !=null){
findable.find( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Findable findable =(Findable)
ActionUtilities.getCommandTarget( evt,Findable.class);
if( findable !=null){
return findable.isFindable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Groupable.classpackage
com.javera.ui.actions;
publicabstractinterface Groupable {
publicabstract void group(java.awt.event.ActionEvent);
publicabstract boolean isGroupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Groupable.javaPainterStart
up/com/javera/ui/actions/Groupable.javapackage com.javera.ui.
actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceGroupable{
/**
* Tells the component to do the group.
*/
publicvoid group(ActionEvent evt );
/** Returns true if a group is currently possible. */
publicboolean isGroupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/GroupAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass GroupAction extends
ManagedStateAction {
privatestatic GroupAction groupAction;
static void <clinit>();
private void GroupAction();
publicstatic GroupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/GroupAction.javaPainterSt
artup/com/javera/ui/actions/GroupAction.javapackage com.javer
a.ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassGroupActionextendsManagedStateAction{
privatestaticGroupAction groupAction =newGroupAction();
privateGroupAction(){
super("Group");
putValue(Action.MNEMONIC_KEY,newInteger('G'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_G,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Group");
}
publicstaticGroupAction getAction(){return groupAction;}
publicvoid actionPerformed(ActionEvent e ){
Groupable group =(Groupable)
ActionUtilities.getCommandTarget( e,Groupable.class);
if( group !=null){
group.group( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Groupable group =(Groupable)
ActionUtilities.getCommandTarget( evt,Groupable.class);
if( group !=null){
return group.isGroupable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/ManagedStateAction.class
package com.javera.ui.actions;
publicabstractsynchronizedclass ManagedStateAction extends
javax.swing.AbstractAction {
privatestatic java.util.ArrayList managedActions;
static void <clinit>();
public void ManagedStateAction();
public void ManagedStateAction(String);
public void ManagedStateAction(String, javax.swing.Icon);
publicabstract boolean
isTargetEnabled(java.util.EventObject);
publicstatic void setStateFor(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ManagedStateAction.javaP
ainterStartup/com/javera/ui/actions/ManagedStateAction.javapa
ckage com.javera.ui.actions;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.Iterator;
import javax.swing.AbstractAction;
import javax.swing.Icon;
publicabstractclassManagedStateActionextendsAbstractAction{
privatestaticArrayList managedActions =newArrayList();
publicManagedStateAction(){
super();
managedActions.add(this);
this.setEnabled(true);
}
publicManagedStateAction(String label){
super(label);
managedActions.add(this);
this.setEnabled(true);
}
publicManagedStateAction(String label,Icon icon){
super(label, icon);
managedActions.add(this);
this.setEnabled(true);
}
publicabstractboolean isTargetEnabled(EventObject evt);
publicstaticvoid setStateFor(EventObject evt){
for(Iterator iter = managedActions.iterator(); iter.hasNext();){
ManagedStateAction action =(ManagedStateAction) iter.next();
action.setEnabled(action.isTargetEnabled(evt));
}
}
}
PainterStartup/com/javera/ui/actions/Newable.classpackage
com.javera.ui.actions;
publicabstractinterface Newable {
publicabstract javax.swing.JInternalFrame
makeNew(java.awt.event.ActionEvent);
publicabstract boolean isNewable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Newable.javaPainterStartu
p/com/javera/ui/actions/Newable.javapackage com.javera.ui.acti
ons;
import javax.swing.JInternalFrame;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceNewable{
publicJInternalFrame makeNew(ActionEvent evt);
publicboolean isNewable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/NewAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass NewAction extends
javax.swing.AbstractAction {
privatestatic NewAction newAction;
static void <clinit>();
private void NewAction();
publicstatic NewAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/NewAction.javaPainterStar
tup/com/javera/ui/actions/NewAction.javapackage com.javera.ui
.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.AbstractAction;
publicclassNewActionextendsAbstractAction{
privatestaticNewAction newAction =newNewAction();
privateNewAction(){
super("New...",IconManager.getIcon("New.gif"));
putValue(Action.SHORT_DESCRIPTION,"New");
}
publicstaticNewAction getAction(){
return newAction;
}
publicvoid actionPerformed(ActionEvent e ){
Newable newable =(Newable)
ActionUtilities.getCommandTarget( e,Newable.class);
if( newable !=null){
newable.makeNew( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Newable newable =(Newable)
ActionUtilities.getCommandTarget( evt,Newable.class);
if( newable !=null){
return newable.isNewable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Openable.classpackage
com.javera.ui.actions;
publicabstractinterface Openable {
publicabstract void open(java.awt.event.ActionEvent);
publicabstract boolean isOpenable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Openable.javaPainterStartu
p/com/javera/ui/actions/Openable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceOpenable{
publicvoid open(ActionEvent evt);
publicboolean isOpenable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/OpenableSpecial.classpack
age com.javera.ui.actions;
publicabstractinterface OpenableSpecial {
publicabstract javax.swing.JInternalFrame openSpecial();
publicabstract boolean
isOpenableSpecial(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenableSpecial.javaPaint
erStartup/com/javera/ui/actions/OpenableSpecial.javapackage c
om.javera.ui.actions;
import java.util.EventObject;
import javax.swing.JInternalFrame;
publicinterfaceOpenableSpecial{
publicJInternalFrame openSpecial();
publicboolean isOpenableSpecial(EventObject evt);
}
PainterStartup/com/javera/ui/actions/OpenAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass OpenAction extends
ManagedStateAction {
privatestatic OpenAction openAction;
static void <clinit>();
private void OpenAction();
publicstatic OpenAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenAction.javaPainterSta
rtup/com/javera/ui/actions/OpenAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassOpenActionextendsManagedStateAction{
privatestaticOpenAction openAction =newOpenAction();
privateOpenAction(){
super("Open...",IconManager.getIcon("Open.gif"));
putValue(Action.SHORT_DESCRIPTION,"Open");
}
publicstaticOpenAction getAction(){
return openAction;
}
publicvoid actionPerformed(ActionEvent e ){
Openable openable =(Openable)
ActionUtilities.getCommandTarget( e,Openable.class);
if( openable !=null){
openable.open( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Openable openable =(Openable)
ActionUtilities.getCommandTarget( evt,Openable.class);
if( openable !=null){
return openable.isOpenable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/OpenSpecialAction.classpa
ckage com.javera.ui.actions;
publicsynchronizedclass OpenSpecialAction extends
ManagedStateAction {
privatestatic OpenSpecialAction openSpecialAction;
static void <clinit>();
private void OpenSpecialAction();
publicstatic OpenSpecialAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenSpecialAction.javaPai
nterStartup/com/javera/ui/actions/OpenSpecialAction.javapacka
ge com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import com.javera.ui.IconManager;
publicclassOpenSpecialActionextendsManagedStateAction{
privatestaticOpenSpecialAction openSpecialAction =newOpenS
pecialAction();
privateOpenSpecialAction()
{
super("Open Special...",IconManager.getIcon("Open.gif"));
}
publicstaticOpenSpecialAction getAction(){
return openSpecialAction;
}
publicvoid actionPerformed(ActionEvent e)
{
OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g
etCommandTarget(e,OpenableSpecial.class);
if(openable !=null){
openable.openSpecial();
}
}
publicboolean isTargetEnabled(EventObject evt){
OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g
etCommandTarget(evt,OpenableSpecial.class);
if(openable !=null){
return openable.isOpenableSpecial(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/PageSetupable.classpackag
e com.javera.ui.actions;
publicabstractinterface PageSetupable {
publicabstract void pageSetup(java.awt.event.ActionEvent);
publicabstract boolean
isPageSetupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PageSetupable.javaPainter
Startup/com/javera/ui/actions/PageSetupable.javapackage com.j
avera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Print actions.
*/
publicinterfacePageSetupable{
/** Performs the Print action. */
publicvoid pageSetup(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Print
* is currently performable.
*/
publicboolean isPageSetupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PageSetupAction.classpack
age com.javera.ui.actions;
publicsynchronizedclass PageSetupAction extends
javax.swing.AbstractAction {
privatestatic PageSetupAction pageSetupAction;
static void <clinit>();
private void PageSetupAction();
publicstatic PageSetupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PageSetupAction.javaPaint
erStartup/com/javera/ui/actions/PageSetupAction.javapackage c
om.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
import javax.swing.Action;
publicclassPageSetupActionextendsAbstractAction
{
privatestaticPageSetupAction pageSetupAction =newPageSetup
Action();
privatePageSetupAction(){
super("Page Setup...");
putValue(Action.SHORT_DESCRIPTION,"Page Setup");
}
publicstaticPageSetupAction getAction(){
return pageSetupAction;
}
publicvoid actionPerformed(ActionEvent e){
PageSetupable pageSetupable =
(PageSetupable)ActionUtilities.getCommandTarget(e,PageSetup
able.class);
if(pageSetupable !=null)
pageSetupable.pageSetup(e);
}
publicboolean isTargetEnabled(EventObject evt){
Object target =ActionUtilities.getCommandTarget(evt,PageSetu
pable.class);
if(target !=null){
if(((PageSetupable) target).isPageSetupable(evt)){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Pasteable.classpackage
com.javera.ui.actions;
publicabstractinterface Pasteable {
publicabstract void paste(java.awt.event.ActionEvent);
publicabstract boolean isPasteable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Pasteable.javaPainterStartu
p/com/javera/ui/actions/Pasteable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Components interested in interaction with PasteAction should
* implement this.
*/
publicinterfacePasteable{
/** Hands the component the object that's been Pasted. */
publicvoid paste(ActionEvent evt);
/** Returns true if a Paste is currently possible. */
publicboolean isPasteable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PasteAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass PasteAction extends
ManagedStateAction {
privatestatic PasteAction pasteAction;
static void <clinit>();
private void PasteAction();
publicstatic PasteAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PasteAction.javaPainterSta
rtup/com/javera/ui/actions/PasteAction.javapackage com.javera.
ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassPasteActionextendsManagedStateAction{
privatestaticPasteAction pasteAction =newPasteAction();
privatePasteAction(){
super("Paste",IconManager.getIcon("Paste.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('P'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_V,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Paste");
}
publicstaticPasteAction getAction(){return pasteAction;}
publicvoid actionPerformed(ActionEvent e ){
Pasteable pasteable =(Pasteable)
ActionUtilities.getCommandTarget( e,Pasteable.class);
if( pasteable !=null){
pasteable.paste( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Pasteable pasteable =(Pasteable)
ActionUtilities.getCommandTarget( evt,Pasteable.class);
if( pasteable !=null){
return pasteable.isPasteable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Printable.classpackage
com.javera.ui.actions;
publicabstractinterface Printable {
publicabstract void print(java.awt.event.ActionEvent);
publicabstract boolean isPrintable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Printable.javaPainterStartu
p/com/javera/ui/actions/Printable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Print actions.
*/
publicinterfacePrintable{
/** Performs the Print action. */
publicvoid print(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Print
* is currently performable.
*/
publicboolean isPrintable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PrintAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass PrintAction extends
ManagedStateAction {
privatestatic PrintAction printAction;
static void <clinit>();
private void PrintAction();
publicstatic PrintAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PrintAction.javaPainterSta
rtup/com/javera/ui/actions/PrintAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassPrintActionextendsManagedStateAction{
privatestaticPrintAction printAction =newPrintAction();
privatePrintAction(){
super("Print...",IconManager.getIcon("Print.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('i'));
putValue(Action.SHORT_DESCRIPTION,"Print");
}
publicstaticPrintAction getAction(){
return printAction;
}
publicvoid actionPerformed(ActionEvent e){
Printable printable =
(Printable)ActionUtilities.getCommandTarget(e,Printable.class)
;
if(printable !=null)
printable.print(e);
}
publicboolean isTargetEnabled(EventObject evt){
Object target =ActionUtilities.getCommandTarget(evt,Printable.
class);
if(target !=null){
if(((Printable) target).isPrintable(evt)){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Redoable.classpackage
com.javera.ui.actions;
publicabstractinterface Redoable {
publicabstract void redo(java.awt.event.ActionEvent);
publicabstract boolean isRedoable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Redoable.javaPainterStartu
p/com/javera/ui/actions/Redoable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceRedoable{
publicvoid redo(ActionEvent evt);
publicboolean isRedoable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/RedoAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass RedoAction extends
ManagedStateAction {
privatestatic RedoAction redoAction;
static void <clinit>();
private void RedoAction();
publicstatic RedoAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/RedoAction.javaPainterSta
rtup/com/javera/ui/actions/RedoAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassRedoActionextendsManagedStateAction{
privatestaticRedoAction redoAction =newRedoAction();
privateRedoAction(){
super("Redo",IconManager.getIcon("Redo.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('R'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_Z,
Event.CTRL_MASK +Event.SHIFT_MASK ));
putValue(Action.SHORT_DESCRIPTION,"Redo");
}
publicstaticRedoAction getAction(){
return redoAction;
}
publicvoid actionPerformed(ActionEvent evt ){
Redoable redoable =(Redoable)
ActionUtilities.getCommandTarget( evt,Redoable.class);
if( redoable !=null)
redoable.redo( evt );
}
publicboolean isTargetEnabled(EventObject evt ){
Redoable redoable =(Redoable)
ActionUtilities.getCommandTarget( evt,Redoable.class);
if( redoable !=null){
return redoable.isRedoable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Refreshable.classpackage
com.javera.ui.actions;
publicabstractinterface Refreshable {
publicabstract void refresh(java.awt.event.ActionEvent);
publicabstract boolean isRefreshable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Refreshable.javaPainterSta
rtup/com/javera/ui/actions/Refreshable.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Refresh actions.
*/
publicinterfaceRefreshable{
/** Performs the Find action. */
publicvoid refresh(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Refresh
* is currently performable.
*/
publicboolean isRefreshable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/RefreshAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass RefreshAction extends
ManagedStateAction {
privatestatic RefreshAction refreshAction;
static void <clinit>();
private void RefreshAction();
publicstatic RefreshAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/RefreshAction.javaPainter
Startup/com/javera/ui/actions/RefreshAction.javapackage com.j
avera.ui.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
/** A managed state action for Refresh operations. */
publicclassRefreshActionextendsManagedStateAction{
privatestaticRefreshAction refreshAction =newRefreshAction();
privateRefreshAction(){
super("Refresh...",IconManager.getIcon("Refresh.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Refresh");
putValue(Action.LONG_DESCRIPTION,"Refresh");
}
publicstaticRefreshAction getAction(){
return refreshAction;
}
publicvoid actionPerformed(ActionEvent e ){
Refreshable refreshable =(Refreshable)
ActionUtilities.getCommandTarget( e,Refreshable.class);
if( refreshable !=null)
refreshable.refresh( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Refreshable refreshable =(Refreshable)
ActionUtilities.getCommandTarget( evt,Refreshable.class);
if( refreshable !=null){
return refreshable.isRefreshable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Saveable.classpackage
com.javera.ui.actions;
publicabstractinterface Saveable {
publicabstract void save(java.awt.event.ActionEvent);
publicabstract boolean isSaveable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Saveable.javaPainterStartu
p/com/javera/ui/actions/Saveable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceSaveable{
publicvoid save(ActionEvent evt);
publicboolean isSaveable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass SaveAction extends
ManagedStateAction {
privatestatic SaveAction saveAction;
static void <clinit>();
private void SaveAction();
publicstatic SaveAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAction.javaPainterSta
rtup/com/javera/ui/actions/SaveAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import com.javera.ui.IconManager;
publicclassSaveActionextendsManagedStateAction{
privatestaticSaveAction saveAction =newSaveAction();
privateSaveAction(){
super("Save",IconManager.getIcon("Save.gif"));
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa
ve");
}
publicstaticSaveAction getAction(){
return saveAction;
}
publicvoid actionPerformed(ActionEvent e){
Saveable target =
(Saveable)ActionUtilities.getCommandTarget(e,Saveable.class);
if(target !=null&& target.isSaveable(e)){
target.save(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
Saveable target =
(Saveable)ActionUtilities.getCommandTarget(evt,Saveable.clas
s);
if(target !=null){
return target.isSaveable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/SaveAllable.classpackage
com.javera.ui.actions;
publicabstractinterface SaveAllable {
publicabstract void saveAll(java.awt.event.ActionEvent);
publicabstract boolean isSaveAllable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAllable.javaPainterSta
rtup/com/javera/ui/actions/SaveAllable.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceSaveAllable{
publicvoid saveAll(ActionEvent evt);
publicboolean isSaveAllable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAllAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass SaveAllAction extends
javax.swing.AbstractAction {
privatestatic SaveAllAction saveAllAction;
static void <clinit>();
private void SaveAllAction();
publicstatic SaveAllAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAllAction.javaPainter
Startup/com/javera/ui/actions/SaveAllAction.javapackage com.j
avera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassSaveAllActionextendsAbstractAction{
privatestaticSaveAllAction saveAllAction =newSaveAllAction()
;
privateSaveAllAction(){
super("Save All...");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa
ve All");
}
publicstaticSaveAllAction getAction(){
return saveAllAction;
}
publicvoid actionPerformed(ActionEvent e){
SaveAllable target =
(SaveAllable)ActionUtilities.getCommandTarget(e,SaveAllable.
class);
if(target !=null&& target.isSaveAllable(e)){
target.saveAll(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
SaveAllable target =
(SaveAllable)ActionUtilities.getCommandTarget(evt,SaveAllabl
e.class);
if(target !=null){
return target.isSaveAllable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/SaveAsable.classpackage
com.javera.ui.actions;
publicabstractinterface SaveAsable {
publicabstract void saveAs(java.awt.event.ActionEvent);
publicabstract boolean isSaveAsable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAsable.javaPainterSta
rtup/com/javera/ui/actions/SaveAsable.java//Copyright 2004, (c)
Javera Software, LLC. as an unpublished work. All rights reser
ved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved
* as another entity.
* @author David T. Smith
*/
publicinterfaceSaveAsable{
publicvoid saveAs(ActionEvent evt);
publicboolean isSaveAsable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAsAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass SaveAsAction extends
javax.swing.AbstractAction {
privatestatic SaveAsAction saveAsAction;
static void <clinit>();
private void SaveAsAction();
publicstatic SaveAsAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAsAction.javaPainter
Startup/com/javera/ui/actions/SaveAsAction.java//Copyright 20
04, (c) Javera Software, LLC. as an unpublished work. All right
s reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassSaveAsActionextendsAbstractAction{
privatestaticSaveAsAction saveAsAction =newSaveAsAction();
privateSaveAsAction(){
super("Save As...");
}
publicstaticSaveAsAction getAction(){
return saveAsAction;
}
publicvoid actionPerformed(ActionEvent e){
SaveAsable target =
(SaveAsable)ActionUtilities.getCommandTarget(e,SaveAsable.c
lass);
if(target !=null&& target.isSaveAsable(e)){
target.saveAs(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
SaveAsable target =
(SaveAsable)ActionUtilities.getCommandTarget(evt,SaveAsable
.class);
if(target !=null){
return target.isSaveAsable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Selectable.classpackage
com.javera.ui.actions;
publicabstractinterface Selectable {
publicabstract Object getSelectedItem();
}
PainterStartup/com/javera/ui/actions/Selectable.javaPainterStart
up/com/javera/ui/actions/Selectable.javapackage com.javera.ui.a
ctions;
publicinterfaceSelectable{
publicObject getSelectedItem();
}
PainterStartup/com/javera/ui/actions/Sortable.classpackage
com.javera.ui.actions;
publicabstractinterface Sortable {
publicabstract void sort(java.awt.event.ActionEvent);
publicabstract boolean isSortable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Sortable.javaPainterStartu
p/com/javera/ui/actions/Sortable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceSortable{
publicvoid sort(ActionEvent e);
publicboolean isSortable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SortAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass SortAction extends
ManagedStateAction {
privatestatic SortAction filterAction;
static void <clinit>();
private void SortAction();
publicstatic SortAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SortAction.javaPainterStar
tup/com/javera/ui/actions/SortAction.javapackage com.javera.ui
.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassSortActionextendsManagedStateAction{
privatestaticSortAction filterAction =newSortAction();
privateSortAction(){
super("Sort...",IconManager.getIcon("sort.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Sort");
}
publicstaticSortAction getAction(){
return filterAction;
}
publicvoid actionPerformed(ActionEvent e ){
Sortable sortable =(Sortable)
ActionUtilities.getCommandTarget( e,Sortable.class);
if( sortable !=null)
sortable.sort( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Sortable sortable =(Sortable)
ActionUtilities.getCommandTarget( evt,Sortable.class);
if( sortable !=null){
return sortable.isSortable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Undoable.classpackage
com.javera.ui.actions;
publicabstractinterface Undoable {
publicabstract void undo(java.awt.event.ActionEvent);
publicabstract boolean isUndoable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Undoable.javaPainterStart
up/com/javera/ui/actions/Undoable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceUndoable{
publicvoid undo(ActionEvent evt);
publicboolean isUndoable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/UndoAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass UndoAction extends
ManagedStateAction {
privatestatic UndoAction undoAction;
static void <clinit>();
private void UndoAction();
publicstatic UndoAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/UndoAction.javaPainterSta
rtup/com/javera/ui/actions/UndoAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassUndoActionextendsManagedStateAction{
privatestaticUndoAction undoAction =newUndoAction();
privateUndoAction(){
super("Undo",IconManager.getIcon("Undo.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('U'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_Z,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Undo");
}
publicstaticUndoAction getAction(){
return undoAction;
}
publicvoid actionPerformed(ActionEvent evt ){
Undoable undoable =(Undoable)
ActionUtilities.getCommandTarget( evt,Undoable.class);
if( undoable !=null)
undoable.undo( evt );
}
publicboolean isTargetEnabled(EventObject evt ){
Undoable undoable =(Undoable)
ActionUtilities.getCommandTarget( evt,Undoable.class);
if( undoable !=null){
return undoable.isUndoable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Ungroupable.classpackage
com.javera.ui.actions;
publicabstractinterface Ungroupable {
publicabstract void ungroup(java.awt.event.ActionEvent);
publicabstract boolean isUngroupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Ungroupable.javaPainterSt
artup/com/javera/ui/actions/Ungroupable.javapackage com.javer
a.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceUngroupable{
/**
* Tells the component to do the ungroup.
*/
publicvoid ungroup(ActionEvent evt );
/** Returns true if a ungroup is currently possible. */
publicboolean isUngroupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/UngroupAction.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass UngroupAction extends
ManagedStateAction {
privatestatic UngroupAction groupAction;
static void <clinit>();
private void UngroupAction();
publicstatic UngroupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/UngroupAction.javaPainter
Startup/com/javera/ui/actions/UngroupAction.javapackage com.j
avera.ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassUngroupActionextendsManagedStateAction{
privatestaticUngroupAction groupAction =newUngroupAction()
;
privateUngroupAction(){
super("Ungroup");
putValue(Action.MNEMONIC_KEY,newInteger('U'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_U,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Ungroup");
}
publicstaticUngroupAction getAction(){return groupAction;}
publicvoid actionPerformed(ActionEvent e ){
Ungroupable ungroup =(Ungroupable)
ActionUtilities.getCommandTarget( e,Ungroupable.class);
if( ungroup !=null){
ungroup.ungroup( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Ungroupable ungroup =(Ungroupable)
ActionUtilities.getCommandTarget( evt,Ungroupable.class);
if( ungroup !=null){
return ungroup.isUngroupable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/CompleteEntry.classpackage
com.javera.ui;
publicabstractinterface CompleteEntry {
publicabstract void completeEntry();
}
PainterStartup/com/javera/ui/CompleteEntry.javaPainterStartup/
com/javera/ui/CompleteEntry.javapackage com.javera.ui;
/**
* @author dtsmith
*/
publicinterfaceCompleteEntry{
publicvoid completeEntry();
}
PainterStartup/com/javera/ui/GetIcon.classpackage
com.javera.ui;
publicabstractinterface GetIcon {
publicabstract javax.swing.Icon getIcon();
}
PainterStartup/com/javera/ui/GetIcon.javaPainterStartup/com/ja
vera/ui/GetIcon.java//Copyright 2004, (c) Javera Software, LLC
. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import javax.swing.Icon;
/**
* GetIcon interface provides access to the getIcon() method use
d by
* the various renderers to obtain an Icon for a given object
*
* @author David T. Smith
*/
publicinterfaceGetIcon{
/**
* Get the icon to be displayed by the renderer
* @ return the icon to be displayed
*/
publicIcon getIcon();
}
PainterStartup/com/javera/ui/GetObject.classpackage
com.javera.ui;
publicabstractinterface GetObject {
publicabstract Object getObject();
}
PainterStartup/com/javera/ui/GetObject.javaPainterStartup/com/
javera/ui/GetObject.java//Copyright 2004, (c) Javera Software,
LLC. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetObject interface provides access to the getObject() metho
d used by
* the various renderers to obtain a contained object
*
* @author David T. Smith
*/
publicinterfaceGetObject{
/**
* Get the contained object
* @return the contained object
*/
publicObject getObject();
}
PainterStartup/com/javera/ui/GetPopupMenu.classpackage
com.javera.ui;
publicabstractinterface GetPopupMenu {
publicabstract javax.swing.JPopupMenu
getPopupMenu(java.awt.event.MouseEvent);
}
PainterStartup/com/javera/ui/GetPopupMenu.javaPainterStartup
/com/javera/ui/GetPopupMenu.java//Copyright 2004, (c) Javera
Software, LLC. as an unpublished work. All rights reserved wo
rld-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import java.awt.event.MouseEvent;
import javax.swing.JPopupMenu;
publicinterfaceGetPopupMenu{
publicJPopupMenu getPopupMenu(MouseEvent e);
}
PainterStartup/com/javera/ui/GetText.classpackage
com.javera.ui;
publicabstractinterface GetText {
publicabstract String getText();
}
PainterStartup/com/javera/ui/GetText.javaPainterStartup/com/ja
vera/ui/GetText.java//Copyright 2004, (c) Javera Software, LLC
. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetText interface provides access to the getText() method us
ed by
* the default renderers for JvList and JvComboBox to get the te
xt to be
* displayed as an entry
*
* @author David T. Smith
*/
publicinterfaceGetText{
/**
* Get the text to be displayed by the renderer
* @ return the text to be displayed
*/
publicString getText();
}
PainterStartup/com/javera/ui/GetTransferable.classpackage
com.javera.ui;
publicabstractinterface GetTransferable {
publicabstract java.awt.datatransfer.Transferable
getTransferable();
}
PainterStartup/com/javera/ui/GetTransferable.javaPainterStartu
p/com/javera/ui/GetTransferable.java// Copyright 2004, (c) Jave
ra Software, LLC. as an unpublished work. All rights reserved
world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import java.awt.datatransfer.Transferable;
/**
* @author dtsmith
*/
publicinterfaceGetTransferable{
/**
* @return
*/
Transferable getTransferable();
}
PainterStartup/com/javera/ui/GetValue.classpackage
com.javera.ui;
publicabstractinterface GetValue {
publicabstract Object getValue();
}
PainterStartup/com/javera/ui/GetValue.javaPainterStartup/com/j
avera/ui/GetValue.java//Copyright 2004, (c) Javera Software, L
LC. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetValue interface provides access to the getValue() method
used
* to obtain a value associated with an object
*
* @author David T. Smith
*/
publicinterfaceGetValue{
/**
* Get the contained object
* @return the contained object
*/
publicObject getValue();
}
PainterStartup/com/javera/ui/GuiListDataListener.classpackage
com.javera.ui;
publicabstractinterface GuiListDataListener extends
javax.swing.event.ListDataListener {
}
PainterStartup/com/javera/ui/GuiListDataListener.javaPainterSt
artup/com/javera/ui/GuiListDataListener.java// Copyright 2004,
(c) Javera Software, LLC. as an unpublished work. All rights re
served world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import javax.swing.event.ListDataListener;
/**
* @author dtsmith
*/
publicinterfaceGuiListDataListenerextendsListDataListener{
}
PainterStartup/com/javera/ui/IconManager.classpackage
com.javera.ui;
publicsynchronizedclass IconManager {
static ClassLoader classLoader;
static java.util.Hashtable iconTable;
static void <clinit>();
public void IconManager();
publicstatic javax.swing.ImageIcon getIcon(String);
publicstatic javax.swing.ImageIcon getImageIcon(String);
}
PainterStartup/com/javera/ui/IconManager.javaPainterStartup/c
om/javera/ui/IconManager.java//Copyright 2004, (c) Javera Soft
ware, LLC. as an unpublished work. All rights reserved world-
wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import java.net.*;
import java.util.Hashtable;
import javax.swing.ImageIcon;
/**
* IconManager provides a convenience class to load icons.
*
* @author David T. Smith
*/
publicclassIconManager{
staticClassLoader classLoader =IconManager.class.getClassLoa
der();
staticHashtable iconTable =newHashtable();
publicstaticImageIcon getIcon(String iconName)
{
return getImageIcon("images/"+ iconName);
}
staticpublicImageIcon getImageIcon(String iconName)
{
ImageIcon icon =(ImageIcon) iconTable.get(iconName);
if(icon ==null)
{
URL url = classLoader.getResource(iconName);
if(url !=null)
icon =newImageIcon(url);
else
icon =newImageIcon("x.gif");
iconTable.put(iconName, icon);
}
return icon;
}
}
PainterStartup/com/javera/ui/JavaObjectTransferable.classpacka
ge com.javera.ui;
publicsynchronizedclass JavaObjectTransferable implements
java.awt.datatransfer.Transferable, java.io.Serializable {
privatetransient Object javaObject;
private java.util.ArrayList dataFlavors;
public void JavaObjectTransferable(Object);
public java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors();
public boolean
isDataFlavorSupported(java.awt.datatransfer.DataFlavor);
public boolean
addDataFlavor(java.awt.datatransfer.DataFlavor);
public Object
getTransferData(java.awt.datatransfer.DataFlavor) throws
java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException;
}
PainterStartup/com/javera/ui/JavaObjectTransferable.javaPainte
rStartup/com/javera/ui/JavaObjectTransferable.java// Copyright
2004, (c) Javera Software, LLC. as an unpublished work. All ri
ghts reserved world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author dtsmith
*/
publicclassJavaObjectTransferableimplementsTransferable,Seria
lizable{
privatetransientObject javaObject;
privateArrayList dataFlavors =newArrayList();
publicJavaObjectTransferable(Object javaObject){
this.javaObject = javaObject;
}
publicDataFlavor[] getTransferDataFlavors(){
return(DataFlavor[]) dataFlavors.toArray(newDataFlavor[dataFl
avors.size()]);
}
publicboolean isDataFlavorSupported(DataFlavor flavor){
return dataFlavors.contains(flavor);
}
publicboolean addDataFlavor(DataFlavor flavor){
return dataFlavors.add(flavor);
}
publicObject getTransferData(DataFlavor flavor)throwsUnsuppo
rtedFlavorException,IOException{
if(isDataFlavorSupported(flavor)){
return javaObject;
}else{
returnnull;
}
}
}
PainterStartup/com/javera/ui/layout/JvBoxLayout$Filler.classpa
ckage com.javera.ui.layout;
publicsynchronizedclass JvBoxLayout$Filler extends
java.awt.Component implements javax.accessibility.Accessible
{
private java.awt.Dimension dim;
public void JvBoxLayout$Filler(int, int);
public java.awt.Dimension getMinimumSize();
public java.awt.Dimension getPreferredSize();
public java.awt.Dimension getMaximumSize();
}
PainterStartup/com/javera/ui/layout/JvBoxLayout.classpackage
com.javera.ui.layout;
publicsynchronizedclass JvBoxLayout implements
java.awt.LayoutManager2, com.javera.ui.LayoutPrintLayout,
java.io.Serializable {
publicstaticfinal int X_AXIS = 0;
publicstaticfinal int Y_AXIS = 1;
private int axis;
private int gap;
private int topMargin;
private int bottomMargin;
private int leftMargin;
private int rightMargin;
private java.util.Map weightMap;
public void JvBoxLayout(int);
public void JvBoxLayout(int, int, int, int, int, int);
public int getGap();
public void setGap(int);
public int getTopMargin();
public void setTopMargin(int);
public int getLeftMargin();
public void setLeftMargin(int);
public int getBottomMargin();
public void setBottomMargin(int);
public int getRightMargin();
public void setRightMargin(int);
public void addLayoutComponent(java.awt.Component,
Object);
public java.awt.Dimension
maximumLayoutSize(java.awt.Container);
public float getLayoutAlignmentX(java.awt.Container);
public float getLayoutAlignmentY(java.awt.Container);
public void invalidateLayout(java.awt.Container);
public void addLayoutComponent(String,
java.awt.Component);
public void removeLayoutComponent(java.awt.Component);
public java.awt.Dimension
minimumLayoutSize(java.awt.Container);
public java.awt.Dimension
preferredLayoutSize(java.awt.Container);
public void layoutContainer(java.awt.Container);
publicstatic java.awt.Component createFiller(int, int);
public int layoutPrint(java.awt.Container, int);
}
PainterStartup/com/javera/ui/layout/JvBoxLayout.javaPainterSt
artup/com/javera/ui/layout/JvBoxLayout.java//Copyright 2004, (
c) Javera Software, LLC. as an unpublished work. All rights res
erved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.layout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.accessibility.Accessible;
import com.javera.ui.LayoutPrintLayout;
import com.javera.ui.LayoutPrint;
//import com.javera.ui.panel.JvPanel;
/**
* A Javera box layout arranges components in a vertical or hori
zontal format.
* For vertical format all components are resized to have the sa
me width of
* the container, but have a height that is in proportion to their a
ssigned
* weights and such that the total height of all compoenents fills
the height
* of the container. Likewise a horizontal format will resize co
mponents to
* have the same width as the container and a height that is in pr
oportion to
* the assigned weights. If a component has an assigned weight
of 0 then that
* components is sized according to its preferred size.
*
* Weights are assigned using a Double as the second argument
to the
* containers add method. A null second argument will be inter
preted as a
* zero weight assignement.
*
* A Javera box layout is similar in function to a Box layout exc
ept that the
* assigned weights, not glue or preferred sizes are used to distr
ibute space
* over the row or column. Javera box layout also provides gap
* separation and margins.
*
* @author David T. Smith
*/
publicclassJvBoxLayoutimplementsLayoutManager2,LayoutPrin
tLayout,Serializable{
/**
* Horizontal axis orientation
*/
publicfinalstaticint X_AXIS =0;
/**
* Vertical axis orientation
*/
publicfinalstaticint Y_AXIS =1;
/**
* The axis orientation of the weighted layout.
*/
privateint axis;
/**
* The weighted layout manager allows a seperation of compo
nents with
* gaps. The gap will specify the space between components.
*
* @serial
* @see getGap
* @see setGap
*/
privateint gap;
/**
* The weighted layout manager allows specification of a top
margin to be
* reserved above laidout components.
*
* @serial
* @see getTopMargin
* @see setTopMargin
*/
privateint topMargin;
/**
* The command button layout manager allows specification
of a bottom
* margin to be reserved below laidout components.
*
* @serial
* @see getBottomMargin
* @see setBottomMargin
*/
privateint bottomMargin;
/**
* The weighted layout manager allows specification of a left
margin to be
* reserved to the left of the leftmost component.
*
* @serial
* @see getLeftMargin
* @see setLeftMargin
*/
privateint leftMargin;
/**
* The weighted layout manager allows specification of a rig
ht margin to
* be reserved to the right of the rightmost component.
*
* @serial
* @see getRightMargin
* @see setRightMargin
*/
privateint rightMargin;
/**
* A Map of each component's weight, keyed on the compone
nt
* objects themselves.
*/
privateMap weightMap =newHashMap();
/**
* Constructs a new Weighted Layout with specified axis, a d
efault 5 pixel
* gap, and a 5 pixel margins.
*
* @param axis X_AXIS or Y_AXIS
*/
publicJvBoxLayout(int axis){
this(axis,5,5,5,5,5);
}
/**
* Constructs a new Weighted Layout with specified axis, gap
, and margins.
*
* @param axis X_AXIS or Y_AXIS
* @param gap the gap between components.
* @param topMargin the top margin.
* @param leftMargin the left margin.
* @param bottomMargin the bottom margin.
* @param rightMargin the right margin.
*/
publicJvBoxLayout(
int axis,
int gap,
int topMargin,
int leftMargin,
int bottomMargin,
int rightMargin){
this.axis = axis;
this.gap = gap;
this.topMargin = topMargin;
this.leftMargin = leftMargin;
this.bottomMargin = bottomMargin;
this.rightMargin = rightMargin;
}
/**
* Gets the gap between components.
*
* @return the gap between components.
*/
publicint getGap(){
return gap;
}
/**
* Sets the gap between components.
*
* @param gap the gap between components
*/
publicvoid setGap(int gap){
this.gap = gap;
}
/**
* Gets the top margin to be reserved above all components.
*
* @return the top margin.
*/
publicint getTopMargin(){
return topMargin;
}
/**
* Sets the top margin to be reserve above components.
*
* @param topMargin the top margin.
*/
publicvoid setTopMargin(int topMargin){
this.topMargin = topMargin;
}
/**
* Gets the left margin to be reserved to the left of the
* leftmost component.
*
* @return the left margin.
*/
publicint getLeftMargin(){
return leftMargin;
}
/**
* Sets the left margin to be reserved to the left of the
* leftmost component.
*
* @param leftMargin the left margin.
*/
publicvoid setLeftMargin(int leftMargin){
this.leftMargin = leftMargin;
}
/**
* Gets the bottom margin to be reserved below all componen
ts.
*
* @return the bottom margin.
*/
publicint getBottomMargin(){
return bottomMargin;
18.2 problemTrue Flight Golf manufacturers a popular shaft for
golf clubs. Its trade secret is a unique process for weaving
high-tension wire into the center of the shaft such that energy is
accumulated during the swing and released at impact. A
specialized machine costing $3,000,000 is utilized in the
manufacturing process. The machine has a 3-year life and no
salvage value. True Flight uses straight-line depreciation.
During the year, 25,000 shafts were produced, and the company
was operating at full capacity. $700,000 of wire was used
during the year.(a)Is machinery depreciation fixed or variable?
Is wire fixed or variable?(b)For the two noted cost items, how
much was total variable cost and total fixed cost?(c)For the two
noted cost items, how much was variable cost per unit and how
much was fixed cost per unit?(d)Repeat requirements (b) and
(c), assuming production was only 20,000 units (and wire usage
was reduced proportionately).(e)For the following year, if the
company acquired an additional machine to enable production
of 40,000 total units, what would happen to the expected total
and per unit variable and fixed cost?(f)If the company
experiences significant growth, and finds it necessary to
continue to add additional machines, how would the machine
cost be characterized (hint: fixed, variable, or something else)?
In theory, at what production level(s) would per unit cost be
minimized?
&L&"Arial,Bold"&20 &R&"Myriad Web Pro,Bold"&20B-18.02
B-18.02
Worksheet(a)(b)(c)(d)(e)(f)
&L&"Myriad Web Pro,Bold"&12Name:
Date: Section: &R&"Myriad Web
Pro,Bold"&20B-18.02
B-18.02
19.2 ProblemMary Ann Clark is an artist and is employed by
Fenway Racing. Fenway Racing manufactures custom race cars
to exact specifications of drivers. Mary Ann's job is to hand
paint logos and other custom artwork on each car. Below is her
daily time sheet for March 7, 20X6:FENWAY
RACINGEmployee:Mary Ann ClarkDaily Time
SheetDate:03/07/X6Start
TimeStop
TimeJob NumberTaskClientAdmin HoursDirect Labor
Hours8:008:30set upPrepare paints and
airbrushn/a0.500.008:3010:45#11245Paint race numbersMario
A.0.002.2510:4511:00repairsRepair broken
compressorn/a0.250.0011:0012:00#11302Paint advertising sign
on
doorAJF0.000.7512:001:00lunchn/an/a0.000.001:004:30#11305
Paint hood logoJeff G.0.003.504:305:00clean upClean up
equipmentn/a0.500.00Total hours1.256.50(a)Examine the time
sheet and find the error. What is the importance of correctly
accumulating time by job? How does the time sheet data track
to the cost assignment process?(b)How much of Mary Ann's
time (after making the correction) is attributable to direct labor
and how much to overhead? How is the direct labor cost
assigned to individual jobs, and how is the overhead cost
allocated?
&R&"Myriad Web Pro,Bold"&20B-19.02
B-19.02
Worksheet (2)(a)(b)
&L&"Myriad Web Pro,Bold"&12Name:
Date: Section: &R&"Myriad Web
Pro,Bold"&20B-19.02
B-19.02
20.2 ProblemZeus Corporation produces cultured diamonds via
a secretive process that grows the diamonds in a vacuum
chamber filled with a carbon gas cloud. The diamonds are
produced in a single continuous process, and Zeus uses the
weighted-average process costing method of accounting for
production.
The production process requires constant utilization of facilities
and equipment, as well as direct labor by skilled technicians.
As a result, direct labor and factory overhead are both deemed
to be introduced uniformly throughout production.At the
beginning of June, 20X9, 4,000 diamonds were in process.
During June, an additional 8,000 diamonds were started, and
7,000 diamonds were completed and transferred to finished
goods.As of the beginning of the month, work in process was
80% complete with respect to materials and 60% complete with
respect to conversion costs.As of the end of the month, work in
process was 70% complete with respect to materials and 40%
complete with respect to conversion costs.Prepare a "unit
reconciliation" schedule that includes calculations showing the
equivalent units of materials, direct labor, and factory overhead
for June.
&L&"Arial,Bold"&20 &R&"Myriad Web Pro,Bold"&20B-20.02
B-20.02
Worksheet (3)Unit Reconciliation:Quantity
ScheduleBeginning Work in ProcessStarted into
ProductionTotal Units into ProductionEquivalent Units
Calculations:ConversionDirect
MaterialsDirect
LaborFactory OverheadTo Finished GoodsEnding Work in
ProcessTotal Units ReconciledEnding WIP Completion Status:
Materials = %
Conversion = %
&L&"Myriad Web Pro,Bold"&12Name:
Date: Section: &R&"Myriad Web
Pro,Bold"&20B-20.02
B-20.02
21.2 ProblemLogan Township acquired its water system from a
private company on June 1. No receivables were acquired with
the purchase. Therefore, total accounts receivable on June 1
had a zero balance.
Logan plans to bill customers in the month following the month
of sale, and 70% of the resulting billings will be collected
during the billing month. In the next following month, 90% of
the remaining balance should be collectable. The remaining
uncollectible amounts will relate to citizens who have moved
away. Such amounts are never expected to be collected and will
be written off.
Water sales during June are estimated at $3,000,000, and
expected to increase 30% in July. August sales will be 10% less
than July sales.(a)For each dollar of sales, how much is
expected to be collected?(b)Estimate the monthly cash
collections for June, July, August, and September.(c)As of the
end of August, how much will be the estimated amount of
receivables from which future cash flows are anticipated?
&L&"Arial,Bold"&12 &R&"Myriad Web Pro,Bold"&20B-21.02
B-21.02
Worksheet
(4)(a)(b)JuneJulyAugustSeptember(c)JuneJulyAugustTotal
Receivables
&L&"Myriad Web Pro,Bold"&12Name:
Date: Section: &R&"Myriad Web
Pro,Bold"&20B-21.02
B-21.02

Weitere ähnliche Inhalte

Ähnlich wie asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx

Read carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdfRead carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdf
rupeshmehta151
 
Please make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdfPlease make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdf
SALES97
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
mercysuttle
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1
Muhammad Shebl Farag
 
Parametric Equations with Mathcad Prime
Parametric Equations with Mathcad PrimeParametric Equations with Mathcad Prime
Parametric Equations with Mathcad Prime
Caroline de Villèle
 
ArcGIS Volume Measurement Tutorial
ArcGIS Volume Measurement TutorialArcGIS Volume Measurement Tutorial
ArcGIS Volume Measurement Tutorial
Alicia Hore
 

Ähnlich wie asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx (20)

Read carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdfRead carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdf
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
 
Please make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdfPlease make the complete program, Distinguish between header files a.pdf
Please make the complete program, Distinguish between header files a.pdf
 
Drawing Contour Map using Computer Software
Drawing Contour Map using Computer SoftwareDrawing Contour Map using Computer Software
Drawing Contour Map using Computer Software
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
Intake 37 6
Intake 37 6Intake 37 6
Intake 37 6
 
Jfreechart tutorial
Jfreechart tutorialJfreechart tutorial
Jfreechart tutorial
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Maps
MapsMaps
Maps
 
Applets
AppletsApplets
Applets
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
 
The Ring programming language version 1.3 book - Part 38 of 88
The Ring programming language version 1.3 book - Part 38 of 88The Ring programming language version 1.3 book - Part 38 of 88
The Ring programming language version 1.3 book - Part 38 of 88
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
First kinectslides
First kinectslidesFirst kinectslides
First kinectslides
 
cs247 slides
cs247 slidescs247 slides
cs247 slides
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1
 
Module 4.pdf
Module 4.pdfModule 4.pdf
Module 4.pdf
 
Parametric Equations with Mathcad Prime
Parametric Equations with Mathcad PrimeParametric Equations with Mathcad Prime
Parametric Equations with Mathcad Prime
 
ArcGIS Volume Measurement Tutorial
ArcGIS Volume Measurement TutorialArcGIS Volume Measurement Tutorial
ArcGIS Volume Measurement Tutorial
 

Mehr von fredharris32

A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docxA P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
fredharris32
 
A nurse educator is preparing an orientation on culture and the wo.docx
A nurse educator is preparing an orientation on culture and the wo.docxA nurse educator is preparing an orientation on culture and the wo.docx
A nurse educator is preparing an orientation on culture and the wo.docx
fredharris32
 
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docxA NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
fredharris32
 
A network consisting of M cities and M-1 roads connecting them is gi.docx
A network consisting of M cities and M-1 roads connecting them is gi.docxA network consisting of M cities and M-1 roads connecting them is gi.docx
A network consisting of M cities and M-1 roads connecting them is gi.docx
fredharris32
 
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docxA New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
fredharris32
 
A N A M E R I C A N H I S T O R YG I V E M EL I B.docx
A N  A M E R I C A N  H I S T O R YG I V E  M EL I B.docxA N  A M E R I C A N  H I S T O R YG I V E  M EL I B.docx
A N A M E R I C A N H I S T O R YG I V E M EL I B.docx
fredharris32
 

Mehr von fredharris32 (20)

A report writingAt least 5 pagesTitle pageExecutive Su.docx
A report writingAt least 5 pagesTitle pageExecutive Su.docxA report writingAt least 5 pagesTitle pageExecutive Su.docx
A report writingAt least 5 pagesTitle pageExecutive Su.docx
 
A reflection of how your life has changedevolved as a result of the.docx
A reflection of how your life has changedevolved as a result of the.docxA reflection of how your life has changedevolved as a result of the.docx
A reflection of how your life has changedevolved as a result of the.docx
 
A Princeton University study argues that the preferences of average.docx
A Princeton University study argues that the preferences of average.docxA Princeton University study argues that the preferences of average.docx
A Princeton University study argues that the preferences of average.docx
 
A rapidly growing small firm does not have access to sufficient exte.docx
A rapidly growing small firm does not have access to sufficient exte.docxA rapidly growing small firm does not have access to sufficient exte.docx
A rapidly growing small firm does not have access to sufficient exte.docx
 
A psychiatrist bills for 10 hours of psychotherapy and medication ch.docx
A psychiatrist bills for 10 hours of psychotherapy and medication ch.docxA psychiatrist bills for 10 hours of psychotherapy and medication ch.docx
A psychiatrist bills for 10 hours of psychotherapy and medication ch.docx
 
A project to put on a major international sporting competition has t.docx
A project to put on a major international sporting competition has t.docxA project to put on a major international sporting competition has t.docx
A project to put on a major international sporting competition has t.docx
 
A professional services company wants to globalize by offering s.docx
A professional services company wants to globalize by offering s.docxA professional services company wants to globalize by offering s.docx
A professional services company wants to globalize by offering s.docx
 
A presentation( PowerPoint) on the novel, Disgrace by J . M. Coetzee.docx
A presentation( PowerPoint) on the novel, Disgrace by J . M. Coetzee.docxA presentation( PowerPoint) on the novel, Disgrace by J . M. Coetzee.docx
A presentation( PowerPoint) on the novel, Disgrace by J . M. Coetzee.docx
 
a presentatiion on how the over dependence of IOT AI and robotics di.docx
a presentatiion on how the over dependence of IOT AI and robotics di.docxa presentatiion on how the over dependence of IOT AI and robotics di.docx
a presentatiion on how the over dependence of IOT AI and robotics di.docx
 
A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docxA P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
A P P L I C A T I O N S A N D I M P L E M E N T A T I O Nh.docx
 
A nursing care plan (NCP) is a formal process that includes .docx
A nursing care plan (NCP) is a formal process that includes .docxA nursing care plan (NCP) is a formal process that includes .docx
A nursing care plan (NCP) is a formal process that includes .docx
 
A nurse educator is preparing an orientation on culture and the wo.docx
A nurse educator is preparing an orientation on culture and the wo.docxA nurse educator is preparing an orientation on culture and the wo.docx
A nurse educator is preparing an orientation on culture and the wo.docx
 
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docxA NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
A NOVEL TEACHER EVALUATION MODEL 1 Branching Paths A Nove.docx
 
A Look at the Marburg Fever OutbreaksThis week we will exami.docx
A Look at the Marburg Fever OutbreaksThis week we will exami.docxA Look at the Marburg Fever OutbreaksThis week we will exami.docx
A Look at the Marburg Fever OutbreaksThis week we will exami.docx
 
A network consisting of M cities and M-1 roads connecting them is gi.docx
A network consisting of M cities and M-1 roads connecting them is gi.docxA network consisting of M cities and M-1 roads connecting them is gi.docx
A network consisting of M cities and M-1 roads connecting them is gi.docx
 
A minimum 20-page (not including cover page, abstract, table of cont.docx
A minimum 20-page (not including cover page, abstract, table of cont.docxA minimum 20-page (not including cover page, abstract, table of cont.docx
A minimum 20-page (not including cover page, abstract, table of cont.docx
 
A major component of being a teacher is the collaboration with t.docx
A major component of being a teacher is the collaboration with t.docxA major component of being a teacher is the collaboration with t.docx
A major component of being a teacher is the collaboration with t.docx
 
a mad professor slips a secret tablet in your food that makes you gr.docx
a mad professor slips a secret tablet in your food that makes you gr.docxa mad professor slips a secret tablet in your food that makes you gr.docx
a mad professor slips a secret tablet in your food that makes you gr.docx
 
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docxA New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
A New Mindset for   Leading Change [WLO 1][CLO 6]Through.docx
 
A N A M E R I C A N H I S T O R YG I V E M EL I B.docx
A N  A M E R I C A N  H I S T O R YG I V E  M EL I B.docxA N  A M E R I C A N  H I S T O R YG I V E  M EL I B.docx
A N A M E R I C A N H I S T O R YG I V E M EL I B.docx
 

Kürzlich hochgeladen

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 

Kürzlich hochgeladen (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx

  • 1. asmt7/~$sc_210_-_assignment_7_fall_15.doc asmt7/cosc_210_-_assignment_7_fall_15.doc COSC 210 - Object Oriented Programming Assignment 7 The objectives of this assignment are to: 1) Gain further understanding and experience with inheritance. 2) Gain understanding and experience with polymorphism. 3) Gain further understanding and experience with interfaces. 4) Gain understanding and experience with low level graphics. 5) Modify an existing program to meet new requirements applying concepts of objectives 1 through 4. 6) Gain experience with medium-size Java program. 7) Continue to practice good programming techniques. AFTER YOU HAVE COMPLETED, create a zip file named [your name]Assignment7.zip containing your entire project. Upload the .zip file to Moodle. Printout all source files you created or modified. Include a screen shot of the editor with boxes, ellipses, lines and images shown in the editor. Turn-in all printouts. COSC 210 – Fundamentals of Computer Science Assignment 7 Problem Statement Updated On the tomcat drive in folder cosc210 you will find file named
  • 2. PainterStartup.zip. This file contains the source code for the start of a Painter program. In its current state, Painter can create boxes and text objects at given locations. Both boxes and text objects can be repositioned and resized using a mouse. The task is to add to the program the implementation for an ellipse, line, image, and group objects. Instructions: 1) Add an ellipse object. An ellipse is very similar in implementation as the box, except it renders an oval instead of a rectangle. The ellipse can be repositioned by dragging the object to a new location. The ellipse can be resized by first clicking over the ellipse to display grab handles and then dragging a grab handle to a new position. The grab handles are to be rendered at the same positions as the box. Likewise, clicking anywhere in the smallest rectangle that encloses the ellipse performs selection. 2) Add a Line object. A Line is to be created by selecting a Line tool and then click and drag over the canvas. The line is rendered from the point of the initial click to the mouse pointer. On releasing the mouse the construction of the line object is completed. Have the Line object inherit from PtrDrawAbstractAreaObject. Thus it will have only two grab handles. A Line is selected by clicking anywhere over the line. Right now if you click anywhere in the rectangular region hold the line, then the line is selected. To accomplish this task, override the isOver method in PtrDrawAbstractAreaObject. Given below is a partial solution to determine if a mouse click position (the x and y parameters to the isOver method) is over a line: double ratio = (double) getWidth() / (double) getHeight();
  • 3. if (Math.abs((x - getX()) * ratio) - (y - getY()) <= 1) { return true; } You need to modify this code when the y to x ratio is less than - 1 or greater than 1. (Hint: Inverse the roles of width and height, and the roles of x and y) 3) Add an Image object. An Image object is created by selecting an Image tool and then clicking anywhere on the canvas. On clicking the canvas, a File Selection Dialog should be displayed. The dialog prompts for selection of .gif and .jpg files. On selecting a .gif or .jpg file and clicking “Open”, an Image object that renders the image of the selected file is created at the click position. Image selection and drag behaviors are the same as a Box object. The image object additionally renders lines at the edges of the image (as done in Box). The code for displaying a File Selection Dialog is: JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(".jpg") || f.getName().toLowerCase().endsWith(".gif");
  • 4. } public String getDescription() { return "JPG & GIF Images"; } }); if (fileChooser.showOpenDialog(editor) == JFileChooser.APPROVE_OPTION) { ImageIcon image = new ImageIcon(fileChooser.getSelectedFile().getAbsolutePath()); /* you will need to do stuff with your image here */ /* note the Graphics object has a method drawImage() */ } Make sure to import FileFilter from the javax.swing.filechooser. The above code is added to the PtrDrawImageTool 4) Add a group object. A group object represents a set of objects that have been grouped together. A partial implementation is provided. Your task is to fix the rendering. The group object should draw each of the objects in the groupedObjects list. Before drawing any object your will need to create a new graphics object that is transposed to the dimensions if the group object itself. To do this use:
  • 5. Graphics2D g2 = (Graphics2D) g.create(getX(), getY(), getWidth(), getHeight()); After drawing each of the objects in groupedObjects list, release the resources used by the created graphics object by calling dispose: g2.dispose(); One more item, after creating the new graphics context and before drawing each of the objects in the group, use scale as follows: g2.scale(getXScale(), getYScale()); This will insure that all objects get rendered as at the right scale when the group object itself is resized. 5) Have the box, ellipse, line, and image implement the Lineable and Colorable interface. Create instance variables as needed to hold the values of the parameters. Before doing any rendering of lines (e.g., any g.drawXXXX method) create a new graphics context as follows: Graphics2D g2 = (Graphics2D) g.create(); Then set the line width by: g2.setStroke(new BasicStroke(lineWidth)); Also set the color to the lineColor: g2.setColor(lineColor);
  • 6. Use g2 to do the rendering of the lines. After all line rendering, release the resources of the graphics context by calling dispose(); In the corresponding tool object (e.g., PtrDrawBoxTool for PtrDrawBox), after creating the draw object add the following calls in the object: box.setLineColor(editor.getLineColor()); box.setLineWidth(editor.getLineWidth()); 6) Have the box and ellipse, line implement the Colorable interface. Create instance variables as need to hold the value of the parameter (color). Before doing any rendering of filled areas (e.g., any g.fillXXXX method) set the graphics color to the color instance variable: g.setColor(color); // or use g2 if you have created a new graphics context In the corresponding tool object (e.g., PtrDrawBoxTool for PtrDrawBox), after creating the draw object add the following calls in the object: box.setColor(editor.getColor()); Warning: Your objects may not render correctly whenever they are resized such that either the height or width is negative. Bonus: 1) Bonus 5 points -The isInside method provides the implementation for determining if the line is inside a rectangular area as specified by the parameters. This code may not work right if the ending point of the line is to the left or
  • 7. above the starting point. Fix this to work in all cases for 3 bonus points. 2) Currently, if you click in the area where two objects overlap, the object on the bottom is selected. Change this so that the top object is selected. 3 bonus points. 3) On the Group object, clicking in anywhere in the bounding rectangle will select the object. Change this so that a group is only selected with clicking over an object in the group. 3 bonus points 4) The south east grab handle processing is broken. Fix this to behave as the other grab handles for 3 bonus points 5) Currently, if you drag the right hand side smaller than the left (likewise the bottom smaller that the top) the objects may not be displayed correctly (or even at all). Once in the bad display state, clicking over the object no longer works. Second, if you click in the region of overlapping object, the object on the bottom gets selected. It should be the top object. Fix these bugs. One possible solution is to add a normalizeRect method to PtrDrawRect. This will adjust the x, y, width, and height variables so that width and height are never negative. For example if width is negative then change x to be the value of x plus width and then change width to be the absolute value. Place a call to this method in the corresponding setter methods after updating the instance variables. (Note there may be problems with the grab handles). 3 points bonus. asmt7/image_0.jpeg asmt7/image_2.jpeg asmt7/image_4.jpeg
  • 8. asmt7/image_5.jpeg asmt7/painterstartupasmt7.zip PainterStartup/.classpath PainterStartup/.project Painter org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature PainterStartup/.settings/org.eclipse.jdt.core.prefs #Fri Apr 27 08:03:31 EDT 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enable d org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
  • 9. org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 PainterStartup/com/javera/ui/actions/ActionUtilities.classpacka ge com.javera.ui.actions; publicsynchronizedclass ActionUtilities { public void ActionUtilities(); publicstatic javax.swing.JFrame getFrame(java.util.EventObject); publicstatic javax.swing.JDialog getDialog(java.util.EventObject); publicstatic Object getCommandTarget(java.util.EventObject, Class); } PainterStartup/com/javera/ui/actions/ActionUtilities.javaPainter Startup/com/javera/ui/actions/ActionUtilities.javapackage com.j avera.ui.actions; import java.awt.Component; import java.util.EventObject;
  • 10. import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; publicclassActionUtilities{ publicstaticJFrame getFrame(EventObject e){ if(!(e.getSource()instanceofComponent)){ returnnull; } Component comp =(Component) e.getSource(); JFrame frame =(JFrame)SwingUtilities.getAncestorOfClass(JFra me.class, comp); while(frame ==null){ JPopupMenu popupMenu = (JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu. class, comp); if(popupMenu ==null){ returnnull; } comp = popupMenu.getInvoker(); frame =(JFrame)SwingUtilities.getAncestorOfClass(JFr ame.class, comp); } return frame; } publicstaticJDialog getDialog(EventObject e){
  • 11. if(!(e.getSource()instanceofComponent)){ returnnull; } Component comp =(Component) e.getSource(); JDialog dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD ialog.class, comp); while(dialog ==null){ JPopupMenu popupMenu = (JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu. class, comp); if(popupMenu ==null){ returnnull; } comp = popupMenu.getInvoker(); dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD ialog.class, comp); } return dialog; } publicstaticObject getCommandTarget(EventObject e,Class com mandClass){ Object target = getDialog(e); if(target ==null){ target = getFrame(e); } for(;;){
  • 12. if(target ==null){ returnnull; } if(commandClass.isInstance(target)){ return target; } if(!(target instanceofSelectable)) returnnull; target =((Selectable) target).getSelectedItem(); } } } PainterStartup/com/javera/ui/actions/Addable.classpackage com.javera.ui.actions; publicabstractinterface Addable { publicabstract void add(java.awt.event.ActionEvent); publicabstract boolean isAddable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Addable.javaPainterStartu p/com/javera/ui/actions/Addable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * Things that support adding a new item (AddAction) should i mplement this interface. */
  • 13. publicinterfaceAddable{ publicvoid add(ActionEvent e); publicboolean isAddable(EventObject evt); } PainterStartup/com/javera/ui/actions/AddAction.classpackage com.javera.ui.actions; publicsynchronizedclass AddAction extends ManagedStateAction { privatestatic AddAction addAction; static void <clinit>(); private void AddAction(); publicstatic AddAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/AddAction.javaPainterStar tup/com/javera/ui/actions/AddAction.javapackage com.javera.ui .actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassAddActionextendsManagedStateAction{ privatestaticAddAction addAction =newAddAction(); privateAddAction(){ super("New...",IconManager.getIcon("Add.gif")); putValue(Action.SHORT_DESCRIPTION,"New");
  • 14. } publicstaticAddAction getAction(){ return addAction; } publicvoid actionPerformed(ActionEvent e ){ Addable target =(Addable)ActionUtilities.getCommandTarget( e , Addable.class); if( target !=null&& target.isAddable( e )){ target.add( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Addable target =(Addable)ActionUtilities.getCommandTarget( e vt, Addable.class); if( target !=null){ return target.isAddable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Closeable.classpackage com.javera.ui.actions; publicabstractinterface Closeable { publicabstract void close(java.awt.event.ActionEvent); publicabstract boolean isCloseable(java.util.EventObject); }
  • 15. PainterStartup/com/javera/ui/actions/Closeable.javaPainterStart up/com/javera/ui/actions/Closeable.javapackage com.javera.ui.a ctions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceCloseable{ publicvoid close(ActionEvent evt); publicboolean isCloseable(EventObject evt); } PainterStartup/com/javera/ui/actions/CloseAction.classpackage com.javera.ui.actions; publicsynchronizedclass CloseAction extends ManagedStateAction { privatestatic CloseAction saveAction; static void <clinit>(); private void CloseAction(); publicstatic CloseAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAction.javaPainterSt artup/com/javera/ui/actions/CloseAction.java//Copyright 2004, ( c) Javera Software, LLC. as an unpublished work. All rights res
  • 16. erved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicclassCloseActionextendsManagedStateAction{ privatestaticCloseAction saveAction =newCloseAction(); privateCloseAction(){ super("Close"); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl ose"); } publicstaticCloseAction getAction(){ return saveAction; } publicvoid actionPerformed(ActionEvent e){ Closeable target = (Closeable)ActionUtilities.getCommandTarget(e,Closeable.class ); if(target !=null&& target.isCloseable(e)){ target.close(e); } } publicboolean isTargetEnabled(EventObject evt){ Closeable target = (Closeable)ActionUtilities.getCommandTarget(evt,Closeable.cla ss);
  • 17. if(target !=null){ return target.isCloseable(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/CloseAllable.classpackage com.javera.ui.actions; publicabstractinterface CloseAllable { publicabstract boolean closeAll(java.awt.event.ActionEvent); publicabstract boolean isCloseAllable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAllable.javaPainterSt artup/com/javera/ui/actions/CloseAllable.javapackage com.javer a.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceCloseAllable{ publicboolean closeAll(ActionEvent evt); publicboolean isCloseAllable(EventObject evt); }
  • 18. PainterStartup/com/javera/ui/actions/CloseAllAction.classpacka ge com.javera.ui.actions; publicsynchronizedclass CloseAllAction extends javax.swing.AbstractAction { privatestatic CloseAllAction saveAllAction; static void <clinit>(); private void CloseAllAction(); publicstatic CloseAllAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAllAction.javaPainte rStartup/com/javera/ui/actions/CloseAllAction.javapackage com .javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; publicclassCloseAllActionextendsAbstractAction{ privatestaticCloseAllAction saveAllAction =newCloseAllAction (); privateCloseAllAction(){ super("Close All..."); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl ose All"); } publicstaticCloseAllAction getAction(){ return saveAllAction; }
  • 19. publicvoid actionPerformed(ActionEvent e){ CloseAllable target = (CloseAllable)ActionUtilities.getCommandTarget(e,CloseAllabl e.class); if(target !=null&& target.isCloseAllable(e)){ target.closeAll(e); } } publicboolean isTargetEnabled(EventObject evt){ CloseAllable target = (CloseAllable)ActionUtilities.getCommandTarget(evt,CloseAlla ble.class); if(target !=null){ return target.isCloseAllable(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Copyable.classpackage com.javera.ui.actions; publicabstractinterface Copyable { publicabstract void copy(java.awt.event.ActionEvent); publicabstract boolean isCopyable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Copyable.javaPainterStartu p/com/javera/ui/actions/Copyable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent;
  • 20. import java.util.EventObject; /** * Components interested in interacting with CopyAction (e.g. h ave UI-level * Copy support) should implement this. */ publicinterfaceCopyable{ /** * Tells the Component to do the Copy. */ publicvoid copy(ActionEvent evt ); /** Return true if a Copy is current possible. */ publicboolean isCopyable(EventObject evt ); } PainterStartup/com/javera/ui/actions/CopyAction.classpackage com.javera.ui.actions; publicsynchronizedclass CopyAction extends ManagedStateAction implements java.awt.datatransfer.ClipboardOwner { privatestatic CopyAction copyAction; static void <clinit>(); private void CopyAction(); publicstatic CopyAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); public void lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable); }
  • 21. PainterStartup/com/javera/ui/actions/CopyAction.javaPainterSta rtup/com/javera/ui/actions/CopyAction.javapackage com.javera. ui.actions; import java.awt.Event; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassCopyActionextendsManagedStateActionimplementsC lipboardOwner{ privatestaticCopyAction copyAction =newCopyAction(); privateCopyAction(){ super("Copy",IconManager.getIcon("Copy.gif")); putValue(Action.MNEMONIC_KEY,newInteger('C')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Copy"); } publicstaticCopyAction getAction(){return copyAction;} publicvoid actionPerformed(ActionEvent e ){ Copyable copyable =(Copyable)
  • 22. ActionUtilities.getCommandTarget( e,Copyable.class); if( copyable !=null){ copyable.copy( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Copyable copyable =(Copyable) ActionUtilities.getCommandTarget( evt,Copyable.class); if( copyable !=null){ return copyable.isCopyable( evt ); }else{ returnfalse; } } publicvoid lostOwnership(Clipboard clipboard,Transferable t ){ // no need to do anything here, but required to put data on Clipb oard } } PainterStartup/com/javera/ui/actions/Cutable.classpackage com.javera.ui.actions; publicabstractinterface Cutable { publicabstract void cut(java.awt.event.ActionEvent); publicabstract boolean isCutable(java.util.EventObject); }
  • 23. PainterStartup/com/javera/ui/actions/Cutable.javaPainterStartup /com/javera/ui/actions/Cutable.javapackage com.javera.ui.action s; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceCutable{ /** * Tells the component to do the Cut. */ publicvoid cut(ActionEvent evt ); /** Returns true if a Cut is currently possible. */ publicboolean isCutable(EventObject evt ); } PainterStartup/com/javera/ui/actions/CutAction.classpackage com.javera.ui.actions; publicsynchronizedclass CutAction extends ManagedStateAction implements java.awt.datatransfer.ClipboardOwner { privatestatic CutAction cutAction; static void <clinit>(); private void CutAction(); publicstatic CutAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); public void lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable); }
  • 24. PainterStartup/com/javera/ui/actions/CutAction.javaPainterStart up/com/javera/ui/actions/CutAction.javapackage com.javera.ui.a ctions; import java.awt.Event; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassCutActionextendsManagedStateActionimplementsCli pboardOwner{ privatestaticCutAction cutAction =newCutAction(); privateCutAction(){ super("Cut",IconManager.getIcon("Cut.gif")); putValue(Action.MNEMONIC_KEY,newInteger('t')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Cut"); } publicstaticCutAction getAction(){return cutAction;} publicvoid actionPerformed(ActionEvent e ){ Cutable cutable =(Cutable)
  • 25. ActionUtilities.getCommandTarget( e,Cutable.class); if( cutable !=null){ cutable.cut( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Cutable cutable =(Cutable) ActionUtilities.getCommandTarget( evt,Cutable.class); if( cutable !=null){ return cutable.isCutable( evt ); }else{ returnfalse; } } publicvoid lostOwnership(Clipboard par1,Transferable par2 ){ // following a paste, cut should probably be disabled at least unt il // a new event re-enables it this.setEnabled(false); } } PainterStartup/com/javera/ui/actions/Deleteable.classpackage com.javera.ui.actions; publicabstractinterface Deleteable { publicabstract void delete(java.awt.event.ActionEvent); publicabstract boolean isDeleteable(java.util.EventObject); }
  • 26. PainterStartup/com/javera/ui/actions/Deleteable.javaPainterStart up/com/javera/ui/actions/Deleteable.javapackage com.javera.ui. actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceDeleteable{ publicvoid delete(ActionEvent evt); publicboolean isDeleteable(EventObject evt); } PainterStartup/com/javera/ui/actions/DeleteAction.classpackage com.javera.ui.actions; publicsynchronizedclass DeleteAction extends ManagedStateAction { privatestatic DeleteAction deleteAction; static void <clinit>(); private void DeleteAction(); publicstatic DeleteAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/DeleteAction.javaPainterSt artup/com/javera/ui/actions/DeleteAction.javapackage com.jave ra.ui.actions; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject;
  • 27. import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassDeleteActionextendsManagedStateAction{ privatestaticDeleteAction deleteAction =newDeleteAction(); privateDeleteAction(){ super("Delete",IconManager.getIcon("Delete.gif")); putValue(Action.MNEMONIC_KEY,newInteger('D')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0)); putValue(Action.SHORT_DESCRIPTION,"Delete"); } publicstaticDeleteAction getAction(){return deleteAction;} publicvoid actionPerformed(ActionEvent evt ){ Deleteable deletable =(Deleteable) ActionUtilities.getCommandTarget( evt,Deleteable.class); if( deletable !=null){ deletable.delete( evt ); } } publicboolean isTargetEnabled(EventObject evt ){ Deleteable deletable =(Deleteable) ActionUtilities.getCommandTarget( evt,Deleteable.class); if( deletable !=null){ return deletable.isDeleteable( evt ); }else{
  • 28. returnfalse; } } } PainterStartup/com/javera/ui/actions/Exitable.classpackage com.javera.ui.actions; publicabstractinterface Exitable { publicabstract void exit(java.awt.event.ActionEvent); publicabstract boolean isExitable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Exitable.javaPainterStartu p/com/javera/ui/actions/Exitable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceExitable{ publicvoid exit(ActionEvent evt); publicboolean isExitable(EventObject evt); } PainterStartup/com/javera/ui/actions/ExitAction.classpackage com.javera.ui.actions; publicsynchronizedclass ExitAction extends javax.swing.AbstractAction { privatestatic ExitAction exitAction; static void <clinit>(); private void ExitAction();
  • 29. publicstatic ExitAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/ExitAction.javaPainterStar tup/com/javera/ui/actions/ExitAction.javapackage com.javera.ui .actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.KeyStroke; publicclassExitActionextendsAbstractAction{ privatestaticExitAction exitAction =newExitAction(); privateExitAction(){ super("Exit"); putValue(Action.MNEMONIC_KEY,newInteger('x')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4,Event.ALT_MASK ) ); } publicstaticExitAction getAction(){return exitAction;} publicvoid actionPerformed(ActionEvent e ){ Exitable exitable =(Exitable)
  • 30. ActionUtilities.getCommandTarget( e,Exitable.class); if( exitable !=null){ exitable.exit( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Exitable exitable =(Exitable) ActionUtilities.getCommandTarget( evt,Exitable.class); if( exitable !=null){ return exitable.isExitable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Exportable.classpackage com.javera.ui.actions; publicabstractinterface Exportable { publicabstract void export(java.awt.event.ActionEvent); publicabstract boolean isExportable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Exportable.javaPainterStar tup/com/javera/ui/actions/Exportable.java/* Generated by Toget her */ package com.javera.ui.actions;
  • 31. import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Export actions. */ publicinterfaceExportable{ /** * Performs the Export action. */ publicvoid export(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether an Export * is currently performable. */ publicboolean isExportable(EventObject evt ); } PainterStartup/com/javera/ui/actions/ExportAction.classpackage com.javera.ui.actions; publicsynchronizedclass ExportAction extends ManagedStateAction { privatestatic ExportAction exportAction; static void <clinit>(); private void ExportAction(); publicstatic ExportAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); }
  • 32. PainterStartup/com/javera/ui/actions/ExportAction.javaPainterS tartup/com/javera/ui/actions/ExportAction.java/* Generated by Together */ package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassExportActionextendsManagedStateAction{ privatestaticExportAction exportAction =newExportAction(); privateExportAction(){ super("Export..."); putValue(Action.MNEMONIC_KEY,newInteger('t')); putValue(Action.SHORT_DESCRIPTION,"Export"); } publicstaticExportAction getAction(){ return exportAction; } publicvoid actionPerformed(ActionEvent e ){ Exportable exportable =(Exportable) ActionUtilities.getCommandTarget( e,Exportable.class); if( exportable !=null) exportable.export( e ); } publicboolean isTargetEnabled(EventObject evt ){ Object target =ActionUtilities.getCommandTarget( evt, Exportable.class); if( target !=null){ if(((Exportable)target ).isExportable( evt )){
  • 33. returntrue; } } returnfalse; } } PainterStartup/com/javera/ui/actions/Filterable.classpackage com.javera.ui.actions; publicabstractinterface Filterable { publicabstract void filter(java.awt.event.ActionEvent); publicabstract boolean isFilterable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Filterable.javaPainterStart up/com/javera/ui/actions/Filterable.javapackage com.javera.ui.a ctions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceFilterable{ publicvoid filter(ActionEvent evt); publicboolean isFilterable(EventObject evt); } PainterStartup/com/javera/ui/actions/FilterAction.classpackage com.javera.ui.actions; publicsynchronizedclass FilterAction extends ManagedStateAction { privatestatic FilterAction filterAction; static void <clinit>(); private void FilterAction();
  • 34. publicstatic FilterAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/FilterAction.javaPainterSta rtup/com/javera/ui/actions/FilterAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassFilterActionextendsManagedStateAction{ privatestaticFilterAction filterAction =newFilterAction(); privateFilterAction(){ super("Filter...",IconManager.getIcon("filter.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Filter"); } publicstaticFilterAction getAction(){return filterAction;} publicvoid actionPerformed(ActionEvent e ){ Filterable filterable =(Filterable) ActionUtilities.getCommandTarget( e,Filterable.class); if( filterable !=null){ filterable.filter( e ); }
  • 35. } publicboolean isTargetEnabled(EventObject evt ){ Filterable filterable =(Filterable) ActionUtilities.getCommandTarget( evt,Filterable.class); if( filterable !=null){ return filterable.isFilterable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Findable.classpackage com.javera.ui.actions; publicabstractinterface Findable { publicabstract void find(java.awt.event.ActionEvent); publicabstract boolean isFindable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Findable.javaPainterStartu p/com/javera/ui/actions/Findable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Find actions. */
  • 36. publicinterfaceFindable{ /** Performs the Find action. */ publicvoid find(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Find * is currently performable. */ publicboolean isFindable(EventObject evt ); } PainterStartup/com/javera/ui/actions/FindAction.classpackage com.javera.ui.actions; publicsynchronizedclass FindAction extends ManagedStateAction { privatestatic FindAction findAction; static void <clinit>(); private void FindAction(); publicstatic FindAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/FindAction.javaPainterStar tup/com/javera/ui/actions/FindAction.javapackage com.javera.ui .actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action;
  • 37. import com.javera.ui.IconManager; /** A managed state action for Find operations. */ publicclassFindActionextendsManagedStateAction{ privatestaticFindAction findAction =newFindAction(); privateFindAction(){ super("Find...",IconManager.getIcon("search.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Find"); putValue(Action.LONG_DESCRIPTION,"Finds text value s"); } publicstaticFindAction getAction(){return findAction;} publicvoid actionPerformed(ActionEvent e ){ Findable findable =(Findable) ActionUtilities.getCommandTarget( e,Findable.class); if( findable !=null){ findable.find( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Findable findable =(Findable) ActionUtilities.getCommandTarget( evt,Findable.class); if( findable !=null){ return findable.isFindable( evt ); }else{ returnfalse; } } }
  • 38. PainterStartup/com/javera/ui/actions/Groupable.classpackage com.javera.ui.actions; publicabstractinterface Groupable { publicabstract void group(java.awt.event.ActionEvent); publicabstract boolean isGroupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Groupable.javaPainterStart up/com/javera/ui/actions/Groupable.javapackage com.javera.ui. actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceGroupable{ /** * Tells the component to do the group. */ publicvoid group(ActionEvent evt ); /** Returns true if a group is currently possible. */ publicboolean isGroupable(EventObject evt ); } PainterStartup/com/javera/ui/actions/GroupAction.classpackage com.javera.ui.actions; publicsynchronizedclass GroupAction extends ManagedStateAction {
  • 39. privatestatic GroupAction groupAction; static void <clinit>(); private void GroupAction(); publicstatic GroupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/GroupAction.javaPainterSt artup/com/javera/ui/actions/GroupAction.javapackage com.javer a.ui.actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassGroupActionextendsManagedStateAction{ privatestaticGroupAction groupAction =newGroupAction(); privateGroupAction(){ super("Group"); putValue(Action.MNEMONIC_KEY,newInteger('G')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_G,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Group"); } publicstaticGroupAction getAction(){return groupAction;}
  • 40. publicvoid actionPerformed(ActionEvent e ){ Groupable group =(Groupable) ActionUtilities.getCommandTarget( e,Groupable.class); if( group !=null){ group.group( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Groupable group =(Groupable) ActionUtilities.getCommandTarget( evt,Groupable.class); if( group !=null){ return group.isGroupable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/ManagedStateAction.class package com.javera.ui.actions; publicabstractsynchronizedclass ManagedStateAction extends javax.swing.AbstractAction { privatestatic java.util.ArrayList managedActions; static void <clinit>(); public void ManagedStateAction(); public void ManagedStateAction(String); public void ManagedStateAction(String, javax.swing.Icon); publicabstract boolean isTargetEnabled(java.util.EventObject);
  • 41. publicstatic void setStateFor(java.util.EventObject); } PainterStartup/com/javera/ui/actions/ManagedStateAction.javaP ainterStartup/com/javera/ui/actions/ManagedStateAction.javapa ckage com.javera.ui.actions; import java.util.ArrayList; import java.util.EventObject; import java.util.Iterator; import javax.swing.AbstractAction; import javax.swing.Icon; publicabstractclassManagedStateActionextendsAbstractAction{ privatestaticArrayList managedActions =newArrayList(); publicManagedStateAction(){ super(); managedActions.add(this); this.setEnabled(true); } publicManagedStateAction(String label){ super(label); managedActions.add(this); this.setEnabled(true); } publicManagedStateAction(String label,Icon icon){ super(label, icon); managedActions.add(this); this.setEnabled(true); }
  • 42. publicabstractboolean isTargetEnabled(EventObject evt); publicstaticvoid setStateFor(EventObject evt){ for(Iterator iter = managedActions.iterator(); iter.hasNext();){ ManagedStateAction action =(ManagedStateAction) iter.next(); action.setEnabled(action.isTargetEnabled(evt)); } } } PainterStartup/com/javera/ui/actions/Newable.classpackage com.javera.ui.actions; publicabstractinterface Newable { publicabstract javax.swing.JInternalFrame makeNew(java.awt.event.ActionEvent); publicabstract boolean isNewable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Newable.javaPainterStartu p/com/javera/ui/actions/Newable.javapackage com.javera.ui.acti ons; import javax.swing.JInternalFrame; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceNewable{ publicJInternalFrame makeNew(ActionEvent evt); publicboolean isNewable(EventObject evt); } PainterStartup/com/javera/ui/actions/NewAction.classpackage
  • 43. com.javera.ui.actions; publicsynchronizedclass NewAction extends javax.swing.AbstractAction { privatestatic NewAction newAction; static void <clinit>(); private void NewAction(); publicstatic NewAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/NewAction.javaPainterStar tup/com/javera/ui/actions/NewAction.javapackage com.javera.ui .actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.AbstractAction; publicclassNewActionextendsAbstractAction{ privatestaticNewAction newAction =newNewAction(); privateNewAction(){ super("New...",IconManager.getIcon("New.gif")); putValue(Action.SHORT_DESCRIPTION,"New"); } publicstaticNewAction getAction(){ return newAction; } publicvoid actionPerformed(ActionEvent e ){
  • 44. Newable newable =(Newable) ActionUtilities.getCommandTarget( e,Newable.class); if( newable !=null){ newable.makeNew( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Newable newable =(Newable) ActionUtilities.getCommandTarget( evt,Newable.class); if( newable !=null){ return newable.isNewable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Openable.classpackage com.javera.ui.actions; publicabstractinterface Openable { publicabstract void open(java.awt.event.ActionEvent); publicabstract boolean isOpenable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Openable.javaPainterStartu p/com/javera/ui/actions/Openable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject;
  • 45. publicinterfaceOpenable{ publicvoid open(ActionEvent evt); publicboolean isOpenable(EventObject evt); } PainterStartup/com/javera/ui/actions/OpenableSpecial.classpack age com.javera.ui.actions; publicabstractinterface OpenableSpecial { publicabstract javax.swing.JInternalFrame openSpecial(); publicabstract boolean isOpenableSpecial(java.util.EventObject); } PainterStartup/com/javera/ui/actions/OpenableSpecial.javaPaint erStartup/com/javera/ui/actions/OpenableSpecial.javapackage c om.javera.ui.actions; import java.util.EventObject; import javax.swing.JInternalFrame; publicinterfaceOpenableSpecial{ publicJInternalFrame openSpecial(); publicboolean isOpenableSpecial(EventObject evt); } PainterStartup/com/javera/ui/actions/OpenAction.classpackage com.javera.ui.actions; publicsynchronizedclass OpenAction extends ManagedStateAction { privatestatic OpenAction openAction; static void <clinit>();
  • 46. private void OpenAction(); publicstatic OpenAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/OpenAction.javaPainterSta rtup/com/javera/ui/actions/OpenAction.javapackage com.javera. ui.actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassOpenActionextendsManagedStateAction{ privatestaticOpenAction openAction =newOpenAction(); privateOpenAction(){ super("Open...",IconManager.getIcon("Open.gif")); putValue(Action.SHORT_DESCRIPTION,"Open"); } publicstaticOpenAction getAction(){ return openAction; } publicvoid actionPerformed(ActionEvent e ){ Openable openable =(Openable) ActionUtilities.getCommandTarget( e,Openable.class); if( openable !=null){ openable.open( e ); }
  • 47. } publicboolean isTargetEnabled(EventObject evt ){ Openable openable =(Openable) ActionUtilities.getCommandTarget( evt,Openable.class); if( openable !=null){ return openable.isOpenable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/OpenSpecialAction.classpa ckage com.javera.ui.actions; publicsynchronizedclass OpenSpecialAction extends ManagedStateAction { privatestatic OpenSpecialAction openSpecialAction; static void <clinit>(); private void OpenSpecialAction(); publicstatic OpenSpecialAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/OpenSpecialAction.javaPai nterStartup/com/javera/ui/actions/OpenSpecialAction.javapacka ge com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject;
  • 48. import com.javera.ui.IconManager; publicclassOpenSpecialActionextendsManagedStateAction{ privatestaticOpenSpecialAction openSpecialAction =newOpenS pecialAction(); privateOpenSpecialAction() { super("Open Special...",IconManager.getIcon("Open.gif")); } publicstaticOpenSpecialAction getAction(){ return openSpecialAction; } publicvoid actionPerformed(ActionEvent e) { OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g etCommandTarget(e,OpenableSpecial.class); if(openable !=null){ openable.openSpecial(); } } publicboolean isTargetEnabled(EventObject evt){ OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g etCommandTarget(evt,OpenableSpecial.class); if(openable !=null){ return openable.isOpenableSpecial(evt); }else{ returnfalse; } } }
  • 49. PainterStartup/com/javera/ui/actions/PageSetupable.classpackag e com.javera.ui.actions; publicabstractinterface PageSetupable { publicabstract void pageSetup(java.awt.event.ActionEvent); publicabstract boolean isPageSetupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PageSetupable.javaPainter Startup/com/javera/ui/actions/PageSetupable.javapackage com.j avera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Print actions. */ publicinterfacePageSetupable{ /** Performs the Print action. */ publicvoid pageSetup(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Print * is currently performable. */ publicboolean isPageSetupable(EventObject evt ); }
  • 50. PainterStartup/com/javera/ui/actions/PageSetupAction.classpack age com.javera.ui.actions; publicsynchronizedclass PageSetupAction extends javax.swing.AbstractAction { privatestatic PageSetupAction pageSetupAction; static void <clinit>(); private void PageSetupAction(); publicstatic PageSetupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PageSetupAction.javaPaint erStartup/com/javera/ui/actions/PageSetupAction.javapackage c om.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; import javax.swing.Action; publicclassPageSetupActionextendsAbstractAction { privatestaticPageSetupAction pageSetupAction =newPageSetup Action(); privatePageSetupAction(){ super("Page Setup..."); putValue(Action.SHORT_DESCRIPTION,"Page Setup"); } publicstaticPageSetupAction getAction(){ return pageSetupAction; }
  • 51. publicvoid actionPerformed(ActionEvent e){ PageSetupable pageSetupable = (PageSetupable)ActionUtilities.getCommandTarget(e,PageSetup able.class); if(pageSetupable !=null) pageSetupable.pageSetup(e); } publicboolean isTargetEnabled(EventObject evt){ Object target =ActionUtilities.getCommandTarget(evt,PageSetu pable.class); if(target !=null){ if(((PageSetupable) target).isPageSetupable(evt)){ returntrue; } } returnfalse; } } PainterStartup/com/javera/ui/actions/Pasteable.classpackage com.javera.ui.actions; publicabstractinterface Pasteable { publicabstract void paste(java.awt.event.ActionEvent); publicabstract boolean isPasteable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Pasteable.javaPainterStartu p/com/javera/ui/actions/Pasteable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent;
  • 52. import java.util.EventObject; /** * Components interested in interaction with PasteAction should * implement this. */ publicinterfacePasteable{ /** Hands the component the object that's been Pasted. */ publicvoid paste(ActionEvent evt); /** Returns true if a Paste is currently possible. */ publicboolean isPasteable(EventObject evt ); } PainterStartup/com/javera/ui/actions/PasteAction.classpackage com.javera.ui.actions; publicsynchronizedclass PasteAction extends ManagedStateAction { privatestatic PasteAction pasteAction; static void <clinit>(); private void PasteAction(); publicstatic PasteAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PasteAction.javaPainterSta rtup/com/javera/ui/actions/PasteAction.javapackage com.javera. ui.actions; import java.awt.Event;
  • 53. import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassPasteActionextendsManagedStateAction{ privatestaticPasteAction pasteAction =newPasteAction(); privatePasteAction(){ super("Paste",IconManager.getIcon("Paste.gif")); putValue(Action.MNEMONIC_KEY,newInteger('P')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Paste"); } publicstaticPasteAction getAction(){return pasteAction;} publicvoid actionPerformed(ActionEvent e ){ Pasteable pasteable =(Pasteable) ActionUtilities.getCommandTarget( e,Pasteable.class); if( pasteable !=null){ pasteable.paste( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Pasteable pasteable =(Pasteable)
  • 54. ActionUtilities.getCommandTarget( evt,Pasteable.class); if( pasteable !=null){ return pasteable.isPasteable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Printable.classpackage com.javera.ui.actions; publicabstractinterface Printable { publicabstract void print(java.awt.event.ActionEvent); publicabstract boolean isPrintable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Printable.javaPainterStartu p/com/javera/ui/actions/Printable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Print actions. */ publicinterfacePrintable{ /** Performs the Print action. */
  • 55. publicvoid print(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Print * is currently performable. */ publicboolean isPrintable(EventObject evt ); } PainterStartup/com/javera/ui/actions/PrintAction.classpackage com.javera.ui.actions; publicsynchronizedclass PrintAction extends ManagedStateAction { privatestatic PrintAction printAction; static void <clinit>(); private void PrintAction(); publicstatic PrintAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PrintAction.javaPainterSta rtup/com/javera/ui/actions/PrintAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassPrintActionextendsManagedStateAction{
  • 56. privatestaticPrintAction printAction =newPrintAction(); privatePrintAction(){ super("Print...",IconManager.getIcon("Print.gif")); putValue(Action.MNEMONIC_KEY,newInteger('i')); putValue(Action.SHORT_DESCRIPTION,"Print"); } publicstaticPrintAction getAction(){ return printAction; } publicvoid actionPerformed(ActionEvent e){ Printable printable = (Printable)ActionUtilities.getCommandTarget(e,Printable.class) ; if(printable !=null) printable.print(e); } publicboolean isTargetEnabled(EventObject evt){ Object target =ActionUtilities.getCommandTarget(evt,Printable. class); if(target !=null){ if(((Printable) target).isPrintable(evt)){ returntrue; } } returnfalse; } } PainterStartup/com/javera/ui/actions/Redoable.classpackage com.javera.ui.actions;
  • 57. publicabstractinterface Redoable { publicabstract void redo(java.awt.event.ActionEvent); publicabstract boolean isRedoable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Redoable.javaPainterStartu p/com/javera/ui/actions/Redoable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceRedoable{ publicvoid redo(ActionEvent evt); publicboolean isRedoable(EventObject evt); } PainterStartup/com/javera/ui/actions/RedoAction.classpackage com.javera.ui.actions; publicsynchronizedclass RedoAction extends ManagedStateAction { privatestatic RedoAction redoAction; static void <clinit>(); private void RedoAction(); publicstatic RedoAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/RedoAction.javaPainterSta rtup/com/javera/ui/actions/RedoAction.javapackage com.javera. ui.actions;
  • 58. import com.javera.ui.IconManager; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassRedoActionextendsManagedStateAction{ privatestaticRedoAction redoAction =newRedoAction(); privateRedoAction(){ super("Redo",IconManager.getIcon("Redo.gif")); putValue(Action.MNEMONIC_KEY,newInteger('R')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK +Event.SHIFT_MASK )); putValue(Action.SHORT_DESCRIPTION,"Redo"); } publicstaticRedoAction getAction(){ return redoAction; } publicvoid actionPerformed(ActionEvent evt ){ Redoable redoable =(Redoable) ActionUtilities.getCommandTarget( evt,Redoable.class); if( redoable !=null) redoable.redo( evt ); } publicboolean isTargetEnabled(EventObject evt ){ Redoable redoable =(Redoable)
  • 59. ActionUtilities.getCommandTarget( evt,Redoable.class); if( redoable !=null){ return redoable.isRedoable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Refreshable.classpackage com.javera.ui.actions; publicabstractinterface Refreshable { publicabstract void refresh(java.awt.event.ActionEvent); publicabstract boolean isRefreshable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Refreshable.javaPainterSta rtup/com/javera/ui/actions/Refreshable.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Refresh actions. */ publicinterfaceRefreshable{ /** Performs the Find action. */ publicvoid refresh(ActionEvent evt ); /**
  • 60. * Implementing object should use this method to specify wh ether a Refresh * is currently performable. */ publicboolean isRefreshable(EventObject evt ); } PainterStartup/com/javera/ui/actions/RefreshAction.classpackag e com.javera.ui.actions; publicsynchronizedclass RefreshAction extends ManagedStateAction { privatestatic RefreshAction refreshAction; static void <clinit>(); private void RefreshAction(); publicstatic RefreshAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/RefreshAction.javaPainter Startup/com/javera/ui/actions/RefreshAction.javapackage com.j avera.ui.actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; /** A managed state action for Refresh operations. */ publicclassRefreshActionextendsManagedStateAction{ privatestaticRefreshAction refreshAction =newRefreshAction(); privateRefreshAction(){
  • 61. super("Refresh...",IconManager.getIcon("Refresh.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Refresh"); putValue(Action.LONG_DESCRIPTION,"Refresh"); } publicstaticRefreshAction getAction(){ return refreshAction; } publicvoid actionPerformed(ActionEvent e ){ Refreshable refreshable =(Refreshable) ActionUtilities.getCommandTarget( e,Refreshable.class); if( refreshable !=null) refreshable.refresh( e ); } publicboolean isTargetEnabled(EventObject evt ){ Refreshable refreshable =(Refreshable) ActionUtilities.getCommandTarget( evt,Refreshable.class); if( refreshable !=null){ return refreshable.isRefreshable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Saveable.classpackage com.javera.ui.actions; publicabstractinterface Saveable { publicabstract void save(java.awt.event.ActionEvent); publicabstract boolean isSaveable(java.util.EventObject);
  • 62. } PainterStartup/com/javera/ui/actions/Saveable.javaPainterStartu p/com/javera/ui/actions/Saveable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceSaveable{ publicvoid save(ActionEvent evt); publicboolean isSaveable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAction.classpackage com.javera.ui.actions; publicsynchronizedclass SaveAction extends ManagedStateAction { privatestatic SaveAction saveAction; static void <clinit>(); private void SaveAction(); publicstatic SaveAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAction.javaPainterSta
  • 63. rtup/com/javera/ui/actions/SaveAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import com.javera.ui.IconManager; publicclassSaveActionextendsManagedStateAction{ privatestaticSaveAction saveAction =newSaveAction(); privateSaveAction(){ super("Save",IconManager.getIcon("Save.gif")); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa ve"); } publicstaticSaveAction getAction(){ return saveAction; } publicvoid actionPerformed(ActionEvent e){ Saveable target = (Saveable)ActionUtilities.getCommandTarget(e,Saveable.class); if(target !=null&& target.isSaveable(e)){ target.save(e); } } publicboolean isTargetEnabled(EventObject evt){ Saveable target = (Saveable)ActionUtilities.getCommandTarget(evt,Saveable.clas s); if(target !=null){ return target.isSaveable(evt);
  • 64. }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/SaveAllable.classpackage com.javera.ui.actions; publicabstractinterface SaveAllable { publicabstract void saveAll(java.awt.event.ActionEvent); publicabstract boolean isSaveAllable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAllable.javaPainterSta rtup/com/javera/ui/actions/SaveAllable.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceSaveAllable{ publicvoid saveAll(ActionEvent evt); publicboolean isSaveAllable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAllAction.classpackag e com.javera.ui.actions;
  • 65. publicsynchronizedclass SaveAllAction extends javax.swing.AbstractAction { privatestatic SaveAllAction saveAllAction; static void <clinit>(); private void SaveAllAction(); publicstatic SaveAllAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAllAction.javaPainter Startup/com/javera/ui/actions/SaveAllAction.javapackage com.j avera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; publicclassSaveAllActionextendsAbstractAction{ privatestaticSaveAllAction saveAllAction =newSaveAllAction() ; privateSaveAllAction(){ super("Save All..."); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa ve All"); } publicstaticSaveAllAction getAction(){ return saveAllAction; } publicvoid actionPerformed(ActionEvent e){ SaveAllable target =
  • 66. (SaveAllable)ActionUtilities.getCommandTarget(e,SaveAllable. class); if(target !=null&& target.isSaveAllable(e)){ target.saveAll(e); } } publicboolean isTargetEnabled(EventObject evt){ SaveAllable target = (SaveAllable)ActionUtilities.getCommandTarget(evt,SaveAllabl e.class); if(target !=null){ return target.isSaveAllable(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/SaveAsable.classpackage com.javera.ui.actions; publicabstractinterface SaveAsable { publicabstract void saveAs(java.awt.event.ActionEvent); publicabstract boolean isSaveAsable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAsable.javaPainterSta rtup/com/javera/ui/actions/SaveAsable.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reser ved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms.
  • 67. package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved * as another entity. * @author David T. Smith */ publicinterfaceSaveAsable{ publicvoid saveAs(ActionEvent evt); publicboolean isSaveAsable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAsAction.classpackag e com.javera.ui.actions; publicsynchronizedclass SaveAsAction extends javax.swing.AbstractAction { privatestatic SaveAsAction saveAsAction; static void <clinit>(); private void SaveAsAction(); publicstatic SaveAsAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAsAction.javaPainter Startup/com/javera/ui/actions/SaveAsAction.java//Copyright 20 04, (c) Javera Software, LLC. as an unpublished work. All right s reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use
  • 68. restricted to licensing terms. package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; publicclassSaveAsActionextendsAbstractAction{ privatestaticSaveAsAction saveAsAction =newSaveAsAction(); privateSaveAsAction(){ super("Save As..."); } publicstaticSaveAsAction getAction(){ return saveAsAction; } publicvoid actionPerformed(ActionEvent e){ SaveAsable target = (SaveAsable)ActionUtilities.getCommandTarget(e,SaveAsable.c lass); if(target !=null&& target.isSaveAsable(e)){ target.saveAs(e); } } publicboolean isTargetEnabled(EventObject evt){ SaveAsable target = (SaveAsable)ActionUtilities.getCommandTarget(evt,SaveAsable .class); if(target !=null){ return target.isSaveAsable(evt);
  • 69. }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Selectable.classpackage com.javera.ui.actions; publicabstractinterface Selectable { publicabstract Object getSelectedItem(); } PainterStartup/com/javera/ui/actions/Selectable.javaPainterStart up/com/javera/ui/actions/Selectable.javapackage com.javera.ui.a ctions; publicinterfaceSelectable{ publicObject getSelectedItem(); } PainterStartup/com/javera/ui/actions/Sortable.classpackage com.javera.ui.actions; publicabstractinterface Sortable { publicabstract void sort(java.awt.event.ActionEvent); publicabstract boolean isSortable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Sortable.javaPainterStartu p/com/javera/ui/actions/Sortable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent;
  • 70. import java.util.EventObject; publicinterfaceSortable{ publicvoid sort(ActionEvent e); publicboolean isSortable(EventObject evt); } PainterStartup/com/javera/ui/actions/SortAction.classpackage com.javera.ui.actions; publicsynchronizedclass SortAction extends ManagedStateAction { privatestatic SortAction filterAction; static void <clinit>(); private void SortAction(); publicstatic SortAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SortAction.javaPainterStar tup/com/javera/ui/actions/SortAction.javapackage com.javera.ui .actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassSortActionextendsManagedStateAction{ privatestaticSortAction filterAction =newSortAction(); privateSortAction(){ super("Sort...",IconManager.getIcon("sort.gif"));
  • 71. putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Sort"); } publicstaticSortAction getAction(){ return filterAction; } publicvoid actionPerformed(ActionEvent e ){ Sortable sortable =(Sortable) ActionUtilities.getCommandTarget( e,Sortable.class); if( sortable !=null) sortable.sort( e ); } publicboolean isTargetEnabled(EventObject evt ){ Sortable sortable =(Sortable) ActionUtilities.getCommandTarget( evt,Sortable.class); if( sortable !=null){ return sortable.isSortable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Undoable.classpackage com.javera.ui.actions; publicabstractinterface Undoable { publicabstract void undo(java.awt.event.ActionEvent); publicabstract boolean isUndoable(java.util.EventObject); }
  • 72. PainterStartup/com/javera/ui/actions/Undoable.javaPainterStart up/com/javera/ui/actions/Undoable.javapackage com.javera.ui.a ctions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceUndoable{ publicvoid undo(ActionEvent evt); publicboolean isUndoable(EventObject evt); } PainterStartup/com/javera/ui/actions/UndoAction.classpackage com.javera.ui.actions; publicsynchronizedclass UndoAction extends ManagedStateAction { privatestatic UndoAction undoAction; static void <clinit>(); private void UndoAction(); publicstatic UndoAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/UndoAction.javaPainterSta rtup/com/javera/ui/actions/UndoAction.javapackage com.javera. ui.actions; import com.javera.ui.IconManager; import java.awt.Event; import java.awt.event.ActionEvent;
  • 73. import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassUndoActionextendsManagedStateAction{ privatestaticUndoAction undoAction =newUndoAction(); privateUndoAction(){ super("Undo",IconManager.getIcon("Undo.gif")); putValue(Action.MNEMONIC_KEY,newInteger('U')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Undo"); } publicstaticUndoAction getAction(){ return undoAction; } publicvoid actionPerformed(ActionEvent evt ){ Undoable undoable =(Undoable) ActionUtilities.getCommandTarget( evt,Undoable.class); if( undoable !=null) undoable.undo( evt ); } publicboolean isTargetEnabled(EventObject evt ){ Undoable undoable =(Undoable) ActionUtilities.getCommandTarget( evt,Undoable.class); if( undoable !=null){ return undoable.isUndoable( evt ); }else{
  • 74. returnfalse; } } } PainterStartup/com/javera/ui/actions/Ungroupable.classpackage com.javera.ui.actions; publicabstractinterface Ungroupable { publicabstract void ungroup(java.awt.event.ActionEvent); publicabstract boolean isUngroupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Ungroupable.javaPainterSt artup/com/javera/ui/actions/Ungroupable.javapackage com.javer a.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceUngroupable{ /** * Tells the component to do the ungroup. */ publicvoid ungroup(ActionEvent evt ); /** Returns true if a ungroup is currently possible. */ publicboolean isUngroupable(EventObject evt ); } PainterStartup/com/javera/ui/actions/UngroupAction.classpacka
  • 75. ge com.javera.ui.actions; publicsynchronizedclass UngroupAction extends ManagedStateAction { privatestatic UngroupAction groupAction; static void <clinit>(); private void UngroupAction(); publicstatic UngroupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/UngroupAction.javaPainter Startup/com/javera/ui/actions/UngroupAction.javapackage com.j avera.ui.actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassUngroupActionextendsManagedStateAction{ privatestaticUngroupAction groupAction =newUngroupAction() ; privateUngroupAction(){ super("Ungroup"); putValue(Action.MNEMONIC_KEY,newInteger('U')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Ungroup");
  • 76. } publicstaticUngroupAction getAction(){return groupAction;} publicvoid actionPerformed(ActionEvent e ){ Ungroupable ungroup =(Ungroupable) ActionUtilities.getCommandTarget( e,Ungroupable.class); if( ungroup !=null){ ungroup.ungroup( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Ungroupable ungroup =(Ungroupable) ActionUtilities.getCommandTarget( evt,Ungroupable.class); if( ungroup !=null){ return ungroup.isUngroupable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/CompleteEntry.classpackage com.javera.ui; publicabstractinterface CompleteEntry { publicabstract void completeEntry(); }
  • 77. PainterStartup/com/javera/ui/CompleteEntry.javaPainterStartup/ com/javera/ui/CompleteEntry.javapackage com.javera.ui; /** * @author dtsmith */ publicinterfaceCompleteEntry{ publicvoid completeEntry(); } PainterStartup/com/javera/ui/GetIcon.classpackage com.javera.ui; publicabstractinterface GetIcon { publicabstract javax.swing.Icon getIcon(); } PainterStartup/com/javera/ui/GetIcon.javaPainterStartup/com/ja vera/ui/GetIcon.java//Copyright 2004, (c) Javera Software, LLC . as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import javax.swing.Icon; /** * GetIcon interface provides access to the getIcon() method use d by * the various renderers to obtain an Icon for a given object * * @author David T. Smith */ publicinterfaceGetIcon{
  • 78. /** * Get the icon to be displayed by the renderer * @ return the icon to be displayed */ publicIcon getIcon(); } PainterStartup/com/javera/ui/GetObject.classpackage com.javera.ui; publicabstractinterface GetObject { publicabstract Object getObject(); } PainterStartup/com/javera/ui/GetObject.javaPainterStartup/com/ javera/ui/GetObject.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; /** * GetObject interface provides access to the getObject() metho d used by * the various renderers to obtain a contained object * * @author David T. Smith */ publicinterfaceGetObject{ /** * Get the contained object * @return the contained object */ publicObject getObject();
  • 79. } PainterStartup/com/javera/ui/GetPopupMenu.classpackage com.javera.ui; publicabstractinterface GetPopupMenu { publicabstract javax.swing.JPopupMenu getPopupMenu(java.awt.event.MouseEvent); } PainterStartup/com/javera/ui/GetPopupMenu.javaPainterStartup /com/javera/ui/GetPopupMenu.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reserved wo rld-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import java.awt.event.MouseEvent; import javax.swing.JPopupMenu; publicinterfaceGetPopupMenu{ publicJPopupMenu getPopupMenu(MouseEvent e); } PainterStartup/com/javera/ui/GetText.classpackage com.javera.ui; publicabstractinterface GetText { publicabstract String getText(); } PainterStartup/com/javera/ui/GetText.javaPainterStartup/com/ja
  • 80. vera/ui/GetText.java//Copyright 2004, (c) Javera Software, LLC . as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; /** * GetText interface provides access to the getText() method us ed by * the default renderers for JvList and JvComboBox to get the te xt to be * displayed as an entry * * @author David T. Smith */ publicinterfaceGetText{ /** * Get the text to be displayed by the renderer * @ return the text to be displayed */ publicString getText(); } PainterStartup/com/javera/ui/GetTransferable.classpackage com.javera.ui; publicabstractinterface GetTransferable { publicabstract java.awt.datatransfer.Transferable getTransferable(); } PainterStartup/com/javera/ui/GetTransferable.javaPainterStartu p/com/javera/ui/GetTransferable.java// Copyright 2004, (c) Jave ra Software, LLC. as an unpublished work. All rights reserved
  • 81. world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui; import java.awt.datatransfer.Transferable; /** * @author dtsmith */ publicinterfaceGetTransferable{ /** * @return */ Transferable getTransferable(); } PainterStartup/com/javera/ui/GetValue.classpackage com.javera.ui; publicabstractinterface GetValue { publicabstract Object getValue(); } PainterStartup/com/javera/ui/GetValue.javaPainterStartup/com/j avera/ui/GetValue.java//Copyright 2004, (c) Javera Software, L LC. as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui;
  • 82. /** * GetValue interface provides access to the getValue() method used * to obtain a value associated with an object * * @author David T. Smith */ publicinterfaceGetValue{ /** * Get the contained object * @return the contained object */ publicObject getValue(); } PainterStartup/com/javera/ui/GuiListDataListener.classpackage com.javera.ui; publicabstractinterface GuiListDataListener extends javax.swing.event.ListDataListener { } PainterStartup/com/javera/ui/GuiListDataListener.javaPainterSt artup/com/javera/ui/GuiListDataListener.java// Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights re served world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui; import javax.swing.event.ListDataListener; /** * @author dtsmith
  • 83. */ publicinterfaceGuiListDataListenerextendsListDataListener{ } PainterStartup/com/javera/ui/IconManager.classpackage com.javera.ui; publicsynchronizedclass IconManager { static ClassLoader classLoader; static java.util.Hashtable iconTable; static void <clinit>(); public void IconManager(); publicstatic javax.swing.ImageIcon getIcon(String); publicstatic javax.swing.ImageIcon getImageIcon(String); } PainterStartup/com/javera/ui/IconManager.javaPainterStartup/c om/javera/ui/IconManager.java//Copyright 2004, (c) Javera Soft ware, LLC. as an unpublished work. All rights reserved world- wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import java.net.*; import java.util.Hashtable; import javax.swing.ImageIcon; /** * IconManager provides a convenience class to load icons. * * @author David T. Smith */
  • 84. publicclassIconManager{ staticClassLoader classLoader =IconManager.class.getClassLoa der(); staticHashtable iconTable =newHashtable(); publicstaticImageIcon getIcon(String iconName) { return getImageIcon("images/"+ iconName); } staticpublicImageIcon getImageIcon(String iconName) { ImageIcon icon =(ImageIcon) iconTable.get(iconName); if(icon ==null) { URL url = classLoader.getResource(iconName); if(url !=null) icon =newImageIcon(url); else icon =newImageIcon("x.gif"); iconTable.put(iconName, icon); } return icon; } } PainterStartup/com/javera/ui/JavaObjectTransferable.classpacka ge com.javera.ui; publicsynchronizedclass JavaObjectTransferable implements java.awt.datatransfer.Transferable, java.io.Serializable { privatetransient Object javaObject;
  • 85. private java.util.ArrayList dataFlavors; public void JavaObjectTransferable(Object); public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors(); public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor); public boolean addDataFlavor(java.awt.datatransfer.DataFlavor); public Object getTransferData(java.awt.datatransfer.DataFlavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException; } PainterStartup/com/javera/ui/JavaObjectTransferable.javaPainte rStartup/com/javera/ui/JavaObjectTransferable.java// Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All ri ghts reserved world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; /** * @author dtsmith */ publicclassJavaObjectTransferableimplementsTransferable,Seria lizable{
  • 86. privatetransientObject javaObject; privateArrayList dataFlavors =newArrayList(); publicJavaObjectTransferable(Object javaObject){ this.javaObject = javaObject; } publicDataFlavor[] getTransferDataFlavors(){ return(DataFlavor[]) dataFlavors.toArray(newDataFlavor[dataFl avors.size()]); } publicboolean isDataFlavorSupported(DataFlavor flavor){ return dataFlavors.contains(flavor); } publicboolean addDataFlavor(DataFlavor flavor){ return dataFlavors.add(flavor); } publicObject getTransferData(DataFlavor flavor)throwsUnsuppo rtedFlavorException,IOException{ if(isDataFlavorSupported(flavor)){ return javaObject; }else{ returnnull; } } } PainterStartup/com/javera/ui/layout/JvBoxLayout$Filler.classpa ckage com.javera.ui.layout; publicsynchronizedclass JvBoxLayout$Filler extends java.awt.Component implements javax.accessibility.Accessible {
  • 87. private java.awt.Dimension dim; public void JvBoxLayout$Filler(int, int); public java.awt.Dimension getMinimumSize(); public java.awt.Dimension getPreferredSize(); public java.awt.Dimension getMaximumSize(); } PainterStartup/com/javera/ui/layout/JvBoxLayout.classpackage com.javera.ui.layout; publicsynchronizedclass JvBoxLayout implements java.awt.LayoutManager2, com.javera.ui.LayoutPrintLayout, java.io.Serializable { publicstaticfinal int X_AXIS = 0; publicstaticfinal int Y_AXIS = 1; private int axis; private int gap; private int topMargin; private int bottomMargin; private int leftMargin; private int rightMargin; private java.util.Map weightMap; public void JvBoxLayout(int); public void JvBoxLayout(int, int, int, int, int, int); public int getGap(); public void setGap(int); public int getTopMargin(); public void setTopMargin(int); public int getLeftMargin(); public void setLeftMargin(int); public int getBottomMargin(); public void setBottomMargin(int); public int getRightMargin(); public void setRightMargin(int); public void addLayoutComponent(java.awt.Component, Object);
  • 88. public java.awt.Dimension maximumLayoutSize(java.awt.Container); public float getLayoutAlignmentX(java.awt.Container); public float getLayoutAlignmentY(java.awt.Container); public void invalidateLayout(java.awt.Container); public void addLayoutComponent(String, java.awt.Component); public void removeLayoutComponent(java.awt.Component); public java.awt.Dimension minimumLayoutSize(java.awt.Container); public java.awt.Dimension preferredLayoutSize(java.awt.Container); public void layoutContainer(java.awt.Container); publicstatic java.awt.Component createFiller(int, int); public int layoutPrint(java.awt.Container, int); } PainterStartup/com/javera/ui/layout/JvBoxLayout.javaPainterSt artup/com/javera/ui/layout/JvBoxLayout.java//Copyright 2004, ( c) Javera Software, LLC. as an unpublished work. All rights res erved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.layout; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager2; import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.Map;
  • 89. import javax.accessibility.Accessible; import com.javera.ui.LayoutPrintLayout; import com.javera.ui.LayoutPrint; //import com.javera.ui.panel.JvPanel; /** * A Javera box layout arranges components in a vertical or hori zontal format. * For vertical format all components are resized to have the sa me width of * the container, but have a height that is in proportion to their a ssigned * weights and such that the total height of all compoenents fills the height * of the container. Likewise a horizontal format will resize co mponents to * have the same width as the container and a height that is in pr oportion to * the assigned weights. If a component has an assigned weight of 0 then that * components is sized according to its preferred size. * * Weights are assigned using a Double as the second argument to the * containers add method. A null second argument will be inter preted as a * zero weight assignement. * * A Javera box layout is similar in function to a Box layout exc ept that the * assigned weights, not glue or preferred sizes are used to distr ibute space * over the row or column. Javera box layout also provides gap * separation and margins.
  • 90. * * @author David T. Smith */ publicclassJvBoxLayoutimplementsLayoutManager2,LayoutPrin tLayout,Serializable{ /** * Horizontal axis orientation */ publicfinalstaticint X_AXIS =0; /** * Vertical axis orientation */ publicfinalstaticint Y_AXIS =1; /** * The axis orientation of the weighted layout. */ privateint axis; /** * The weighted layout manager allows a seperation of compo nents with * gaps. The gap will specify the space between components. * * @serial * @see getGap * @see setGap */ privateint gap; /** * The weighted layout manager allows specification of a top margin to be * reserved above laidout components.
  • 91. * * @serial * @see getTopMargin * @see setTopMargin */ privateint topMargin; /** * The command button layout manager allows specification of a bottom * margin to be reserved below laidout components. * * @serial * @see getBottomMargin * @see setBottomMargin */ privateint bottomMargin; /** * The weighted layout manager allows specification of a left margin to be * reserved to the left of the leftmost component. * * @serial * @see getLeftMargin * @see setLeftMargin */ privateint leftMargin; /** * The weighted layout manager allows specification of a rig ht margin to * be reserved to the right of the rightmost component. * * @serial * @see getRightMargin
  • 92. * @see setRightMargin */ privateint rightMargin; /** * A Map of each component's weight, keyed on the compone nt * objects themselves. */ privateMap weightMap =newHashMap(); /** * Constructs a new Weighted Layout with specified axis, a d efault 5 pixel * gap, and a 5 pixel margins. * * @param axis X_AXIS or Y_AXIS */ publicJvBoxLayout(int axis){ this(axis,5,5,5,5,5); } /** * Constructs a new Weighted Layout with specified axis, gap , and margins. * * @param axis X_AXIS or Y_AXIS * @param gap the gap between components. * @param topMargin the top margin. * @param leftMargin the left margin. * @param bottomMargin the bottom margin. * @param rightMargin the right margin. */ publicJvBoxLayout( int axis, int gap,
  • 93. int topMargin, int leftMargin, int bottomMargin, int rightMargin){ this.axis = axis; this.gap = gap; this.topMargin = topMargin; this.leftMargin = leftMargin; this.bottomMargin = bottomMargin; this.rightMargin = rightMargin; } /** * Gets the gap between components. * * @return the gap between components. */ publicint getGap(){ return gap; } /** * Sets the gap between components. * * @param gap the gap between components */ publicvoid setGap(int gap){ this.gap = gap; } /** * Gets the top margin to be reserved above all components. * * @return the top margin. */ publicint getTopMargin(){
  • 94. return topMargin; } /** * Sets the top margin to be reserve above components. * * @param topMargin the top margin. */ publicvoid setTopMargin(int topMargin){ this.topMargin = topMargin; } /** * Gets the left margin to be reserved to the left of the * leftmost component. * * @return the left margin. */ publicint getLeftMargin(){ return leftMargin; } /** * Sets the left margin to be reserved to the left of the * leftmost component. * * @param leftMargin the left margin. */ publicvoid setLeftMargin(int leftMargin){ this.leftMargin = leftMargin; } /** * Gets the bottom margin to be reserved below all componen ts. *
  • 95. * @return the bottom margin. */ publicint getBottomMargin(){ return bottomMargin; 18.2 problemTrue Flight Golf manufacturers a popular shaft for golf clubs. Its trade secret is a unique process for weaving high-tension wire into the center of the shaft such that energy is accumulated during the swing and released at impact. A specialized machine costing $3,000,000 is utilized in the manufacturing process. The machine has a 3-year life and no salvage value. True Flight uses straight-line depreciation. During the year, 25,000 shafts were produced, and the company was operating at full capacity. $700,000 of wire was used during the year.(a)Is machinery depreciation fixed or variable? Is wire fixed or variable?(b)For the two noted cost items, how much was total variable cost and total fixed cost?(c)For the two noted cost items, how much was variable cost per unit and how much was fixed cost per unit?(d)Repeat requirements (b) and (c), assuming production was only 20,000 units (and wire usage was reduced proportionately).(e)For the following year, if the company acquired an additional machine to enable production of 40,000 total units, what would happen to the expected total and per unit variable and fixed cost?(f)If the company experiences significant growth, and finds it necessary to continue to add additional machines, how would the machine cost be characterized (hint: fixed, variable, or something else)? In theory, at what production level(s) would per unit cost be minimized? &L&"Arial,Bold"&20 &R&"Myriad Web Pro,Bold"&20B-18.02 B-18.02 Worksheet(a)(b)(c)(d)(e)(f) &L&"Myriad Web Pro,Bold"&12Name: Date: Section: &R&"Myriad Web
  • 96. Pro,Bold"&20B-18.02 B-18.02 19.2 ProblemMary Ann Clark is an artist and is employed by Fenway Racing. Fenway Racing manufactures custom race cars to exact specifications of drivers. Mary Ann's job is to hand paint logos and other custom artwork on each car. Below is her daily time sheet for March 7, 20X6:FENWAY RACINGEmployee:Mary Ann ClarkDaily Time SheetDate:03/07/X6Start TimeStop TimeJob NumberTaskClientAdmin HoursDirect Labor Hours8:008:30set upPrepare paints and airbrushn/a0.500.008:3010:45#11245Paint race numbersMario A.0.002.2510:4511:00repairsRepair broken compressorn/a0.250.0011:0012:00#11302Paint advertising sign on doorAJF0.000.7512:001:00lunchn/an/a0.000.001:004:30#11305 Paint hood logoJeff G.0.003.504:305:00clean upClean up equipmentn/a0.500.00Total hours1.256.50(a)Examine the time sheet and find the error. What is the importance of correctly accumulating time by job? How does the time sheet data track to the cost assignment process?(b)How much of Mary Ann's time (after making the correction) is attributable to direct labor and how much to overhead? How is the direct labor cost assigned to individual jobs, and how is the overhead cost allocated? &R&"Myriad Web Pro,Bold"&20B-19.02 B-19.02 Worksheet (2)(a)(b) &L&"Myriad Web Pro,Bold"&12Name: Date: Section: &R&"Myriad Web Pro,Bold"&20B-19.02 B-19.02 20.2 ProblemZeus Corporation produces cultured diamonds via a secretive process that grows the diamonds in a vacuum
  • 97. chamber filled with a carbon gas cloud. The diamonds are produced in a single continuous process, and Zeus uses the weighted-average process costing method of accounting for production. The production process requires constant utilization of facilities and equipment, as well as direct labor by skilled technicians. As a result, direct labor and factory overhead are both deemed to be introduced uniformly throughout production.At the beginning of June, 20X9, 4,000 diamonds were in process. During June, an additional 8,000 diamonds were started, and 7,000 diamonds were completed and transferred to finished goods.As of the beginning of the month, work in process was 80% complete with respect to materials and 60% complete with respect to conversion costs.As of the end of the month, work in process was 70% complete with respect to materials and 40% complete with respect to conversion costs.Prepare a "unit reconciliation" schedule that includes calculations showing the equivalent units of materials, direct labor, and factory overhead for June. &L&"Arial,Bold"&20 &R&"Myriad Web Pro,Bold"&20B-20.02 B-20.02 Worksheet (3)Unit Reconciliation:Quantity ScheduleBeginning Work in ProcessStarted into ProductionTotal Units into ProductionEquivalent Units Calculations:ConversionDirect MaterialsDirect LaborFactory OverheadTo Finished GoodsEnding Work in ProcessTotal Units ReconciledEnding WIP Completion Status: Materials = % Conversion = % &L&"Myriad Web Pro,Bold"&12Name: Date: Section: &R&"Myriad Web Pro,Bold"&20B-20.02 B-20.02
  • 98. 21.2 ProblemLogan Township acquired its water system from a private company on June 1. No receivables were acquired with the purchase. Therefore, total accounts receivable on June 1 had a zero balance. Logan plans to bill customers in the month following the month of sale, and 70% of the resulting billings will be collected during the billing month. In the next following month, 90% of the remaining balance should be collectable. The remaining uncollectible amounts will relate to citizens who have moved away. Such amounts are never expected to be collected and will be written off. Water sales during June are estimated at $3,000,000, and expected to increase 30% in July. August sales will be 10% less than July sales.(a)For each dollar of sales, how much is expected to be collected?(b)Estimate the monthly cash collections for June, July, August, and September.(c)As of the end of August, how much will be the estimated amount of receivables from which future cash flows are anticipated? &L&"Arial,Bold"&12 &R&"Myriad Web Pro,Bold"&20B-21.02 B-21.02 Worksheet (4)(a)(b)JuneJulyAugustSeptember(c)JuneJulyAugustTotal Receivables &L&"Myriad Web Pro,Bold"&12Name: Date: Section: &R&"Myriad Web Pro,Bold"&20B-21.02 B-21.02