|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.diylc.presenter.Presenter
public class Presenter
The main presenter class, contains core app logic and drawing routines.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.diylc.common.ITemplateProcessor |
|---|
ITemplateProcessor.TemplateAlreadyExistsException |
| Field Summary | |
|---|---|
static org.diylc.appframework.update.VersionNumber |
CURRENT_VERSION
|
static java.lang.String |
DEFAULTS_KEY_PREFIX
|
static java.util.List<IDIYComponent<?>> |
EMPTY_SELECTION
|
static int |
ICON_SIZE
|
| Fields inherited from interface org.diylc.common.IPlugInPort |
|---|
ABNORMAL_EXIT_KEY, ANTI_ALIASING_KEY, AUTO_EDIT_KEY, BUTTON1, BUTTON2, BUTTON3, CONTINUOUS_CREATION_KEY, DND_TOGGLE_SNAP, DND_TOGGLE_STICKY, EXPORT_GRID_KEY, HI_QUALITY_RENDER_KEY, METRIC_KEY, NOBUTTON, OUTLINE_KEY, RECENT_COMPONENTS_KEY, SNAP_TO_GRID_KEY, STICKY_POINTS_KEY, THEME_KEY, 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 |
| Constructor Summary | |
|---|---|
Presenter(IView view)
|
|
| 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 |
applyTemplateToSelection(Template template)
|
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 |
deleteTemplate(java.lang.String categoryName,
java.lang.String componentTypeName,
java.lang.String templateName)
|
void |
dispose()
|
void |
dragActionChanged(int dragAction)
Changes the current drag action during the dragging. |
void |
dragEnded(java.awt.Point point)
Notification that drag has been ended in the specified point. |
boolean |
dragOver(java.awt.Point point)
Checks if it's possible to drop over the specified point. |
void |
dragStarted(java.awt.Point point,
int dragAction)
Notification that drag has been started from the specified point. |
void |
draw(java.awt.Graphics2D g2d,
java.util.Set<DrawOption> drawOptions,
IComponentFiler filter)
Draws project on the provided Graphics2D. |
void |
editSelection()
|
void |
expandSelection(ExpansionMode expansionMode)
Expands the current selection to include surrounding components. |
java.util.List<IDIYComponent<?>> |
findComponentsAt(java.awt.Point point)
Finds all components at the specified location, sorted by z-index from top to bottom. |
java.util.List<IDIYComponent<?>> |
findComponentsAtScaled(java.awt.Point point)
Finds all components whose areas include the specified Point. |
java.util.List<IAutoCreator> |
getAutoCreators()
|
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()
|
java.util.List<IDIYComponent<?>> |
getSelectedComponents()
Returns the current ComponentTransferable. |
Theme |
getSelectedTheme()
|
java.util.List<Template> |
getTemplatesFor(java.lang.String categoryName,
java.lang.String componentTypeName)
|
java.util.List<Template> |
getTemplatesForSelection()
|
double |
getZoomLevel()
Returns current zoom level where zoomLevel = 1.0d means 100%. |
void |
groupSelectedComponents()
Groups all selected components. |
void |
installPlugin(IPlugIn plugIn)
|
boolean |
isProjectModified()
|
boolean |
keyPressed(int key,
boolean ctrlDown,
boolean shiftDown,
boolean altDown)
Notifies the presenter that a key hes been pressed on the canvas. |
void |
loadProject(Project project,
boolean freshStart)
Loads specified Project. |
void |
loadProjectFromFile(java.lang.String fileName)
Loads a project from the specified file. |
void |
mouseClicked(java.awt.Point point,
int button,
boolean ctrlDown,
boolean shiftDown,
boolean altDown,
int clickCount)
Notifies the presenter that mouse is clicked. |
void |
mouseMoved(java.awt.Point point,
boolean ctrlDown,
boolean shiftDown,
boolean altDown)
Notifies the presenter that mouse is moved. |
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 |
rotateSelection(int direction)
Rotates selection for 90 degrees. |
void |
saveProjectToFile(java.lang.String fileName,
boolean isBackup)
Saves the current project into the specified file. |
void |
saveSelectedComponentAsTemplate(java.lang.String templateName)
|
void |
selectAll(int layer)
Selects all components in the project. |
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. |
void |
updateSelection(java.util.List<IDIYComponent<?>> newSelection)
Updates the selection with the specified list of component. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static org.diylc.appframework.update.VersionNumber CURRENT_VERSION
public static final java.lang.String DEFAULTS_KEY_PREFIX
public static final java.util.List<IDIYComponent<?>> EMPTY_SELECTION
public static final int ICON_SIZE
| Constructor Detail |
|---|
public Presenter(IView view)
| Method Detail |
|---|
public void installPlugin(IPlugIn plugIn)
public void dispose()
public java.lang.Double[] getAvailableZoomLevels()
getAvailableZoomLevels in interface IPlugInPortpublic double getZoomLevel()
IPlugInPortzoomLevel = 1.0d means 100%.
getZoomLevel in interface IPlugInPortpublic void setZoomLevel(double zoomLevel)
IPlugInPortzoomLevel = 1.0d means 100%
setZoomLevel in interface IPlugInPortzoomLevel - new zoom levepublic java.awt.Cursor getCursorAt(java.awt.Point point)
IPlugInPortCursor that should be used at the specified location.
Note: point coordinates are scaled for zoom factor.
getCursorAt in interface IPlugInPortpublic java.awt.Dimension getCanvasDimensions(boolean useZoom)
IPlugInPortuseZoom is set to true, the result is scaled by zoom factor.
getCanvasDimensions in interface IPlugInPortpublic Project getCurrentProject()
IPlugInPort
getCurrentProject in interface IPlugInPort
public void loadProject(Project project,
boolean freshStart)
IPlugInPortProject.
loadProject in interface IPlugInPortpublic void createNewProject()
IPlugInPort
createNewProject in interface IPlugInPortpublic void loadProjectFromFile(java.lang.String fileName)
IPlugInPort
loadProjectFromFile in interface IPlugInPortpublic boolean allowFileAction()
IPlugInPort
allowFileAction in interface IPlugInPort
public void saveProjectToFile(java.lang.String fileName,
boolean isBackup)
IPlugInPort
saveProjectToFile in interface IPlugInPortpublic java.lang.String getCurrentFileName()
getCurrentFileName in interface IPlugInPortpublic boolean isProjectModified()
isProjectModified in interface IPlugInPortpublic java.util.Map<java.lang.String,java.util.List<ComponentType>> getComponentTypes()
IPlugInPortComponentTypes classified by category. Result is a Map
between category name to a List of all ComponentTypes that share that category
name.
getComponentTypes in interface IPlugInPortpublic java.util.List<IAutoCreator> getAutoCreators()
public void draw(java.awt.Graphics2D g2d,
java.util.Set<DrawOption> drawOptions,
IComponentFiler filter)
IPlugInPortGraphics2D. If the provided filter is not null, it will
be used to filter the components that are shown.
draw in interface IPlugInPortdrawOptions - specific drawing optionspublic java.util.List<IDIYComponent<?>> findComponentsAtScaled(java.awt.Point point)
Point. Point is not
scaled by the zoom factor. Components that belong to locked layers are ignored.
public java.util.List<IDIYComponent<?>> findComponentsAt(java.awt.Point point)
ISelectionProcessor
findComponentsAt in interface ISelectionProcessor
public void mouseClicked(java.awt.Point point,
int button,
boolean ctrlDown,
boolean shiftDown,
boolean altDown,
int clickCount)
IMouseProcessor
mouseClicked in interface IMouseProcessor
public boolean keyPressed(int key,
boolean ctrlDown,
boolean shiftDown,
boolean altDown)
IKeyProcessor
keyPressed in interface IKeyProcessorpublic void editSelection()
editSelection in interface IPlugInPort
public void mouseMoved(java.awt.Point point,
boolean ctrlDown,
boolean shiftDown,
boolean altDown)
IMouseProcessor
mouseMoved in interface IMouseProcessorpublic java.util.List<IDIYComponent<?>> getSelectedComponents()
ISelectionProcessorComponentTransferable.
getSelectedComponents in interface ISelectionProcessorpublic void selectAll(int layer)
ISelectionProcessor
selectAll in interface ISelectionProcessorpublic org.diylc.appframework.update.VersionNumber getCurrentVersionNumber()
IPlugInPort
getCurrentVersionNumber in interface IPlugInPort
public void dragStarted(java.awt.Point point,
int dragAction)
IMouseProcessor
dragStarted in interface IMouseProcessorpublic void dragActionChanged(int dragAction)
IMouseProcessor
dragActionChanged in interface IMouseProcessorpublic boolean dragOver(java.awt.Point point)
IMouseProcessor
dragOver in interface IMouseProcessorpublic void rotateSelection(int direction)
ISelectionProcessor
rotateSelection in interface ISelectionProcessordirection - 1 for clockwise, -1 for counter-clockwisepublic void dragEnded(java.awt.Point point)
IMouseProcessor
dragEnded in interface IMouseProcessorpublic void pasteComponents(java.util.List<IDIYComponent<?>> components)
IPlugInPort
pasteComponents in interface IPlugInPortpublic void deleteSelectedComponents()
IPlugInPort
deleteSelectedComponents in interface IPlugInPort
public void setSelectionDefaultPropertyValue(java.lang.String propertyName,
java.lang.Object value)
IPlugInPort
setSelectionDefaultPropertyValue in interface IPlugInPortpropertyName - display name for propertyvalue - new default value, must not be null
public void setProjectDefaultPropertyValue(java.lang.String propertyName,
java.lang.Object value)
IPlugInPort
setProjectDefaultPropertyValue in interface IPlugInPortpropertyName - display name for propertyvalue - new default value, must not be nullpublic void setMetric(boolean isMetric)
IPlugInPort
setMetric in interface IPlugInPortpublic void groupSelectedComponents()
IPlugInPort
groupSelectedComponents in interface IPlugInPortpublic void ungroupSelectedComponents()
IPlugInPort
ungroupSelectedComponents in interface IPlugInPort
public void setLayerLocked(int layerZOrder,
boolean locked)
IPlugInPort
setLayerLocked in interface IPlugInPortpublic void sendSelectionToBack()
IPlugInPort
sendSelectionToBack in interface IPlugInPortpublic void bringSelectionToFront()
IPlugInPort
bringSelectionToFront in interface IPlugInPortpublic void refresh()
IPlugInPort
refresh in interface IPlugInPortpublic Theme getSelectedTheme()
getSelectedTheme in interface IPlugInPortpublic void setSelectedTheme(Theme theme)
IPlugInPort
setSelectedTheme in interface IPlugInPortpublic void renumberSelectedComponents(boolean xAxisFirst)
IPlugInPort
renumberSelectedComponents in interface IPlugInPortpublic void updateSelection(java.util.List<IDIYComponent<?>> newSelection)
ISelectionProcessor
updateSelection in interface ISelectionProcessorpublic void expandSelection(ExpansionMode expansionMode)
ISelectionProcessorexpansionMode flag.
expandSelection in interface ISelectionProcessorpublic java.awt.geom.Point2D calculateSelectionDimension()
calculateSelectionDimension in interface IPlugInPortpublic java.util.List<PropertyWrapper> getMutualSelectionProperties()
getMutualSelectionProperties in interface IPlugInPortpublic java.util.List<PropertyWrapper> getProjectProperties()
getProjectProperties in interface IPlugInPortpublic void applyPropertiesToProject(java.util.List<PropertyWrapper> properties)
IPlugInPort
applyPropertiesToProject in interface IPlugInPortpublic ComponentType getNewComponentTypeSlot()
IPlugInPort
getNewComponentTypeSlot in interface IPlugInPort
public void setNewComponentTypeSlot(ComponentType componentType,
Template template)
IPlugInPort
setNewComponentTypeSlot in interface IPlugInPortpublic void saveSelectedComponentAsTemplate(java.lang.String templateName)
saveSelectedComponentAsTemplate in interface ITemplateProcessor
public java.util.List<Template> getTemplatesFor(java.lang.String categoryName,
java.lang.String componentTypeName)
getTemplatesFor in interface ITemplateProcessorpublic java.util.List<Template> getTemplatesForSelection()
getTemplatesForSelection in interface ITemplateProcessorpublic void applyTemplateToSelection(Template template)
applyTemplateToSelection in interface ITemplateProcessor
public void deleteTemplate(java.lang.String categoryName,
java.lang.String componentTypeName,
java.lang.String templateName)
deleteTemplate in interface ITemplateProcessor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||