Tuesday, 23 October 2012

Maven : Error Build fails "org.mortbay.jetty:maven-jetty-plugin"

The build fails:
Unable to find resource 'org.mortbay.jetty:maven-jetty-plugin:maven-plugin:7.0.0.pre5'. 



Solution: 


Index: example/webapp/pom.xml
===================================================================
--- example/webapp/pom.xml (revision 807)
+++ example/webapp/pom.xml Mon Nov 24 14:29:19 EST 2008
@@ -32,7 +32,7 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
+ <artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
Index: example/oauth-provider/pom.xml
===================================================================
--- example/oauth-provider/pom.xml (revision 807)
+++ example/oauth-provider/pom.xml Mon Nov 24 14:29:35 EST 2008
@@ -36,7 +36,7 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
+ <artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/web</webAppSourceDirectory>

Error: Java compiler level does not match the version of the installed Java project facet

Error:

Java compiler level does not match the version of the installed Java project facet


Eclipse or STS:  change the value shown in below screen...




Thanks for Visiting.........................

Monday, 1 October 2012

Installing Subclipse in Flash Builder 4


Subclipse is one of the most frequently used plug-ins with Flash Builder. Here are some simple instructions for installing Subclipse and importing an existing project.
  1. Help > Install New Software…
  2. Add…
  3. Name=Subclipse, Location=http://subclipse.tigris.org/update_1.6.x
  4. Select the plug-ins shown in the screenshot below. Note: I’ve deselected a few plug-ins here in order to minimize plug-in dependencies that sometimes have issues resolving.
    subclipse1.png
  5. Finish the wizard. When prompted, restart Eclipse.
  6. On Mac, since JavaHL is not available, be sure to select SVNKit for your SVN interface
    1. Window > Preferences
    2. Team > SVN
    3. Change SVN Interface to SVNKit
  7. To import your projects from SVN
    1. File > Import…
    2. SVN > Checkout Projects from SVN
    3. Create or select a repository location
    4. Select your project root folder
    5. Finish

Thursday, 13 September 2012

Handling Date and Time in Flex

Handling Date and Time in Flex


Pattern Example
Year      
YY              09 (Year Number Short)
YYY           2009 (Year Number Full)
YYYY        02009 (I have no clue why you would need this)
Month 
M                7 (Month Number Short)
MM            07 (Month Number Full)
MMM         Jul (Month Name Short)
MMMM     July (Month Name Full)
Day       
D               4 (Day Number Short)
DD            04 (Day Number Full)
Day Name          
E               1 (Day Number Short)
EE            01 (Day Number Full)
EEE          Mon (Day Name Short)
EEEE        Monday (Day Name Full)
A              AM/PM
J               Hour in day (0-23)
H              Hour in day (1-24)
K              Hour in AM/PM (0-11)
L               Hour in AM/PM(1-12)
N             3 (Minutes)
NN          03 (Minutes)
SS           30 (Seconds)


Sample date format : 
MXML:
<fx:Declarations>
<mx:DateFormatter id="dateFormatter" formatString="MM/DD/YYYY"/>
<mx:DateFormatter id="dateFormatterForDateAndTime" formatString="MM/DD/YYYY L:NN A"/>
</fx:Declarations>


Date time Component:




Thanks for Visiting............

Wednesday, 12 September 2012

Icon in addressbar (Favicon in flex)


Favicon(Icon in addressbar) in flex
Hi friends,
After too much googling finally I found the way how to display the favicon i.e icon display in the website in the left hand side of address bar.
You have to just put the two lines in the html page.

---------------------------------------------------------------------
"< link rel="icon" href="favicon.ico" type="image/ico">"
---------------------------------------------------------------------

place this line inside the head tag of your applicationName.html

You can find the html file in
YourApplicationFolder/bin-debug/yourApplicationName.html


HREF= address of your icon

Just compile and run your project.
You will find the icon in address bar.


FYI - To convert .jpg, gif ..etc to .ico  use below web site.
http://www.coolutils.com/online/image-converter/

Thanks for visiting...........................

Thursday, 9 August 2012

spark combobox dataprovider validator for dependency dropdowns


