What is Ext-Js(Extended JavaScript)

Ext-JS is a open source JavaScript library for building interactive web applications[2] using techniques such as AJAX, DHTML and DOM scripting.It is easy to use,rich user interface and more it can be a desktop application. It includes:
• High performance, customizable UI widgets
• Well designed and extensible Component model
• An intuitive, easy to use API
• Commercial and Open Source licenses available

Ext-js have a vast range of GUI-based form controls for use within web applications, these contains:
• text field and textarea input
• date fields with a pop-up date-picker
• numeric fields
• list box and comboboxes
• radio and checkbox controls
• html editor control
• grid control
• tree control
• tab panels
• toolbars
• desktop-application-style menus
• region panels to allow a form to be divided into multiple sub-sections
• sliders
Many of these controls are able to communicate with a web server using AJAX.

Files you can need in using Ext
Ext-all.css — A stylesheet file that control the look and feel of Ext widgets.This file must be Included without modification.
Ext-base.js — This provide core functionality of Ext.It is basic machinery of EXT.for using other Library like jquery we need to change this file.
ext-all-debug.js/ext-all.js — All of the widgets live in this files.This is primary ext library file.

It is not a other Java Script library. It can work with other java script libararies by using adapters.For that You need to include adapter file that is exist in adpater folder of Ext sdk.

Default Ext adapter :

 
<script src =”lib/extjs/adapter/ext/ext-base.js”></script>

For jquery include these files in top of your document:

 
<script src =”lib/jquery.js”></script>
<script src =”lib/jquery-plugins.js”></script>
<script src =”lib/extjs/adapter/jquery/ext-jquery-adapter.js”></script>

After including adapters and base libraries we need to include ext-all.js or ext-all-debug.js file.Localization is possible in Ext-js.Only you need to include language file in lib folder.

Common elements in Ext-

Ext.onReady – This function makes sures that our document is ready to be work.It make our code to Wait until the DOM is available.This is needed because javaScript starts executing as soon as it enocuntered in the documents,at which point our DOM might not exist.

Ext.MSg.show – This function for creating the dialog.It will handle all care needed to have dialog. It will create appilication style messages boxes for us.

Ext.get – This function accesses and manipulates elements in the DOM.

Adapter: Files that allows you to use to other java script libraries with Ext-Js.

References : www.extjs.com
kick it on DotNetKicks.com

Shout it

pimp it

Implementation of thread Pool in java

In my previous post of thread pool (https://www.techartifact.com/blogs/2009/06/what-is-thread-pool-in-java.html),I have given the theoritcal knowledge.now I came with code.Hope it will help a lot.
Java’s implementation of thread pool is based on an executor. Executor is a generic concept modeled by this interface.

Package java.util.concurrent;
Public interface Executor {
Public void execute(Runnable task);
}

You simple have to create the task and pass it on execute() method of an appropriate executor.The pool is an instance of ThreadPoolExecutor class.this class implements ExecutorService Interface which tell how to put task and how to shut down.
Example of creation of thread pool

package java.util.concurrent;
public class ThreadPoolExecutor implements ExecutorService {
public ThreadPoolExecutor(int CorePoolSize,int maximumPoolSize,
                           long keepAliveTime,timeUnit unit,
                          BlockingQueue workQueue);
public ThreadPoolExecutor(int CorePoolSize,int maximumPoolSize,
                           long keepAliveTime,timeUnit unit,
                          BlockingQueue workQueue,
                           ThreadFactory threadfactory);
public ThreadPoolExecutor(int CorePoolSize,int maximumPoolSize,
                           long keepAliveTime,timeUnit unit,
                          BlockingQueue workQueue
                          RejectedExecutionHandler handler);
public ThreadPoolExecutor(int CorePoolSize,int maximumPoolSize,
                           long keepAliveTime,timeUnit unit,
                          BlockingQueue workQueue
                          ThreadFactory threadfactory
                           RejectedExecutionHandler handler);

CorePoolSize , keepAliveTime, are the part by which we can manage the thread pool.we can use a constructor to create the task and put them in thread pool

Now we will create the task and we will put into the threadpool.here it’s the example.

import java.util.concurrent.*;
 public class ThreadPoolTest {
public static void main(String[] args) {
int nTask =Integer.parseInt(args[0]);
long n = ling.parseLong(args[1]);
int tpSize =Integer.parseInt(args[2]);

ThreadPoolExecutor tpe = new ThreadPoolExecutor(tpSize,tpSize,50000L,
                             TimeUnit.MILLISECONDS,new LinkedBlockingQueue());
Task[] tasks = new Task[nTask];
for(int i =0;itasks[i]= new Task(n,"Task " + i);
tpe.execute(task[i]);
}
tpe.shutdown();
}
}

This is implementation of thread Pool.It is easy to use.Any suggestion would be welcome.

Pin it

Common terminology used in oracle ADF

Entity object – ADF entity object are business components that encapsulate the business model, including data, rules, and persistence behavior, for items that are used in your application. Entity object definitions map to single objects in the data source. In the vast majority of cases, these are tables, views, synonyms, or snapshots in a database. It can allow to do DML operation. Advanced programmers can base entity objects on objects from other data sources, such as spreadsheets, XML files, or flat text files.

ADF view object – are business components that collect data from the data source.It represent the single table..It can also be used To create LOV. View object must have process for retrieving data from the data source.Data source is database and process is Sql query. Oracle ADF Business Components can automatically use JDBC to pass this query to the database and receive the result. Like entity attributes, the values of view attributes can be read or changed using the methods getAttribute() and setAttribute() in the ViewRowImpl class or by using generated getters and setters in a custom view row class

View Link – is the relation between the view object on based of a some common view attribute of each view object. Individual instances of view objects can also be related by individual instances of view links, which create a master-detail relationship between the query result sets.

ADF Application Module – are business components that represent particular application tasks. The application module definition provides a data model for the task by aggregating
the view object and view link instances required for the task. It also provides services that help the client accomplish the task

You can use application module in two different ways:
• As a service object, in which case each instance of the MVC application has access to one
instance of the application module. These root-level application module instances control ADF
BC transaction objects, which in turn control the entity and view caches.
• As a reusable object for nesting, in which case you can create a data model and service methods
on it and then nest one of its instances in other application module definitions. Those application
module definitions can, in turn, access the nested module’s methods and data model. Nested
application modules share the root-level application module’s transaction.

SetActionListener – The setActionListener tag is a declarative way to allow an action source ( , , etc.) to set a value before navigation. It is perhaps most useful in conjunction with the “processScope” EL scope provided b ADF Faces, as it makes it possible to pass details from one page to another without writing any Java code. This tag can be used both with ADF Faces commands and JSF standard tags.
Exmaple of this can be as follows. Suppose we have a table “employee”.We want to fetch the salary of an employee of some particular row and want to send this salary in
Next page in process scope or request scope etc.So using this we can do this.
It have two attributes :
From – the source of the value; can be an EL expression or a constant value
To – the target for the value; must be an EL expression

 
        <af:setActionListener      from="#{row.salary}"
                                  to="#{processScope.salary1}"/>              

This setactionListener will pick value of salary of that row and store this value into salary1 variable.So anyone can use this salary
As processScope.salary1 . It is very simple to use. And very useful.

References – oracle ADF development guidelines (pdf)
– www.oracle.com