diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/BadPositionException.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/BadPositionException.java index 52dcfe95..42ea1a51 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/BadPositionException.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/BadPositionException.java @@ -2,6 +2,6 @@ package org.diylc.common; public class BadPositionException extends Exception { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ComponentType.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ComponentType.java index a20fd58c..6086f9ea 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ComponentType.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ComponentType.java @@ -15,100 +15,99 @@ import org.diylc.core.annotations.BomPolicy; */ public class ComponentType { - private String name; - private String description; - private CreationMethod creationMethod; - private String category; - private String namePrefix; - private String author; - private Icon icon; - private Class> instanceClass; - private double zOrder; - private boolean flexibleZOrder; - private boolean stretchable; - private BomPolicy bomPolicy; - private boolean autoEdit; - private boolean rotatable; + private String name; + private String description; + private CreationMethod creationMethod; + private String category; + private String namePrefix; + private String author; + private Icon icon; + private Class> instanceClass; + private double zOrder; + private boolean flexibleZOrder; + private boolean stretchable; + private BomPolicy bomPolicy; + private boolean autoEdit; + private boolean rotatable; - public ComponentType(String name, String description, CreationMethod creationMethod, - String category, String namePrefix, String author, Icon icon, - Class> instanceClass, double zOrder, boolean flexibleZOrder, - boolean stretchable, BomPolicy bomPolicy, boolean autoEdit, boolean rotatable) { - super(); - this.name = name; - this.description = description; - this.creationMethod = creationMethod; - this.category = category; - this.namePrefix = namePrefix; - this.author = author; - this.icon = icon; - this.instanceClass = instanceClass; - this.zOrder = zOrder; - this.flexibleZOrder = flexibleZOrder; - this.stretchable = stretchable; - this.bomPolicy = bomPolicy; - this.autoEdit = autoEdit; - this.rotatable = rotatable; - } + public ComponentType(String name, String description, CreationMethod creationMethod, String category, + String namePrefix, String author, Icon icon, Class> instanceClass, double zOrder, + boolean flexibleZOrder, boolean stretchable, BomPolicy bomPolicy, boolean autoEdit, boolean rotatable) { + super(); + this.name = name; + this.description = description; + this.creationMethod = creationMethod; + this.category = category; + this.namePrefix = namePrefix; + this.author = author; + this.icon = icon; + this.instanceClass = instanceClass; + this.zOrder = zOrder; + this.flexibleZOrder = flexibleZOrder; + this.stretchable = stretchable; + this.bomPolicy = bomPolicy; + this.autoEdit = autoEdit; + this.rotatable = rotatable; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public CreationMethod getCreationMethod() { - return creationMethod; - } + public CreationMethod getCreationMethod() { + return creationMethod; + } - public String getCategory() { - return category; - } + public String getCategory() { + return category; + } - public String getNamePrefix() { - return namePrefix; - } + public String getNamePrefix() { + return namePrefix; + } - public String getAuthor() { - return author; - } + public String getAuthor() { + return author; + } - public Icon getIcon() { - return icon; - } + public Icon getIcon() { + return icon; + } - public Class> getInstanceClass() { - return instanceClass; - } + public Class> getInstanceClass() { + return instanceClass; + } - public double getZOrder() { - return zOrder; - } - - public boolean isFlexibleZOrder() { - return flexibleZOrder; - } + public double getZOrder() { + return zOrder; + } - public boolean isStretchable() { - return stretchable; - } - - public BomPolicy getBomPolicy() { - return bomPolicy; - } - - public boolean isAutoEdit() { - return autoEdit; - } - - public boolean isRotatable() { - return rotatable; - } + public boolean isFlexibleZOrder() { + return flexibleZOrder; + } - @Override - public String toString() { - return name; - } + public boolean isStretchable() { + return stretchable; + } + + public BomPolicy getBomPolicy() { + return bomPolicy; + } + + public boolean isAutoEdit() { + return autoEdit; + } + + public boolean isRotatable() { + return rotatable; + } + + @Override + public String toString() { + return name; + } } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/Display.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/Display.java index ff1459d6..1f5d27ca 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/Display.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/Display.java @@ -2,10 +2,10 @@ package org.diylc.common; public enum Display { - NAME, VALUE, NONE, BOTH; + NAME, VALUE, NONE, BOTH; - @Override - public String toString() { - return name().substring(0, 1) + name().substring(1).toLowerCase(); - } + @Override + public String toString() { + return name().substring(0, 1) + name().substring(1).toLowerCase(); + } } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/DrawOption.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/DrawOption.java index b36ac993..48f41c78 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/DrawOption.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/DrawOption.java @@ -11,30 +11,29 @@ import java.awt.Graphics; */ public enum DrawOption { - /** - * Selection rectangle will be drawn when needed and selected components may - * be rendered differently. - */ - SELECTION, - /** - * Selected zoom level will be applied to scale the {@link Graphics} before - * drawing. - */ - ZOOM, - /** - * Grid lines are drawn. - */ - GRID, - /** - * Control points are drawn. - */ - CONTROL_POINTS, - /** - * Anti-aliasing is used when drawing. - */ - ANTIALIASING, - /** - * Draw components in outline mode. - */ - OUTLINE_MODE; + /** + * Selection rectangle will be drawn when needed and selected components may be rendered + * differently. + */ + SELECTION, + /** + * Selected zoom level will be applied to scale the {@link Graphics} before drawing. + */ + ZOOM, + /** + * Grid lines are drawn. + */ + GRID, + /** + * Control points are drawn. + */ + CONTROL_POINTS, + /** + * Anti-aliasing is used when drawing. + */ + ANTIALIASING, + /** + * Draw components in outline mode. + */ + OUTLINE_MODE; } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/EventType.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/EventType.java index fd1d8838..97ea9c62 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/EventType.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/EventType.java @@ -6,78 +6,74 @@ import java.awt.geom.Point2D; import org.diylc.core.Project; /** - * Enumerates all possible events between {@link IPlugInPort} and - * {@link IPlugIn}. Some events overlap so be careful which ones you subscribe - * for and how you process them. + * Enumerates all possible events between {@link IPlugInPort} and {@link IPlugIn}. Some events + * overlap so be careful which ones you subscribe for and how you process them. * * @author Branislav Stojkovic */ public enum EventType { - /** - * Called when zoom level changes. Typically only one parameter of type - * {@link Double} is passed with new zoom level. - */ - ZOOM_CHANGED, - /** - * Called when a new project is loaded. New {@link Project} is the first - * parameter. Boolean flag is the second parameter and it's true when new - * project is loaded, false when the same project has been either reloaded - * or loaded with undo/redo operations. - */ - PROJECT_LOADED, - /** - * Called when either current file name or modified flag are changed. The - * first parameter is the current file name, the second one is a boolean - * modified flag. - */ - FILE_STATUS_CHANGED, - /** - * Called when selection rectangle is changed. Object of type - * {@link Rectangle} is the only parameter and it contains the new selection - * rectangle. - */ - SELECTION_RECT_CHANGED, - /** - * Called when component selection is changed. New - * {@link ComponentSelection} is attached as a parameter. - */ - SELECTION_CHANGED, - /** - * Called when selection size changes, together with a {@link Point2D} - * object containing selection size (x = width, y = height). Size is - * expressed in the default measure (cm for metric, inches for imperial). - */ - REPAINT, - /** - * Called when new component slot has been changed. The only parameter is - * {@link ComponentType} and may be null. - */ - SLOT_CHANGED, - /** - * Called when the current project has been modified. Two instances of - * {@link Project} are passed as parameters, one before and one after the - * change. The third parameter is a string containing change description. - */ - PROJECT_MODIFIED, - /** - * Called when control points under the cursor are changed. A single - * parameter is passed, an instance of - * Map, Set> containing all the - * components and indices of their control points that are under the cursor. - */ - AVAILABLE_CTRL_POINTS_CHANGED, - /** - * Called when mouse cursor is moved. Point object is passed, containing the - * current cursor location (not taking zoom into account). - */ - MOUSE_MOVED, - /** - * Called when a layer status is changed. The first parameter is a set of indices of locked layers. All layers not included are considered unlocked. - */ - LAYER_STATE_CHANGED, - /** - * Called to update the status message. New status message is passed as a first parameter. - */ - STATUS_MESSAGE_CHANGED; + /** + * Called when zoom level changes. Typically only one parameter of type {@link Double} is passed + * with new zoom level. + */ + ZOOM_CHANGED, + /** + * Called when a new project is loaded. New {@link Project} is the first parameter. Boolean flag + * is the second parameter and it's true when new project is loaded, false when the same project + * has been either reloaded or loaded with undo/redo operations. + */ + PROJECT_LOADED, + /** + * Called when either current file name or modified flag are changed. The first parameter is the + * current file name, the second one is a boolean modified flag. + */ + FILE_STATUS_CHANGED, + /** + * Called when selection rectangle is changed. Object of type {@link Rectangle} is the only + * parameter and it contains the new selection rectangle. + */ + SELECTION_RECT_CHANGED, + /** + * Called when component selection is changed. New {@link ComponentSelection} is attached as a + * parameter. + */ + SELECTION_CHANGED, + /** + * Called when selection size changes, together with a {@link Point2D} object containing selection + * size (x = width, y = height). Size is expressed in the default measure (cm for metric, inches + * for imperial). + */ + REPAINT, + /** + * Called when new component slot has been changed. The only parameter is {@link ComponentType} + * and may be null. + */ + SLOT_CHANGED, + /** + * Called when the current project has been modified. Two instances of {@link Project} are passed + * as parameters, one before and one after the change. The third parameter is a string containing + * change description. + */ + PROJECT_MODIFIED, + /** + * Called when control points under the cursor are changed. A single parameter is passed, an + * instance of Map, Set> containing all the components and + * indices of their control points that are under the cursor. + */ + AVAILABLE_CTRL_POINTS_CHANGED, + /** + * Called when mouse cursor is moved. Point object is passed, containing the current cursor + * location (not taking zoom into account). + */ + MOUSE_MOVED, + /** + * Called when a layer status is changed. The first parameter is a set of indices of locked + * layers. All layers not included are considered unlocked. + */ + LAYER_STATE_CHANGED, + /** + * Called to update the status message. New status message is passed as a first parameter. + */ + STATUS_MESSAGE_CHANGED; } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/GridType.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/GridType.java index 5d960ce3..c1b2606e 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/GridType.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/GridType.java @@ -2,5 +2,5 @@ package org.diylc.common; public enum GridType { - LINES, CROSSHAIR, DOT, NONE; + LINES, CROSSHAIR, DOT, NONE; } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/HorizontalAlignment.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/HorizontalAlignment.java index e8ef10f4..1d3c0bbd 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/HorizontalAlignment.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/HorizontalAlignment.java @@ -1,9 +1,9 @@ package org.diylc.common; public enum HorizontalAlignment { - LEFT, CENTER, RIGHT; - - public String toString() { - return name().substring(0, 1) + name().substring(1).toLowerCase(); - } + LEFT, CENTER, RIGHT; + + public String toString() { + return name().substring(0, 1) + name().substring(1).toLowerCase(); + } } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IComponentFiler.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IComponentFiler.java index c1647cdb..71e204be 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IComponentFiler.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IComponentFiler.java @@ -4,5 +4,5 @@ import org.diylc.core.IDIYComponent; public interface IComponentFiler { - boolean testComponent(IDIYComponent component); + boolean testComponent(IDIYComponent component); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IKeyProcessor.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IKeyProcessor.java index 86cf6a5d..41a8686d 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IKeyProcessor.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IKeyProcessor.java @@ -2,21 +2,20 @@ package org.diylc.common; public interface IKeyProcessor { - public static final int VK_LEFT = 0x25; - public static final int VK_UP = 0x26; - public static final int VK_RIGHT = 0x27; - public static final int VK_DOWN = 0x28; + public static final int VK_LEFT = 0x25; + public static final int VK_UP = 0x26; + public static final int VK_RIGHT = 0x27; + public static final int VK_DOWN = 0x28; - /** - * Notifies the presenter that a key hes been pressed on the canvas. - * - * @param key - * @param ctrlDown - * @param shiftDown - * @param altDown - * - * @return true if the event should be consumed - */ - boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown, - boolean altDown); + /** + * Notifies the presenter that a key hes been pressed on the canvas. + * + * @param key + * @param ctrlDown + * @param shiftDown + * @param altDown + * + * @return true if the event should be consumed + */ + boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown, boolean altDown); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IMouseProcessor.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IMouseProcessor.java index 95963440..b567ca5f 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IMouseProcessor.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IMouseProcessor.java @@ -4,66 +4,65 @@ import java.awt.Point; public interface IMouseProcessor { - /** - * Notifies the presenter that mouse is clicked. - * - * Note: point coordinates are display based, i.e. scaled for zoom factor. - * - * @param point - * @param button - * @param ctrlDown - * @param shiftDown - * @param altDown - * @param clickCount - */ - void mouseClicked(Point point, int button, boolean ctrlDown, boolean shiftDown, boolean altDown, - int clickCount); + /** + * Notifies the presenter that mouse is clicked. + * + * Note: point coordinates are display based, i.e. scaled for zoom factor. + * + * @param point + * @param button + * @param ctrlDown + * @param shiftDown + * @param altDown + * @param clickCount + */ + void mouseClicked(Point point, int button, boolean ctrlDown, boolean shiftDown, boolean altDown, int clickCount); - /** - * Notifies the presenter that mouse is moved. - * - * Note: point coordinates are display based, i.e. scaled for zoom factor. - * - * @param point - * @param ctrlDown - * @param shiftDown - * @param altDown - */ - void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown); + /** + * Notifies the presenter that mouse is moved. + * + * Note: point coordinates are display based, i.e. scaled for zoom factor. + * + * @param point + * @param ctrlDown + * @param shiftDown + * @param altDown + */ + void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown); - /** - * Notification that drag has been started from the specified point. - * - * Note: point coordinates are scaled for zoom factor. - * - * @param point - * @param dragAction - */ - void dragStarted(Point point, int dragAction); + /** + * Notification that drag has been started from the specified point. + * + * Note: point coordinates are scaled for zoom factor. + * + * @param point + * @param dragAction + */ + void dragStarted(Point point, int dragAction); - /** - * Checks if it's possible to drop over the specified point. - * - * Note: point coordinates are scaled for zoom factor. - * - * @param point - * @return - */ - boolean dragOver(Point point); + /** + * Checks if it's possible to drop over the specified point. + * + * Note: point coordinates are scaled for zoom factor. + * + * @param point + * @return + */ + boolean dragOver(Point point); - /** - * Changes the current drag action during the dragging. - * - * @param dragAction - */ - void dragActionChanged(int dragAction); + /** + * Changes the current drag action during the dragging. + * + * @param dragAction + */ + void dragActionChanged(int dragAction); - /** - * Notification that drag has been ended in the specified point. - * - * Note: point coordinates are scaled for zoom factor. - * - * @param point - */ - void dragEnded(Point point); + /** + * Notification that drag has been ended in the specified point. + * + * Note: point coordinates are scaled for zoom factor. + * + * @param point + */ + void dragEnded(Point point); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugIn.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugIn.java index cbfee46a..a1535df0 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugIn.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugIn.java @@ -9,11 +9,11 @@ import org.diylc.appframework.simplemq.IMessageListener; */ public interface IPlugIn extends IMessageListener { - /** - * Method that connects the plug-in with {@link IPlugInPort}. Called by the - * application when plug-in is installed. - * - * @param plugInPort - */ - void connect(IPlugInPort plugInPort); + /** + * Method that connects the plug-in with {@link IPlugInPort}. Called by the application when + * plug-in is installed. + * + * @param plugInPort + */ + void connect(IPlugInPort plugInPort); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugInPort.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugInPort.java index 8624cbc7..f7ea4815 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugInPort.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/IPlugInPort.java @@ -18,9 +18,9 @@ import org.diylc.core.Template; import org.diylc.core.Theme; /** - * 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 {@link MessageDispatcher} + * 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 {@link MessageDispatcher} * * @author Branislav Stojkovic * @@ -31,290 +31,277 @@ import org.diylc.core.Theme; */ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyProcessor, ITemplateProcessor { - public static final String ANTI_ALIASING_KEY = "antiAliasing"; - public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender"; - public static final String EXPORT_GRID_KEY = "exportGrid"; - public static final String STICKY_POINTS_KEY = "stickyPoints"; - public static final String METRIC_KEY = "metric"; - public static final String SNAP_TO_GRID_KEY = "snapToGrid"; - public static final String AUTO_PADS_KEY = "autoCreatePads"; - public static final String CONTINUOUS_CREATION_KEY = "continuousCreation"; - public static final String AUTO_EDIT_KEY = "autoEdit"; - public static final String ABNORMAL_EXIT_KEY = "abnormalExit"; - public static final String WHEEL_ZOOM_KEY = "wheelZoom"; - public static final String OUTLINE_KEY = "outline"; - public static final String THEME_KEY = "theme"; - public static final String RECENT_COMPONENTS_KEY = "recentComponents"; + public static final String ANTI_ALIASING_KEY = "antiAliasing"; + public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender"; + public static final String EXPORT_GRID_KEY = "exportGrid"; + public static final String STICKY_POINTS_KEY = "stickyPoints"; + public static final String METRIC_KEY = "metric"; + public static final String SNAP_TO_GRID_KEY = "snapToGrid"; + public static final String AUTO_PADS_KEY = "autoCreatePads"; + public static final String CONTINUOUS_CREATION_KEY = "continuousCreation"; + public static final String AUTO_EDIT_KEY = "autoEdit"; + public static final String ABNORMAL_EXIT_KEY = "abnormalExit"; + public static final String WHEEL_ZOOM_KEY = "wheelZoom"; + public static final String OUTLINE_KEY = "outline"; + public static final String THEME_KEY = "theme"; + public static final String RECENT_COMPONENTS_KEY = "recentComponents"; - public static final int DND_TOGGLE_STICKY = 0x1; - public static final int DND_TOGGLE_SNAP = 0x40000000; - - /** - * Mouse button constants. - */ - public static final int NOBUTTON = 0; - public static final int BUTTON1 = 1; - public static final int BUTTON2 = 2; - public static final int BUTTON3 = 3; + public static final int DND_TOGGLE_STICKY = 0x1; + public static final int DND_TOGGLE_SNAP = 0x40000000; - /** - * 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. - * - * @param useZoom - * - * @return canvas dimensions - */ - Dimension getCanvasDimensions(boolean useZoom); + /** + * Mouse button constants. + */ + public static final int NOBUTTON = 0; + public static final int BUTTON1 = 1; + public static final int BUTTON2 = 2; + public static final int BUTTON3 = 3; - /** - * Returns an instance of {@link Cursor} that should be used at the - * specified location. - * - * Note: point coordinates are scaled for zoom factor. - * - * @param point - * @return cursor - */ - Cursor getCursorAt(Point point); + /** + * 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. + * + * @param useZoom + * + * @return canvas dimensions + */ + Dimension getCanvasDimensions(boolean useZoom); - /** - * Returns an instance of currently loaded project. - * - * @return - */ - Project getCurrentProject(); + /** + * Returns an instance of {@link Cursor} that should be used at the specified location. + * + * Note: point coordinates are scaled for zoom factor. + * + * @param point + * @return cursor + */ + Cursor getCursorAt(Point point); - /** - * Loads specified {@link Project}. - * - * @param project - * @param freshStart - */ - void loadProject(Project project, boolean freshStart); + /** + * Returns an instance of currently loaded project. + * + * @return + */ + Project getCurrentProject(); - /** - * Creates a new project. - */ - void createNewProject(); + /** + * Loads specified {@link Project}. + * + * @param project + * @param freshStart + */ + void loadProject(Project project, boolean freshStart); - /** - * Loads a project from the specified file. - * - * @param fileName - */ - void loadProjectFromFile(String fileName); + /** + * Creates a new project. + */ + void createNewProject(); - /** - * Saves the current project into the specified file. - * - * @param fileName - * @param isBackup - */ - void saveProjectToFile(String fileName, boolean isBackup); + /** + * Loads a project from the specified file. + * + * @param fileName + */ + void loadProjectFromFile(String fileName); - /** - * @return the current file name. - */ - String getCurrentFileName(); + /** + * Saves the current project into the specified file. + * + * @param fileName + * @param isBackup + */ + void saveProjectToFile(String fileName, boolean isBackup); - /** - * @return true if the current project is modified. - */ - boolean isProjectModified(); + /** + * @return the current file name. + */ + String getCurrentFileName(); - /** - * Shows a user dialog if there are changes to confirm that it's safe to - * proceed. - * - * @return true, if file actions (new, open, close) can be taken - */ - boolean allowFileAction(); + /** + * @return true if the current project is modified. + */ + boolean isProjectModified(); - /** - * Returns all available {@link ComponentType}s classified by category. - * Result is a {@link Map} between category name to a {@link List} of all - * {@link ComponentType}s that share that category name. - * - * @return - */ - Map> getComponentTypes(); + /** + * Shows a user dialog if there are changes to confirm that it's safe to proceed. + * + * @return true, if file actions (new, open, close) can be taken + */ + boolean allowFileAction(); - /** - * Draws project on the provided {@link Graphics2D}. If the provided filter - * is not null, it will be used to filter the components that are shown. - * - * @param g2d - * @param drawOptions - * specific drawing options - * @param filter - */ - void draw(Graphics2D g2d, Set drawOptions, IComponentFiler filter); + /** + * Returns all available {@link ComponentType}s classified by category. Result is a {@link Map} + * between category name to a {@link List} of all {@link ComponentType}s that share that category + * name. + * + * @return + */ + Map> getComponentTypes(); - Double[] getAvailableZoomLevels(); + /** + * Draws project on the provided {@link Graphics2D}. If the provided filter is not null, it will + * be used to filter the components that are shown. + * + * @param g2d + * @param drawOptions specific drawing options + * @param filter + */ + void draw(Graphics2D g2d, Set drawOptions, IComponentFiler filter); - /** - * Returns current zoom level where zoomLevel = 1.0d means - * 100%. - * - * @return current zoom level - */ - double getZoomLevel(); + Double[] getAvailableZoomLevels(); - /** - * Changes current zoom level where zoomLevel = 1.0d means 100% - * - * @param zoomLevel - * new zoom leve - */ - void setZoomLevel(double zoomLevel); + /** + * Returns current zoom level where zoomLevel = 1.0d means 100%. + * + * @return current zoom level + */ + double getZoomLevel(); - /** - * Returns current version number. - * - * @return - */ - VersionNumber getCurrentVersionNumber(); + /** + * Changes current zoom level where zoomLevel = 1.0d means 100% + * + * @param zoomLevel new zoom leve + */ + void setZoomLevel(double zoomLevel); - /** - * Adds a list of components to the project. - * - * @param components - */ - void pasteComponents(List> components); + /** + * Returns current version number. + * + * @return + */ + VersionNumber getCurrentVersionNumber(); - /** - * Deletes all the selected components from the project. - */ - void deleteSelectedComponents(); + /** + * Adds a list of components to the project. + * + * @param components + */ + void pasteComponents(List> components); - /** - * Sets default value for the specified property name for currently selected - * component types. - * - * @param propertyName - * display name for property - * @param value - * new default value, must not be null - */ - void setSelectionDefaultPropertyValue(String propertyName, Object value); + /** + * Deletes all the selected components from the project. + */ + void deleteSelectedComponents(); - /** - * Sets default value for the specified property name for projects. - * - * @param propertyName - * display name for property - * @param value - * new default value, must not be null - */ - void setProjectDefaultPropertyValue(String propertyName, Object value); + /** + * Sets default value for the specified property name for currently selected component types. + * + * @param propertyName display name for property + * @param value new default value, must not be null + */ + void setSelectionDefaultPropertyValue(String propertyName, Object value); - /** - * @return 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. - */ - List getMutualSelectionProperties(); + /** + * Sets default value for the specified property name for projects. + * + * @param propertyName display name for property + * @param value new default value, must not be null + */ + void setProjectDefaultPropertyValue(String propertyName, Object value); - void editSelection(); + /** + * @return 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. + */ + List getMutualSelectionProperties(); - /** - * @return a list of editable properties of the current project. - */ - List getProjectProperties(); + void editSelection(); - /** - * Applies specified properties to the current project. - * - * @param properties - */ - void applyPropertiesToProject(List properties); - - /** - * Gets the current new component slot. - */ - ComponentType getNewComponentTypeSlot(); + /** + * @return a list of editable properties of the current project. + */ + List getProjectProperties(); - /** - * Sets the new component slot. Specified component type will be used to - * instantiate new component. - * - * @param componentType - * @param template - */ - void setNewComponentTypeSlot(ComponentType componentType, Template template); + /** + * Applies specified properties to the current project. + * + * @param properties + */ + void applyPropertiesToProject(List properties); - /** - * Changes default size notation, true for metric, false for imperial. - * - * @param isMetric - */ - void setMetric(boolean isMetric); + /** + * Gets the current new component slot. + */ + ComponentType getNewComponentTypeSlot(); - /** - * Groups all selected components. - */ - void groupSelectedComponents(); + /** + * Sets the new component slot. Specified component type will be used to instantiate new + * component. + * + * @param componentType + * @param template + */ + void setNewComponentTypeSlot(ComponentType componentType, Template template); - /** - * Ungroups all selected components. - */ - void ungroupSelectedComponents(); + /** + * Changes default size notation, true for metric, false for imperial. + * + * @param isMetric + */ + void setMetric(boolean isMetric); - /** - * Locks or unlocks the specified layer. All components within +- 0.5 range - * will be affected by the change as well. - * - * @param layerZOrder - * @param locked - */ - void setLayerLocked(int layerZOrder, boolean locked); + /** + * Groups all selected components. + */ + void groupSelectedComponents(); - /** - * @return selection size expressed in either inches or centimeters, based - * on the user preference. - */ - Point2D calculateSelectionDimension(); - -// /** -// * @return the smallest rectangle that encloses the selection -// */ -// Rectangle2D getSelectedAreaRect(); + /** + * Ungroups all selected components. + */ + void ungroupSelectedComponents(); - /** - * Sends each of the selected components one step back. - */ - void sendSelectionToBack(); + /** + * Locks or unlocks the specified layer. All components within +- 0.5 range will be affected by + * the change as well. + * + * @param layerZOrder + * @param locked + */ + void setLayerLocked(int layerZOrder, boolean locked); - /** - * Brings each of the selected components one step to front. - */ - void bringSelectionToFront(); + /** + * @return selection size expressed in either inches or centimeters, based on the user preference. + */ + Point2D calculateSelectionDimension(); - /** - * Causes the display to refresh. - */ - void refresh(); + // /** + // * @return the smallest rectangle that encloses the selection + // */ + // Rectangle2D getSelectedAreaRect(); - /** - * @return currently selected theme. - */ - Theme getSelectedTheme(); + /** + * Sends each of the selected components one step back. + */ + void sendSelectionToBack(); - /** - * Changes the current theme. - * - * @param theme - */ - void setSelectedTheme(Theme theme); + /** + * Brings each of the selected components one step to front. + */ + void bringSelectionToFront(); - /** - * Renumbers all the selected components. - * - * @param xAxisFirst - */ - void renumberSelectedComponents(boolean xAxisFirst); + /** + * Causes the display to refresh. + */ + void refresh(); + + /** + * @return currently selected theme. + */ + Theme getSelectedTheme(); + + /** + * Changes the current theme. + * + * @param theme + */ + void setSelectedTheme(Theme theme); + + /** + * Renumbers all the selected components. + * + * @param xAxisFirst + */ + void renumberSelectedComponents(boolean xAxisFirst); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ISelectionProcessor.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ISelectionProcessor.java index 1659e873..5edadf15 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ISelectionProcessor.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ISelectionProcessor.java @@ -8,52 +8,49 @@ import org.diylc.core.IDIYComponent; public interface ISelectionProcessor { - /** - * Returns the current {@link ComponentTransferable}. - * - * @return - */ - List> getSelectedComponents(); + /** + * Returns the current {@link ComponentTransferable}. + * + * @return + */ + List> getSelectedComponents(); - /** - * Updates the selection with the specified list of component. Also, updates - * control point map with all components that are stuck to the newly - * selected components. - * - * @param newSelection - */ - void updateSelection(List> newSelection); + /** + * Updates the selection with the specified list of component. Also, updates control point map + * with all components that are stuck to the newly selected components. + * + * @param newSelection + */ + void updateSelection(List> newSelection); - /** - * Finds all components at the specified location, sorted by z-index from - * top to bottom. - * - * @param point - * @return - */ - List> findComponentsAt(Point point); + /** + * Finds all components at the specified location, sorted by z-index from top to bottom. + * + * @param point + * @return + */ + List> findComponentsAt(Point point); - /** - * Expands the current selection to include surrounding components. Options - * are controlled with expansionMode flag. - * - * @param expansionMode - */ - void expandSelection(ExpansionMode expansionMode); + /** + * Expands the current selection to include surrounding components. Options are controlled with + * expansionMode flag. + * + * @param expansionMode + */ + void expandSelection(ExpansionMode expansionMode); - /** - * Selects all components in the project. - * - * @param int layer if > 0, designates which layer to select. If <= 0 we - * should select all regardless of layer - */ - void selectAll(int layer); + /** + * Selects all components in the project. + * + * @param int layer if > 0, designates which layer to select. If <= 0 we should select all + * regardless of layer + */ + void selectAll(int layer); - /** - * Rotates selection for 90 degrees. - * - * @param direction - * 1 for clockwise, -1 for counter-clockwise - */ - void rotateSelection(int direction); + /** + * Rotates selection for 90 degrees. + * + * @param direction 1 for clockwise, -1 for counter-clockwise + */ + void rotateSelection(int direction); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITask.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITask.java index eb7ad07a..57bdf20e 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITask.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITask.java @@ -9,26 +9,25 @@ package org.diylc.common; */ public interface ITask { - /** - * Runs in background thread. - * - * @return - * @throws Exception - */ - T doInBackground() throws Exception; + /** + * Runs in background thread. + * + * @return + * @throws Exception + */ + T doInBackground() throws Exception; - /** - * Called if background thread fails. - * - * @param e - */ - void failed(Exception e); + /** + * Called if background thread fails. + * + * @param e + */ + void failed(Exception e); - /** - * Called if background thread is executed correctly, the result is passed - * as a parameter. - * - * @param result - */ - void complete(T result); + /** + * Called if background thread is executed correctly, the result is passed as a parameter. + * + * @param result + */ + void complete(T result); } diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITemplateProcessor.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITemplateProcessor.java index 1cf825a6..fd66cf9c 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITemplateProcessor.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/common/ITemplateProcessor.java @@ -6,21 +6,21 @@ import org.diylc.core.Template; public interface ITemplateProcessor { - public static final String TEMPLATES_KEY = "templates"; + public static final String TEMPLATES_KEY = "templates"; - void saveSelectedComponentAsTemplate(String templateName); + void saveSelectedComponentAsTemplate(String templateName); - List