<mx:FormItem label="School" styleName="formLabel">
<s:ComboBox id="schoolNameOtherInfo" width="150"
labelField="displayValue"
dataProvider="{getSchoolMappings(leadDetails.studentInfo.studentPersonalInfo.district)}"
selectedIndex="{AppUtil.getSelectedIndex(getSchoolMappings(leadDetails.studentInfo.studentPersonalInfo.district), leadDetails.studentInfo.studentPersonalInfo.school)}"
textInput="schoolNameOtherInfo_textInputHandler(event)"
change="schoolNameOtherInfo_onChangeEvent(event)"
focusOut="schoolNameOtherInfo_focusOutHandler(event)" buttonMode="true" />
</mx:FormItem>
<mx:FormItem label="Eligibility" styleName="formLabel">
<s:DropDownList id="eligibility"
width="150"
dataProvider="{getSchoolEligibleMappings(leadDetails.studentInfo.studentPersonalInfo.school)}"
labelField="displayValue"
selectedIndex="{AppUtil.getSelectedIndex(getSchoolEligibleMappings(leadDetails.studentInfo.studentPersonalInfo.school), leadDetails.studentInfo.studentPersonalInfo.eligibility)}"/>
</mx:FormItem>




protected function schoolNameOtherInfo_onChangeEvent(event:IndexChangeEvent):void
{
if (schoolNameOtherInfo.selectedIndex >= 0 )
filterSchoolEligible(event);
else
{
schoolNameOtherInfo.selectedIndex=-1;
eligibility.selectedIndex=-1;
}
}

protected function schoolNameOtherInfo_focusOutHandler(event:FocusEvent):void
{

if (schoolNameOtherInfo.selectedIndex >= 0 )
filterSchoolEligible(event);
else
{
schoolNameOtherInfo.selectedIndex=-1;
eligibility.selectedIndex=-1;
}
}

public var schoolName:String;
protected function schoolNameOtherInfo_textInputHandler(event:TextEvent):void
{
schoolName=event.text;
}







Thanks for Visiting........................

Monday, 6 August 2012

Use CheckBox HeaderRenderer to select/deselete CheckBox ItemRenderer in DataGrid


Refer this site:
http://my.opera.com/phamthanhson/blog/use-checkbox-headerrenderer-to-select-deselete-checkbox-itemrenderer-in-flex-3



Here is code for application (CheckBoxInDataGrid.mxml):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
xmlns:component="test.view.component.*" horizontalAlign="center" verticalAlign="middle"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.events.DataGridEvent;
import mx.events.FlexEvent;
import mx.events.ListEvent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import test.model.dto.Category;

private function init() : void {
addEventListeners();
}

private function addEventListeners() : void {
deleteSelectedButton.addEventListener(MouseEvent.CLICK, handleDeleteSelectedButtonClicked);
}

private function handleDeleteSelectedButtonClicked(event : MouseEvent) : void {
if (checkAllCol.itemsSelected.length > 0) {               //it contains all the selected(checked records)values
Alert.show("Are you sure you want to delete the seleted items?", "Confirm Deleted", 
Alert.YES | Alert.NO, this, handleConfirmDeleteSelected, null, Alert.YES);
}
}

private function handleConfirmDeleteSelected(event : CloseEvent) : void {
if (event.detail == Alert.YES) {
var provider : ArrayCollection = myDataGrid.dataProvider as ArrayCollection;
for each (var item : Category in checkAllCol.itemsSelected) {
provider.removeItemAt(getItemIndex(provider, item));
}
checkAllCol.itemsSelected.removeAll();
}
}

private function getItemIndex(list : ArrayCollection, item : Category) : int {
for (var index : int = 0; index < list.length; index++) {
if (item.id == list[index].id) {
return index;
}
}
return -1;
}
public function initItemsSelected() : ArrayCollection {
var itemsSelected : ArrayCollection = new ArrayCollection();
for (var i : int = 0; i < 5; i += 2) {
var category : Category = new Category();
category.id = i;
category.title = "Title " + i;
category.description = "Description for title " + i;
itemsSelected.addItem(category);
}
return itemsSelected;
}

public function initItemList() : ArrayCollection {
var itemList : ArrayCollection = new ArrayCollection();
for (var i : int = 0; i < 20; i++) {
var category : Category = new Category();
category.id = i;
category.title = "Title " + i;
category.description = "Description for title " + i;
itemList.addItem(category);
}
return itemList;
}
]]>
</mx:Script>
<mx:VBox horizontalAlign="right">
<mx:DataGrid id="myDataGrid" dataProvider="{initItemList()}" sortableColumns="false">
<mx:columns>
<component:CheckBoxHeaderColumn id="checkAllCol"
headerRenderer="test.view.component.CheckBoxHeaderRenderer"
itemRenderer="test.view.component.CheckBoxItemRenderer"
itemsSelected="{initItemsSelected()}" headerText="All" width="50"/>
<mx:DataGridColumn id="titleCol" headerText="Title" dataField="title" />
<mx:DataGridColumn id="descriptionCol" headerText="Description" dataField="description" width="150" />
</mx:columns>
</mx:DataGrid>
<mx:Button id="deleteSelectedButton" label="Delete Selected"/>
</mx:VBox>
</mx:Application>

The CheckBoxHeaderColumn class (CheckBoxHeaderColumn.as):

package test.view.component
{
import mx.collections.ArrayCollection;
import mx.controls.dataGridClasses.DataGridColumn;

public class CheckBoxHeaderColumn extends DataGridColumn
{
public var itemsSelected : ArrayCollection;
public var checkBoxHeaderRenderer : CheckBoxHeaderRenderer;
public var checkBoxItemRenderer : CheckBoxItemRenderer;

public function CheckBoxHeaderColumn(columnName:String=null)
{
super(columnName);
}
}
}


The CheckBoxHeaderRenderer class (CheckBoxHeaderRenderer.as):

package test.view.component
{
import flash.events.MouseEvent;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.controls.DataGrid;

public class CheckBoxHeaderRenderer extends CheckBox
{
private var _headerColumn : CheckBoxHeaderColumn;

public function CheckBoxHeaderRenderer()
{
super();
}

override public function set data(value:Object):void {
var list : ArrayCollection = (listData.owner as DataGrid).dataProvider as ArrayCollection;
_headerColumn = value as CheckBoxHeaderColumn;
_headerColumn.checkBoxHeaderRenderer = this;
label = _headerColumn.headerText;
selected = (_headerColumn.itemsSelected.length == list.length) ? true : false;
}

override protected function clickHandler(event:MouseEvent):void {
super.clickHandler(event);
if (!selected)
_headerColumn.itemsSelected = new ArrayCollection();
else {
var list : ArrayCollection = cloneArrayColection((listData.owner as DataGrid).dataProvider as ArrayCollection);
_headerColumn.itemsSelected = list;
}
Alert.show(_headerColumn.itemsSelected.length + " items selected.");
_headerColumn.dispatchEvent(event);
}

public function cloneArrayColection(arrayCollection : ArrayCollection) : ArrayCollection {
var result : ArrayCollection = new ArrayCollection();
for each (var item : Object in arrayCollection) {
result.addItem(item);
}
return result;
}

}
}


The CheckBoxItemRenderer (CheckBoxItemRenderer.as):

package test.view.component
{
import flash.events.MouseEvent;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.controls.DataGrid;

import test.model.dto.Category;

public class CheckBoxItemRenderer extends CheckBox
{
private var _checkBoxHeaderColumn : CheckBoxHeaderColumn;

public function CheckBoxItemRenderer()
{
super();
}

override public function set data(value:Object):void {
var dataGrid : DataGrid = listData.owner as DataGrid;
var list : ArrayCollection = dataGrid.dataProvider as ArrayCollection;
_checkBoxHeaderColumn = dataGrid.columns[listData.columnIndex];
_checkBoxHeaderColumn.addEventListener(MouseEvent.CLICK, columnHeaderClickHandler);
_checkBoxHeaderColumn.checkBoxItemRenderer = this;
if (_checkBoxHeaderColumn.itemsSelected != null && list != null) {
selected = containsItem(_checkBoxHeaderColumn.itemsSelected, value);
}
}

override protected function clickHandler(event:MouseEvent):void {
super.clickHandler(event);
var dataGrid : DataGrid = listData.owner as DataGrid;
var list : ArrayCollection = dataGrid.dataProvider as ArrayCollection;
var item : Category = list[listData.rowIndex + dataGrid.verticalScrollPosition];
if (!selected) {
_checkBoxHeaderColumn.checkBoxHeaderRenderer.selected = selected;
removesItem(_checkBoxHeaderColumn.itemsSelected, item);
Alert.show("Item de-selected: " + item.title);
}
else {
_checkBoxHeaderColumn.itemsSelected.addItem(item);
Alert.show("Item selected: " + item.title);
if (_checkBoxHeaderColumn.itemsSelected.length == list.length)
_checkBoxHeaderColumn.checkBoxHeaderRenderer.selected = selected;
}
Alert.show(_checkBoxHeaderColumn.itemsSelected.length + " items selected.");
}

public function containsItem(list : ArrayCollection, target : Object) : Boolean {
for each (var item : Object in list) {
if (item.id == target.id)
return true;
}
return false;
}

public function removesItem(list : ArrayCollection, target : Category) : void {
for (var index : int = 0; index < list.length; index++) {
if (list.getItemAt(index).id == target.id) {
list.removeItemAt(index);
return;
}
}
}

private function columnHeaderClickHandler(event:MouseEvent):void {
selected = _checkBoxHeaderColumn.checkBoxHeaderRenderer.selected;
}
}
}

Finally, the Category class:

package test.model.dto
{
public class Category
{
public var id : int;
public var title : String;
public var description : String;

public function Category()
{
}
}
}





Thanks For Visiting..............................