Color schemes I’m currently using (Eclipse and IntelliJ)
intellij – eclipse alike keymaps
Tags: eclipse, intellij, syntax coloring
Color schemes I’m currently using (Eclipse and IntelliJ)
intellij – eclipse alike keymaps
Tags: eclipse, intellij, syntax coloring
The entity returned from a lazy-loading relationship can actually be a proxy that waits until
a method is invoked on the proxy before the entity is faulted in. We have to invoke a method on the
entity to guarantee that it is actually retrieved from the database. If this were a collection-valued
relationship, the size() method of the Collection would be commonly used to force eager loading.
public class BaseUser
{
...
@OneToMany(mappedBy="user",cascade=CascadeType.ALL, orphanRemoval=true)
public Collection<Authority> authorities;
...
}
//Some point in code under transcational
Query q = em.createQuery("SELECT v FROM User v WHERE v.username = '" + username + "'");
if (users.size() != 0)
{
User user = (User) q.getResultList().get(0);
//this will trigger lazy loading
user.getAuthoritys().size();
}
...
In order to hide action bar from the ViewNavigator all you have to do is create custom ViewNavigatorSkin and override its createChildren method.There you have several options, set includeInLayout to false or just don’t add actionbar as a child at all.Simple as that.
override protected function createChildren():void
{
contentGroup = new Group();
contentGroup.id = "contentGroup";
actionBar = new ActionBar();
actionBar.id = "actionBar";
addChild(contentGroup);
//either you can comment this line out
//addChild(actionBar);
//or you can simply do this
actionBar.visible = actionBar.includeInLayout = false;
addChild(actionBar);
}
If you are developing Adobe AIR for multiple devices and mobile (Desktop, Android, iPhone, iPad), most definetely you will need to define splash screen for specific DPI.
It is pretty simple in Flex all you have to do is create your own preloader and override initialize method.
For mobile there is special class SplashScreen->Sprite which implements IPreloaderDisplay.The most convinent way is to extend this class.
package preloader
{
import mx.core.DPIClassification;
import spark.preloaders.SplashScreen;
import mx.managers.SystemManager;
import mx.utils.DensityUtil;
public class DPIAwarePreloader extends SplashScreen
{
[Embed(source="/../asset/160dpi/splashScreen.png")]
private var splashScreen160dpi : Class;
[Embed(source="/../asset/240dpi/splashScreen.png")]
private var splashScreen240dpi : Class;
[Embed(source="/../asset/320dpi/splashScreen.png")]
private var splashScreen320dpi : Class;
public function DPIAwarePreloader()
{
super();
}
override public function initialize() : void
{
var runtimeDPI : Number = DensityUtil.getRuntimeDPI();
var sysManager : SystemManager =
this.parent.loaderInfo.content as SystemManager;
var splashImage : Class;
switch(runtimeDPI)
{
case DPIClassification.DPI_160:
splashImage = splashScreen160dpi;
break;
case DPIClassification.DPI_240:
splashImage = splashScreen240dpi;
break;
case DPIClassification.DPI_320:
splashImage = splashScreen320dpi;
break;
}
sysManager.info()["splashScreenImage"] = splashImage;
super.initialize();
}
}
}
This will check for runtimeDPI property of your device and set the splash screen designed for specific DPI.
The last step is to add your preloader to the root Application by setting the preloader property in the mxml.
Application DPI
The DPI of the application. By default, this is the DPI of the device that the application is currently running on. When set in MXML, Flex will scale the Application to match its DPI to the runtimeDPI. This property cannot be set by ActionScript code; it must be set in MXML code.
Runtime DPI
The DPI of the device the application is currently running on. Flex rounds the value to one of the DPIClassification choices.
Find out more
DPI and PPI Explained
Building Multi-Density and Multi-Platform UIs with Flex by Narciso (nj) Jaramillo
Optimizing Performance for the ADOBE® FLASH® PLATFORM
DPI Auto Scaling for Density Independent Mobile Apps – Functional and Design Specification
Here is the really simple flex filter editor that can be use as a foundation for exploring filter capabilities in flex.
All of the flex filters are pretty much just a wrappers for filters supported by flash player.And this is simple editor of these wrappers.
Filter editor with source code
Tags: as3, filter editor, flex, flex4