Back to index

moin  1.9.0~rc2
Public Member Functions | Protected Member Functions | Protected Attributes | Package Functions
CH.ifa.draw.standard.PasteCommand Class Reference

Command to insert the clipboard into the drawing. More...

Inheritance diagram for CH.ifa.draw.standard.PasteCommand:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.standard.PasteCommand:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PasteCommand (String name, DrawingView view)
 Constructs a paste command.
void execute ()
 Executes the command.
boolean isExecutable ()
 Tests if the command can be executed.
String name ()
 Gets the command name.

Protected Member Functions

void deleteSelection ()
 Deletes the selection from the drawing.
void copySelection ()
 Copies the selection to the clipboard.
void insertFigures (Vector figures, int dx, int dy)
 Inserts a vector of figures and translates them by the given offset.

Protected Attributes

DrawingView fView

Package Functions

Rectangle bounds (Enumeration k)

Detailed Description

Command to insert the clipboard into the drawing.

See also:
Clipboard

Definition at line 17 of file PasteCommand.java.


Constructor & Destructor Documentation

CH.ifa.draw.standard.PasteCommand.PasteCommand ( String  name,
DrawingView  view 
) [inline]

Constructs a paste command.

Parameters:
namethe command name
imagethe pathname of the image
viewthe target view

Definition at line 25 of file PasteCommand.java.

                                                       {
        super(name, view);
    }

Member Function Documentation

Rectangle CH.ifa.draw.standard.PasteCommand.bounds ( Enumeration  k) [inline, package]

Definition at line 45 of file PasteCommand.java.

                                    {
        Rectangle r = ((Figure) k.nextElement()).displayBox();
        while (k.hasMoreElements())
            r.add(((Figure) k.nextElement()).displayBox());
        return r;
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.FigureTransferCommand.copySelection ( ) [inline, protected, inherited]

Copies the selection to the clipboard.

Definition at line 41 of file FigureTransferCommand.java.

                                   {
        FigureSelection selection = fView.getFigureSelection();
        Clipboard.getClipboard().setContents(selection);
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.FigureTransferCommand.deleteSelection ( ) [inline, protected, inherited]

Deletes the selection from the drawing.

Definition at line 33 of file FigureTransferCommand.java.

                                     {
       fView.drawing().removeAll(fView.selection());
       fView.clearSelection();
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.PasteCommand.execute ( ) [inline, virtual]

Executes the command.

Implements CH.ifa.draw.util.Command.

Definition at line 29 of file PasteCommand.java.

                          {
        Point lastClick = fView.lastClick();
        FigureSelection selection = (FigureSelection)Clipboard.getClipboard().getContents();
        if (selection != null) {
            Vector figures = (Vector)selection.getData(FigureSelection.TYPE);
            if (figures.size() == 0)
                return;

            Rectangle r = bounds(figures.elements());
            fView.clearSelection();

            insertFigures(figures, lastClick.x-r.x, lastClick.y-r.y);
            fView.checkDamage();
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.FigureTransferCommand.insertFigures ( Vector  figures,
int  dx,
int  dy 
) [inline, protected, inherited]

Inserts a vector of figures and translates them by the given offset.

Definition at line 50 of file FigureTransferCommand.java.

                                                                 {
        FigureEnumeration e = new FigureEnumerator(figures);
        while (e.hasMoreElements()) {
            Figure figure = e.nextFigure();
            figure = fView.add(figure);
            fView.addToSelection(figure);
        }
        fView.moveSelection(dx,dy);
    }

Here is the caller graph for this function:

boolean CH.ifa.draw.util.Command.isExecutable ( ) [inline, inherited]
String CH.ifa.draw.util.Command.name ( ) [inline, inherited]

Gets the command name.

Definition at line 53 of file Command.java.

                         {
        return fName;
    }

Here is the caller graph for this function:


Member Data Documentation

DrawingView CH.ifa.draw.standard.FigureTransferCommand.fView [protected, inherited]

Definition at line 18 of file FigureTransferCommand.java.


The documentation for this class was generated from the following file: