org.diylc.common
Interface IPlugInPort

All Superinterfaces:
IKeyProcessor, IMouseProcessor, ISelectionProcessor, ITemplateProcessor
All Known Implementing Classes:
Presenter

public interface IPlugInPort
extends ISelectionProcessor, IMouseProcessor, IKeyProcessor, ITemplateProcessor

Interface for communication between plug-ins and the application. Plug-ins may acquire information or make changes through this interface. Application events are dispatched to plug-ins through MessageDispatcher

Author:
Branislav Stojkovic
See Also:
IPlugIn, MessageDispatcher, IMessageListener, EventType

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.diylc.common.ITemplateProcessor
ITemplateProcessor.TemplateAlreadyExistsException
 
Field Summary
static java.lang.String ABNORMAL_EXIT_KEY
           
static java.lang.String ANTI_ALIASING_KEY
           
static java.lang.String AUTO_EDIT_KEY
           
static int BUTTON1
           
static int BUTTON2
           
static int BUTTON3
           
static java.lang.String CONTINUOUS_CREATION_KEY
           
static int DND_TOGGLE_SNAP
           
static int DND_TOGGLE_STICKY
           
static java.lang.String EXPORT_GRID_KEY
           
static java.lang.String HI_QUALITY_RENDER_KEY
           
static java.lang.String METRIC_KEY
           
static int NOBUTTON
          Mouse button constants.
static java.lang.String OUTLINE_KEY
           
static java.lang.String RECENT_COMPONENTS_KEY
           
static java.lang.String SNAP_TO_GRID_KEY
           
static java.lang.String STICKY_POINTS_KEY
           
static java.lang.String THEME_KEY
           
static java.lang.String WHEEL_ZOOM_KEY
           
 
Fields inherited from interface org.diylc.common.IKeyProcessor
VK_DOWN, VK_LEFT, VK_RIGHT, VK_UP
 
Fields inherited from interface org.diylc.common.ITemplateProcessor
TEMPLATES_KEY
 
Method Summary
 boolean allowFileAction()
          Shows a user dialog if there are changes to confirm that it's safe to proceed.
 void applyPropertiesToProject(java.util.List<PropertyWrapper> properties)
          Applies specified properties to the current project.
 void bringSelectionToFront()
          Brings each of the selected components one step to front.
 java.awt.geom.Point2D calculateSelectionDimension()
           
 void createNewProject()
          Creates a new project.
 void deleteSelectedComponents()
          Deletes all the selected components from the project.
 void draw(java.awt.Graphics2D g2d, java.util.Set<DrawOption> drawOptions, IComponentFiler filter)
          Draws project on the provided Graphics2D.
 void editSelection()
           
 java.lang.Double[] getAvailableZoomLevels()
           
 java.awt.Dimension getCanvasDimensions(boolean useZoom)
          Returns size of the canvas that takes project dimensions into account as well as zoom level.
 java.util.Map<java.lang.String,java.util.List<ComponentType>> getComponentTypes()
          Returns all available ComponentTypes classified by category.
 java.lang.String getCurrentFileName()
           
 Project getCurrentProject()
          Returns an instance of currently loaded project.
 org.diylc.appframework.update.VersionNumber getCurrentVersionNumber()
          Returns current version number.
 java.awt.Cursor getCursorAt(java.awt.Point point)
          Returns an instance of Cursor that should be used at the specified location.
 java.util.List<PropertyWrapper> getMutualSelectionProperties()
           
 ComponentType getNewComponentTypeSlot()
          Gets the current new component slot.
 java.util.List<PropertyWrapper> getProjectProperties()
           
 Theme getSelectedTheme()
           
 double getZoomLevel()
          Returns current zoom level where zoomLevel = 1.0d means 100%.
 void groupSelectedComponents()
          Groups all selected components.
 boolean isProjectModified()
           
 void loadProject(Project project, boolean freshStart)
          Loads specified Project.
 void loadProjectFromFile(java.lang.String fileName)
          Loads a project from the specified file.
 void pasteComponents(java.util.List<IDIYComponent<?>> components)
          Adds a list of components to the project.
 void refresh()
          Causes the display to refresh.
 void renumberSelectedComponents(boolean xAxisFirst)
          Renumbers all the selected components.
 void saveProjectToFile(java.lang.String fileName, boolean isBackup)
          Saves the current project into the specified file.
 void sendSelectionToBack()
          Sends each of the selected components one step back.
 void setLayerLocked(int layerZOrder, boolean locked)
          Locks or unlocks the specified layer.
 void setMetric(boolean isMetric)
          Changes default size notation, true for metric, false for imperial.
 void setNewComponentTypeSlot(ComponentType componentType, Template template)
          Sets the new component slot.
 void setProjectDefaultPropertyValue(java.lang.String propertyName, java.lang.Object value)
          Sets default value for the specified property name for projects.
 void setSelectedTheme(Theme theme)
          Changes the current theme.
 void setSelectionDefaultPropertyValue(java.lang.String propertyName, java.lang.Object value)
          Sets default value for the specified property name for currently selected component types.
 void setZoomLevel(double zoomLevel)
          Changes current zoom level where zoomLevel = 1.0d means 100%
 void ungroupSelectedComponents()
          Ungroups all selected components.
 
Methods inherited from interface org.diylc.common.ISelectionProcessor
expandSelection, findComponentsAt, getSelectedComponents, rotateSelection, selectAll, updateSelection
 
Methods inherited from interface org.diylc.common.IMouseProcessor
dragActionChanged, dragEnded, dragOver, dragStarted, mouseClicked, mouseMoved
 
Methods inherited from interface org.diylc.common.IKeyProcessor
keyPressed
 
Methods inherited from interface org.diylc.common.ITemplateProcessor
applyTemplateToSelection, deleteTemplate, getTemplatesFor, getTemplatesForSelection, saveSelectedComponentAsTemplate
 

Field Detail

ANTI_ALIASING_KEY

static final java.lang.String ANTI_ALIASING_KEY
See Also:
Constant Field Values

HI_QUALITY_RENDER_KEY

static final java.lang.String HI_QUALITY_RENDER_KEY
See Also:
Constant Field Values

EXPORT_GRID_KEY

static final java.lang.String EXPORT_GRID_KEY
See Also:
Constant Field Values

STICKY_POINTS_KEY

static final java.lang.String STICKY_POINTS_KEY
See Also:
Constant Field Values

METRIC_KEY

static final java.lang.String METRIC_KEY
See Also:
Constant Field Values

SNAP_TO_GRID_KEY

static final java.lang.String SNAP_TO_GRID_KEY
See Also:
Constant Field Values

CONTINUOUS_CREATION_KEY

static final java.lang.String CONTINUOUS_CREATION_KEY
See Also:
Constant Field Values

AUTO_EDIT_KEY

static final java.lang.String AUTO_EDIT_KEY
See Also:
Constant Field Values

ABNORMAL_EXIT_KEY

static final java.lang.String ABNORMAL_EXIT_KEY
See Also:
Constant Field Values

WHEEL_ZOOM_KEY

static final java.lang.String WHEEL_ZOOM_KEY
See Also:
Constant Field Values

OUTLINE_KEY

static final java.lang.String OUTLINE_KEY
See Also:
Constant Field Values

THEME_KEY

static final java.lang.String THEME_KEY
See Also:
Constant Field Values

RECENT_COMPONENTS_KEY

static final java.lang.String RECENT_COMPONENTS_KEY
See Also:
Constant Field Values

DND_TOGGLE_STICKY

static final int DND_TOGGLE_STICKY
See Also:
Constant Field Values

DND_TOGGLE_SNAP

static final int DND_TOGGLE_SNAP
See Also:
Constant Field Values

NOBUTTON

static final int NOBUTTON
Mouse button constants.

See Also:
Constant Field Values

BUTTON1

static final int BUTTON1
See Also:
Constant Field Values

BUTTON2

static final int BUTTON2
See Also:
Constant Field Values

BUTTON3

static final int BUTTON3
See Also:
Constant Field Values
Method Detail

getCanvasDimensions

java.awt.Dimension getCanvasDimensions(boolean useZoom)
Returns size of the canvas that takes project dimensions into account as well as zoom level. Each dimension is calculated as the product of the actual size and the number of pixels per unit. If useZoom is set to true, the result is scaled by zoom factor.

Parameters:
useZoom -
Returns:
canvas dimensions

getCursorAt

java.awt.Cursor getCursorAt(java.awt.Point point)
Returns an instance of Cursor that should be used at the specified location. Note: point coordinates are scaled for zoom factor.

Parameters:
point -
Returns:
cursor

getCurrentProject

Project getCurrentProject()
Returns an instance of currently loaded project.

Returns:

loadProject

void loadProject(Project project,
                 boolean freshStart)
Loads specified Project.

Parameters:
project -
freshStart -

createNewProject

void createNewProject()
Creates a new project.


loadProjectFromFile

void loadProjectFromFile(java.lang.String fileName)
Loads a project from the specified file.

Parameters:
fileName -

saveProjectToFile

void saveProjectToFile(java.lang.String fileName,
                       boolean isBackup)
Saves the current project into the specified file.

Parameters:
fileName -
isBackup -

getCurrentFileName

java.lang.String getCurrentFileName()
Returns:
the current file name.

isProjectModified

boolean isProjectModified()
Returns:
true if the current project is modified.

allowFileAction

boolean allowFileAction()
Shows a user dialog if there are changes to confirm that it's safe to proceed.

Returns:
true, if file actions (new, open, close) can be taken

getComponentTypes

java.util.Map<java.lang.String,java.util.List<ComponentType>> getComponentTypes()
Returns all available ComponentTypes classified by category. Result is a Map between category name to a List of all ComponentTypes that share that category name.

Returns:

draw

void draw(java.awt.Graphics2D g2d,
          java.util.Set<DrawOption> drawOptions,
          IComponentFiler filter)
Draws project on the provided Graphics2D. If the provided filter is not null, it will be used to filter the components that are shown.

Parameters:
g2d -
drawOptions - specific drawing options
filter -

getAvailableZoomLevels

java.lang.Double[] getAvailableZoomLevels()

getZoomLevel

double getZoomLevel()
Returns current zoom level where zoomLevel = 1.0d means 100%.

Returns:
current zoom level

setZoomLevel

void setZoomLevel(double zoomLevel)
Changes current zoom level where zoomLevel = 1.0d means 100%

Parameters:
zoomLevel - new zoom leve

getCurrentVersionNumber

org.diylc.appframework.update.VersionNumber getCurrentVersionNumber()
Returns current version number.

Returns:

pasteComponents

void pasteComponents(java.util.List<IDIYComponent<?>> components)
Adds a list of components to the project.

Parameters:
components -

deleteSelectedComponents

void deleteSelectedComponents()
Deletes all the selected components from the project.


setSelectionDefaultPropertyValue

void setSelectionDefaultPropertyValue(java.lang.String propertyName,
                                      java.lang.Object value)
Sets default value for the specified property name for currently selected component types.

Parameters:
propertyName - display name for property
value - new default value, must not be null

setProjectDefaultPropertyValue

void setProjectDefaultPropertyValue(java.lang.String propertyName,
                                    java.lang.Object value)
Sets default value for the specified property name for projects.

Parameters:
propertyName - display name for property
value - new default value, must not be null

getMutualSelectionProperties

java.util.List<PropertyWrapper> getMutualSelectionProperties()
Returns:
a list of properties that are mutual for all the selected components. Resulting list may be empty if selected components do not have mutual properties or can be null if the selection is empty.

editSelection

void editSelection()

getProjectProperties

java.util.List<PropertyWrapper> getProjectProperties()
Returns:
a list of editable properties of the current project.

applyPropertiesToProject

void applyPropertiesToProject(java.util.List<PropertyWrapper> properties)
Applies specified properties to the current project.

Parameters:
properties -

getNewComponentTypeSlot

ComponentType getNewComponentTypeSlot()
Gets the current new component slot.


setNewComponentTypeSlot

void setNewComponentTypeSlot(ComponentType componentType,
                             Template template)
Sets the new component slot. Specified component type will be used to instantiate new component.

Parameters:
componentType -
template -

setMetric

void setMetric(boolean isMetric)
Changes default size notation, true for metric, false for imperial.

Parameters:
isMetric -

groupSelectedComponents

void groupSelectedComponents()
Groups all selected components.


ungroupSelectedComponents

void ungroupSelectedComponents()
Ungroups all selected components.


setLayerLocked

void setLayerLocked(int layerZOrder,
                    boolean locked)
Locks or unlocks the specified layer. All components within +- 0.5 range will be affected by the change as well.

Parameters:
layerZOrder -
locked -

calculateSelectionDimension

java.awt.geom.Point2D calculateSelectionDimension()
Returns:
selection size expressed in either inches or centimeters, based on the user preference.

sendSelectionToBack

void sendSelectionToBack()
Sends each of the selected components one step back.


bringSelectionToFront

void bringSelectionToFront()
Brings each of the selected components one step to front.


refresh

void refresh()
Causes the display to refresh.


getSelectedTheme

Theme getSelectedTheme()
Returns:
currently selected theme.

setSelectedTheme

void setSelectedTheme(Theme theme)
Changes the current theme.

Parameters:
theme -

renumberSelectedComponents

void renumberSelectedComponents(boolean xAxisFirst)
Renumbers all the selected components.

Parameters:
xAxisFirst -