incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1301803 - in /incubator/flex/whiteboard/quetwo/MobileAlert/src: PopUpExample.mxml org/apache/spark/components/PopUpComponent.as org/apache/spark/skins/ org/apache/spark/skins/PopUpSkin.mxml
Date Fri, 16 Mar 2012 22:36:08 GMT
Author: tink
Date: Fri Mar 16 22:36:08 2012
New Revision: 1301803

URL: http://svn.apache.org/viewvc?rev=1301803&view=rev
Log:
Example and dependencies of extending a SkinnablePopUpComponent.

Added:
    incubator/flex/whiteboard/quetwo/MobileAlert/src/PopUpExample.mxml
    incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/components/PopUpComponent.as
    incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/
    incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/PopUpSkin.mxml

Added: incubator/flex/whiteboard/quetwo/MobileAlert/src/PopUpExample.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/quetwo/MobileAlert/src/PopUpExample.mxml?rev=1301803&view=auto
==============================================================================
--- incubator/flex/whiteboard/quetwo/MobileAlert/src/PopUpExample.mxml (added)
+++ incubator/flex/whiteboard/quetwo/MobileAlert/src/PopUpExample.mxml Fri Mar 16 22:36:08
2012
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
+					   xmlns:s="library://ns.adobe.com/flex/spark" 
+					   xmlns:mx="library://ns.adobe.com/flex/mx"
+					   xmlns:components="org.apache.spark.components.*">
+	
+	<fx:Script>
+		<![CDATA[
+			protected function button1_clickHandler(event:MouseEvent):void
+			{
+				popup.open( this, modal.selected );
+			}
+		]]>
+	</fx:Script>
+	
+	<fx:Declarations>
+		<components:PopUpComponent id="popup" skinClass="org.apache.spark.skins.PopUpSkin"
+								   x="{popupX.value}" y="{popupY.value}"
+								   width="{popupWidth.value}" height="{popupHeight.value}"
+								   centerPopUp="{centerPopUp.selected}"/>
+		
+		<!--modalTransparency="{modalTransparency.value/100)}"
+		modalTransparencyColor="{modalTransparencyColor.selectedColor}"
+		modalTransparencyDuration="{modalTransparencyDuration.value}"
+		modalTransparencyBlur="{modalTransparencyBlur.value}"-->
+		
+	</fx:Declarations>
+	
+	<s:layout>
+		<s:VerticalLayout paddingTop="20" horizontalAlign="center"/>
+	</s:layout>
+	
+	<s:HGroup>
+		<s:CheckBox id="modal" label="modal"/>
+		<s:Button label="Open" click="button1_clickHandler(event)"
+				  enabled="{!popup.isOpen}"/>
+	</s:HGroup>
+	
+	
+	<s:HGroup>
+		<s:Label text="width"/>
+		<s:HSlider id="popupWidth" minimum="50" maximum="300" value="100"/>
+		<s:Label text="height"/>
+		<s:HSlider id="popupHeight" minimum="50" maximum="300" value="100"/>
+	</s:HGroup>	
+	
+	<s:HGroup>
+		<s:CheckBox id="centerPopUp" label="Keep centered"/>
+		<s:Label text="x" alpha="{centerPopUp.selected ? 0.5 : 1}"/>
+		<s:HSlider id="popupX" minimum="0" maximum="300" value="0"
+				   enabled="{!centerPopUp.selected}"/>
+		<s:Label text="y" alpha="{centerPopUp.selected ? 0.5 : 1}"/>
+		<s:HSlider id="popupY" minimum="0" maximum="300" value="0"
+				   enabled="{!centerPopUp.selected}"/>
+	</s:HGroup>
+	
+	<s:HGroup>
+		<s:Label text="modalTransparency"/>
+		<s:HSlider id="modalTransparency" minimum="0" maximum="100" value="0.5"/>
+	</s:HGroup>
+	
+	<s:HGroup>
+		<s:Label text="modalTransparencyColor"/>
+		<mx:ColorPicker id="modalTransparencyColor" selectedColor="0xDDDDDD"/>
+	</s:HGroup>
+	
+	<s:HGroup>
+		<s:Label text="modalTransparencyDuration"/>
+		<s:HSlider id="modalTransparencyDuration" minimum="0" maximum="1000" value="150"/>
+	</s:HGroup>
+	
+	<s:HGroup>
+		<s:Label text="modalTransparencyBlur"/>
+		<s:HSlider id="modalTransparencyBlur" minimum="0" maximum="10" value="3"/>
+	</s:HGroup>
+	
+</s:Application>

Added: incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/components/PopUpComponent.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/components/PopUpComponent.as?rev=1301803&view=auto
==============================================================================
--- incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/components/PopUpComponent.as
(added)
+++ incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/components/PopUpComponent.as
Fri Mar 16 22:36:08 2012
@@ -0,0 +1,38 @@
+package org.apache.spark.components
+{
+	import flash.events.MouseEvent;
+	
+	import mx.core.IButton;
+	import org.apache.spark.components.supportClasses.SkinnablePopUpComponent;
+
+	public class PopUpComponent extends SkinnablePopUpComponent
+	{
+		public function PopUpComponent()
+		{
+			super();
+		}
+		
+		[SkinPart(required="true")]
+		public var closeButton:IButton;
+		
+		override protected function partAdded(partName:String, instance:Object):void
+		{
+			super.partAdded(partName, instance);
+			
+			if( instance == closeButton ) closeButton.addEventListener( MouseEvent.CLICK, closeButtonClickHandler,
false, 0, true );
+		}
+		
+		override protected function partRemoved(partName:String, instance:Object):void
+		{
+			super.partRemoved(partName, instance);
+			
+			if( instance == closeButton ) closeButton.removeEventListener( MouseEvent.CLICK, closeButtonClickHandler,
false );
+		}
+		
+		private function closeButtonClickHandler( event:MouseEvent ):void
+		{
+			trace( "got it@" );
+			close();
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/PopUpSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/PopUpSkin.mxml?rev=1301803&view=auto
==============================================================================
--- incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/PopUpSkin.mxml
(added)
+++ incubator/flex/whiteboard/quetwo/MobileAlert/src/org/apache/spark/skins/PopUpSkin.mxml
Fri Mar 16 22:36:08 2012
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
+		xmlns:s="library://ns.adobe.com/flex/spark" 
+		xmlns:mx="library://ns.adobe.com/flex/mx">
+	
+	<!-- host component -->
+	<fx:Metadata>
+		[HostComponent("org.apache.spark.components.PopUpComponent")]
+	</fx:Metadata>
+	
+	<!-- states -->
+	<s:states>
+		<s:State name="normal"/>
+		<s:State name="closed" />
+	</s:states>
+	
+	<!-- Transitions for open and close -->
+	<s:transitions>
+		<s:Transition fromState="closed" toState="normal" autoReverse="true">
+			<s:Fade duration="150" target="{closeButton}"/>
+		</s:Transition>
+
+		<s:Transition fromState="normal" toState="closed" autoReverse="true">
+			<s:Fade duration="150" target="{closeButton}"/>
+		</s:Transition>
+	</s:transitions>
+	
+	<!--- Defines the background and content group used by this skin. -->
+	<s:Button id="closeButton" label="Close" left="0" right="0" top="0" bottom="0" visible.closed="false"/>
+	
+</s:Skin>



Mime
View raw message