-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major update. A list of all the changes made since the last commit are included in the comments.
- Loading branch information
Showing
36 changed files
with
2,434 additions
and
1,573 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package airdock.delegates | ||
{ | ||
import airdock.events.PropertyChangeEvent; | ||
import airdock.interfaces.display.IDisplayFilter; | ||
import airdock.interfaces.docking.IContainer; | ||
import airdock.interfaces.ui.IPanelList; | ||
import airdock.util.PropertyChangeProxy; | ||
import flash.display.DisplayObject; | ||
import flash.events.Event; | ||
import flash.events.IEventDispatcher; | ||
|
||
/** | ||
* ... | ||
* @author Gimmick | ||
*/ | ||
public class ContainerDelegate implements IEventDispatcher | ||
{ | ||
private var cl_baseContainer:IContainer; | ||
private var cl_changeProxy:PropertyChangeProxy; | ||
private var cl_displayFilterDelegate:DisplayFilterDelegate; | ||
public function ContainerDelegate(container:IContainer) | ||
{ | ||
cl_baseContainer = container; | ||
cl_changeProxy = new PropertyChangeProxy(container) | ||
cl_displayFilterDelegate = new DisplayFilterDelegate(container) | ||
} | ||
|
||
public function dispatchChanging(property:String, oldValue:Object, newValue:Object):Boolean { | ||
return dispatchEvent(new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGING, property, oldValue, newValue, true, true)) | ||
} | ||
|
||
public function dispatchChanged(property:String, oldValue:Object, newValue:Object):void { | ||
dispatchEvent(new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGED, property, oldValue, newValue, true, false)) | ||
} | ||
|
||
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void { | ||
cl_baseContainer.addEventListener(type, listener, useCapture, priority, useWeakReference); | ||
} | ||
|
||
public function dispatchEvent(event:Event):Boolean { | ||
return cl_baseContainer.dispatchEvent(event); | ||
} | ||
|
||
public function hasEventListener(type:String):Boolean { | ||
return cl_baseContainer.hasEventListener(type); | ||
} | ||
|
||
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void { | ||
cl_baseContainer.removeEventListener(type, listener, useCapture); | ||
} | ||
|
||
public function willTrigger(type:String):Boolean { | ||
return cl_baseContainer.willTrigger(type); | ||
} | ||
|
||
public function applyFilters(filters:Vector.<IDisplayFilter>):void { | ||
cl_displayFilterDelegate.applyFilters(filters); | ||
} | ||
|
||
public function clearFilters(filters:Vector.<IDisplayFilter>):void { | ||
cl_displayFilterDelegate.clearFilters(filters); | ||
} | ||
|
||
public function get displayFilters():Vector.<IDisplayFilter> | ||
{ | ||
var filters:Vector.<IDisplayFilter> = cl_changeProxy.displayFilters as Vector.<IDisplayFilter>; | ||
return filters && filters.concat(); | ||
} | ||
|
||
public function set displayFilters(value:Vector.<IDisplayFilter>):void | ||
{ | ||
cl_displayFilterDelegate.clearFilters(cl_changeProxy.displayFilters as Vector.<IDisplayFilter>) | ||
cl_changeProxy.displayFilters = value && value.concat(); | ||
cl_displayFilterDelegate.applyFilters(value) | ||
} | ||
|
||
public function get sideCode():int { | ||
return cl_changeProxy.sideCode; | ||
} | ||
|
||
public function set sideCode(sideCode:int):void { | ||
cl_changeProxy.sideCode = sideCode | ||
} | ||
|
||
public function get sideSize():Number { | ||
return cl_changeProxy.sideSize; | ||
} | ||
|
||
public function set sideSize(value:Number):void { | ||
cl_changeProxy.sideSize = value | ||
} | ||
|
||
public function get containerState():Boolean { | ||
return cl_changeProxy.containerState; | ||
} | ||
|
||
public function set containerState(value:Boolean):void { | ||
cl_changeProxy.containerState = value; | ||
} | ||
|
||
public function get maxSideSize():Number { | ||
return cl_changeProxy.maxSideSize; | ||
} | ||
|
||
public function set maxSideSize(value:Number):void { | ||
cl_changeProxy.maxSideSize = value; | ||
} | ||
|
||
public function get minSideSize():Number { | ||
return cl_changeProxy.minSideSize; | ||
} | ||
|
||
public function set minSideSize(value:Number):void { | ||
cl_changeProxy.minSideSize = value; | ||
} | ||
|
||
public function get panelList():IPanelList { | ||
return cl_changeProxy.panelList; | ||
} | ||
|
||
public function set panelList(panelList:IPanelList):void { | ||
cl_changeProxy.panelList = panelList | ||
} | ||
|
||
public function get width():Number { | ||
return cl_changeProxy.width; | ||
} | ||
|
||
public function set width(width:Number):void { | ||
cl_changeProxy.width = width | ||
} | ||
|
||
public function get height():Number { | ||
return cl_changeProxy.height; | ||
} | ||
|
||
public function set height(height:Number):void { | ||
cl_changeProxy.height = height; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package airdock.delegates | ||
{ | ||
import airdock.interfaces.display.IDisplayFilter; | ||
import airdock.interfaces.display.IFilterable; | ||
import airdock.util.PropertyChangeProxy; | ||
import flash.display.DisplayObject; | ||
/** | ||
* ... | ||
* @author Gimmick | ||
*/ | ||
public class DisplayFilterDelegate | ||
{ | ||
private var cl_target:IFilterable | ||
public function DisplayFilterDelegate(target:IFilterable) { | ||
cl_target = target | ||
} | ||
|
||
/** | ||
* Applies the given filters to the target. | ||
* @param filters A Vector of IDisplayFilters which are to be applied to the target. | ||
*/ | ||
public function applyFilters(filters:Vector.<IDisplayFilter>):void | ||
{ | ||
for (var i:int = int(filters && filters.length) - 1; i >= 0; --i) { | ||
filters[i].apply(cl_target); | ||
} | ||
} | ||
|
||
/** | ||
* Removes the given filters from the target. | ||
* @param filters A Vector of IDisplayFilters which are to be removed from the target. | ||
*/ | ||
public function clearFilters(filters:Vector.<IDisplayFilter>):void | ||
{ | ||
for (var k:int = int(filters && filters.length) - 1; k >= 0; --k) { | ||
filters[k].remove(cl_target); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
737cce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking Changes:
The main breaking changes are listed below. Again, most of these involve changes to interfaces or events; if you are not using them, you will most likely not be affected (unless you make use of movePanelToContainer, which is the only miscellaneous breaking change listed). However, if you implement any custom class(es) which make use of these interfaces, then they will have to be updated.
Changes:
ITreeResolver
interface to accept aVector.<DisplayObject>
instead of just 2 for thefindCommonParent()
methodIDockTarget
interface to return a side (string) sequence for thegetSideFrom()
method instead of a single (integer) side code.getPanelContainers()
method in theIBasicDocker
interface togetPanelContainer()
- now returns a singleIPanel
's parkedIContainer
, not a list of key-valueIPanel
-IContainer
values.PanelPropertyChangeEvent
class toPropertyChangeEvent
since it was being used by non-panel classes as well, to report property changes; see also thePropertyChangeProxy
class.PanelContainerEvent
and its subclass events (PanelContainerStateEvent
) now accept aVector.<IPanel>
instance instead of a singleIPanel
. In effect, multipleIPanel
instances can take part in a drag-dock operation.PanelContainerSide
in place of integer versions wherever possible. Note that the integer representation of PanelContainerSIde is deprecated and will be removed in a future release.Removals:
DockEvent
class and its corresponding events due to needless redundancymovePanelToContainer
method from theIBasicDocker
interfaceIPair
interface (StaticPair
,DynamicPair
, etc.) because none of them were visible in public-facing code; instead replaced with a stronger typedPanelSideSequence
internal class where use of a panel-container key-value pair was required.737cce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other Changes & Additions
Other changes and additions, some minor and others semi-major, are listed in further comments.
737cce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additions:
ContainerDelegate
- basic delegation class for theIContainer
interface, currently used by the DefaultContainer class.PropertyChangeProxy
- a delegate Proxy which dispatchesPropertyChangeEvent.PROPERTY_CHANGING
andPropertyChangeEvent.PROPERTY_CHANGED
events before and after a change occurs, used primarily in delegation classes (PanelDelegate
,ContainerDelegate
, etc.)IDisposable
interface - The interface indicating which classes have a dispose() method which needs to be called prior to removal (i.e. simple garbage collection does not suffice for removal of an IDisposable implementer)IStrategy
andIDockerStrategy
interfaces - Interfaces for docking strategy; used by Dockers to carry out drag-dock operationsdestinationFormat
in theIDockFormat
interfaceresizeHelper
anddockHelper
(get, set) to theICustomizableDocker
interfaceintegratePanel
to theIBasicDocker
interface - this interface method moves a panel to the last non-parked rootIContainer
it occupiedtreeResolver
anddockFormat
to theIBasicDocker
interfaceDefaultResizer
now collapses containers on double-clickDefaultPanelList
by holding down theCtrl
orCommand
key when clicking on panel tabsDefaultPanelList
when extra panel tabs are hidden from view (e.g. if its width is too small to display all tabs)ResizerStrategy
class - the Docker offloads the display and resizing of containers to this class.DockHelperStrategy
class - the Docker offloads the display and selection of containers (by the user) during a drag-dock operation to this class.ResizerEvent
class - event class which is used byResizerStrategy
andResizerDelegate
to handle resize operations (not to be confused with thePanelContainerEvent.RESIZE
event)DisplayFilterDelegate
class - handles the applying and clearing of display filters to and from a given targetChanges:
forEach
,filter
,map
, etc. where possible)ResizerDelegate
'sgetDragBounds()
now returns a rectangle clipped to the actual width and height reported by the container, not that ofgetBounds()
(sincegetBounds()
reports incorrect sizes when the defaultwidth
andheight
properties are overridden in aDisplayObject
)AIRDock
class to remove unnecessary and redundant dock operations.AIRDock
class now uses thePropertyChangeProxy
for storing data instead of storing it directly.737cce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To elaborate:
The old method
Previously, a drag-docking operation required the use of the
Clipboard
property of theNativeDragEvent
, and 2 docking formats within. They were used to store 2 things:IPanelList
instance of theIContainer
had set it that way - whenever a panel tab in the list was dragged, for example.IContainer
- it intercepted thePanelContainerEvent.DRAG_REQUESTED
(and other) events and redispatched them, attaching itself as the relatedIContainer
.This led to a series of
if (panel) { ... } else if (container) { ... }
chains throughout the code, and was not really too maintainable. Also, anIDockHelper
instance would accept theNativeDragEvent
(viaNativeDragManager.acceptDragDrop()
method) and would dispatch aDockEvent.DRAG_COMPLETING
event in its listener.The new way™
In the new system, however, there are 3 items in the drag-dock clipboard:
Vector.<IPanel>
, performing the same function as the panel, previously; however, multiple panels are included - not just one. If the entire container contents are to be dragged, this parameter is not set to null (unlike before); instead, all the panels in the container are passed as a parameter.IDragDockFormat
instance - this is just a normalObject
used to store data about the destinationIContainer
and the side it is to be attached to.Now in a drag-dock operation, when the
IDockHelper
instance accepts the drag, then instead of dispatching a separateDockEvent.DRAG_COMPLETING
event, it instead changes the contents of the clipboard - that is, it modifies theIDragDockFormat
's properties (since writing to the clipboard is not allowed, but modifying an existing object's properties are) to include information about the destinationIContainer
instance and the side sequence it is to be attached to.The host (originating/initiating) Docker instance, at the end of the native drag (i.e.
NativeDragEvent.NATIVE_DRAG_COMPLETE
) then inspects theIDragDockFormat
properties to decide where to dock the panels.This change was done to better facilitate cross-docking - now, the host Docker can easily check for
crossDockingPolicy
violations, and is less roundabout.