際際滷

際際滷Share a Scribd company logo
Rahul Shukla
 When our table contains large data then we
usually prefer Virtual Table Tree .
 It creates table items on demand.
 Faster in case of large data .
public class VirtualTableViewer {
public VirtualTableViewer(Shell shell) {
final TableViewer v = new TableViewer(shell,SWT.VIRTUAL);
v.setLabelProvider(new LabelProvider());
v.setContentProvider(new ArrayContentProvider());
v.setUseHashlookup(true);
v.setInput(createModel());
v.getTable().setLinesVisible(true);
}
private String[] createModel() {
String[] elements = new String[1000000];
for (int i = 0; i < 1000000; i++) {
elements[i] = "Item" + i;
}
return elements;
}
 When we want lazy loading of data
 It Loads the data when it is required
 In TeamCenter our all Tree are Lazy Tree
 Create Item Virtually
public class VirtualLazyTableViewer {
private class MyContentProvider implements ILazyContentProvider {
private TableViewer viewer;
private String[] elements;
public MyContentProvider(TableViewer viewer) {
this.viewer = viewer;}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.elements = (String[]) newInput;}
public void updateElement(int index) {
viewer.replace(elements[index], index);}}
public VirtualLazyTableViewer(Shell shell) {
final TableViewer v = new TableViewer(shell, SWT.VIRTUAL);
v.setLabelProvider(new LabelProvider());
v.setContentProvider(new MyContentProvider(v));
v.setUseHashlookup(true);
String[] model = createModel();
v.setInput(createModel());
v.setItemCount(model.length); // This is the difference when using a
ILazyContentProvider
v.getTable().setLinesVisible(true);}
private String[] createModel() {
String[] elements = new String[10000];
for (int i = 0; i < 10000; i++) {elements[i] = "Item"+i;}
return elements;}
}
 Dialog
 A dialog is a specialized window used for narrow-focused communication with the user.
 Dialogs are usually modal. Consequently, it is generally bad practice to open a dialog without a
parent. A modal dialog without a parent is not prevented from disappearing behind the
application's other windows, making it very confusing for the user.
 If there is more than one modal dialog is open the second one should be parented off of the
shell of the first one otherwise it is possible that the OS will give focus to the first dialog
potentially blocking the UI.
 TrayDialog
 A TrayDialog is a specialized Dialog that can contain a tray on its side. The tray's content
is provided as a DialogTray. It is recommended to subclass this class instead of Dialog in
all cases except where the dialog should never show a tray. For example, dialogs which
are very short, simple, and quick to dismiss (e.g. a message dialog with an OK button)
should subclass Dialog.
 TitleAreaDialog
 A dialog for showing messages to the user. This concrete dialog class can be instantiated
as is, or further subclassed as required.
 Simple Dialog
 TitleAreaDialog
 Confirmation Dialog
 boolean openConfirm =
MessageDialog.openConfirm(getShell(), "Confirm Dialog",
"Do You want To Continue");
 Error Dialog
 MessageDialog.openError(getShell(), "Error Dialog",
"Error Occured");
 Warning Dialog
 MessageDialog.openWarning(getShell(), "Warning Dialog",
"Doc is not given");
 protected Control createDialogArea(Composite parent) {
 Creates and returns the contents of the upper part of this dialog (above the button bar). The
Dialog implementation of this framework method creates and returns a new
Composite with standard margins and spacing. The returned control's layout
data must be an instance of GridData. This method must not modify the
parent's layout. Subclasses must override this method but may call super as
in the following example:
 protected Button createButton(Composite parent, int id, String label,boolean
defaultButton)
 Creates a new button with the given id.
 The Dialog implementation of this framework method creates a standard push button, registers it
for selection events including button presses, and registers default buttons with its shell. The
button id is stored as the button's client data. If the button id is IDialogConstants.CANCEL_ID,
the new button will be accessible from getCancelButton(). If the button id is
IDialogConstants.OK_ID, the new button will be accesible from getOKButton(). Note that the
parent's layout is assumed to be a GridLayout and the number of columns in this layout is
incremented. Subclasses may override.
 protected Control createButtonBar(Composite parent) {
 Creates and returns the contents of this dialog's button bar.
 The Dialog implementation of this framework method lays out a button bar
and calls the createButtonsForButtonBar framework method to populate it.
Subclasses may override.
 The returned control's layout data must be an instance of GridData.
 protected void createButtonsForButtonBar(Composite parent) {
 Adds buttons to this dialog's button bar.
 The Dialog implementation of this framework method adds standard ok and
cancel buttons using the createButton framework method. These standard
buttons will be accessible from getCancelButton, and getOKButton.
Subclasses may override.
 A dialog to show a wizard to the end user.
 In typical usage, the client instantiates this class with a particular wizard.
The dialog serves as the wizard container and orchestrates the
presentation of its pages.
 The standard layout is roughly as follows: it has an area at the top
containing both the wizard's title, description, and image; the actual
wizard page appears in the middle; below that is a progress indicator
(which is made visible if needed); and at the bottom of the page is
message line and a button bar containing Help, Next, Back, Finish, and
Cancel buttons (or some subset).
 Clients may subclass WizardDialog, although this is rarely required.
public class WizardExamle extends Wizard {
@Override
public boolean performFinish() {
// TODO Auto-generated method stub
return false;
}
@Override
public void addPages() {
addPage(new WizardPage1("Page 1"));
addPage(new WizardPage2("Page2"));
super.addPages();
}
@Override
public boolean performCancel() {
return super.performCancel();
}
@Override
public boolean canFinish() {
return super.canFinish();
}
}
 public class WizardPage2 extends WizardPage {
 protected WizardPage2(String pageName) {
 super(pageName);
 setTitle(pageName);
 }
 @Override
 public void createControl(Composite parent) {
 setControl(new Composite(parent, SWT.NONE));
 setPageComplete(false);
 }
 @Override
 public boolean isPageComplete() {
 return super.isPageComplete();
 }
 @Override
 public boolean canFlipToNextPage() {
 return super.canFlipToNextPage();
 }
Ad

Recommended

Java Swing JFC
Java Swing JFC
Sunil OS
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter component
Katy Slemon
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
SaraswathiRamalingam
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Fr辿d辿ric Harper
Progress Dialog, AlertDialog, CustomDialog
Progress Dialog, AlertDialog, CustomDialog
Sourabh Sahu
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892
renuka gavli
The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.5.3 book - Part 81 of 184
Mahmoud Samir Fayed
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
Russ Weakley
Sql server column level encryption
Sql server column level encryption
muhammadhashir57
Java script frame window
Java script frame window
H K
swingbasics
swingbasics
Arjun Shanka
JAVA GUI PART I
JAVA GUI PART I
OXUS 20
AWT Packages , Containers and Components
AWT Packages , Containers and Components
Sohanur63
Java GUI PART II
Java GUI PART II
OXUS 20
Lenguaje de programaci坦n
Lenguaje de programaci坦n
lhaylha moran
Lenguaje de programaci坦n
Lenguaje de programaci坦n
aldair fernandez
Popup view on Mortar
Popup view on Mortar
Keishin Yokomaku
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
Dr. Ramkumar Lakshminarayanan
Complete java swing
Complete java swing
jehan1987
Jeank
Jeank
zurisadai zu単iga knight
Java swing
Java swing
Nataraj Dg
SQL express course for begginers
SQL express course for begginers
Dmytro Hvozdov
Booa8 際際滷 11
Booa8 際際滷 11
oswchavez
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Darwin Durand
Introj Query Pt2
Introj Query Pt2
kshyju
Android UI Reference
Android UI Reference
GauntFace
Graphical User Interface in JAVA
Graphical User Interface in JAVA
suraj pandey
Intro to Google TV
Intro to Google TV
GauntFace
Android basics dialogs and floating activities
Android basics dialogs and floating activities
info_zybotech
Documentation For Tab Setup
Documentation For Tab Setup
vkeeton

More Related Content

What's hot (20)

Sql server column level encryption
Sql server column level encryption
muhammadhashir57
Java script frame window
Java script frame window
H K
swingbasics
swingbasics
Arjun Shanka
JAVA GUI PART I
JAVA GUI PART I
OXUS 20
AWT Packages , Containers and Components
AWT Packages , Containers and Components
Sohanur63
Java GUI PART II
Java GUI PART II
OXUS 20
Lenguaje de programaci坦n
Lenguaje de programaci坦n
lhaylha moran
Lenguaje de programaci坦n
Lenguaje de programaci坦n
aldair fernandez
Popup view on Mortar
Popup view on Mortar
Keishin Yokomaku
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
Dr. Ramkumar Lakshminarayanan
Complete java swing
Complete java swing
jehan1987
Jeank
Jeank
zurisadai zu単iga knight
Java swing
Java swing
Nataraj Dg
SQL express course for begginers
SQL express course for begginers
Dmytro Hvozdov
Booa8 際際滷 11
Booa8 際際滷 11
oswchavez
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Darwin Durand
Introj Query Pt2
Introj Query Pt2
kshyju
Android UI Reference
Android UI Reference
GauntFace
Graphical User Interface in JAVA
Graphical User Interface in JAVA
suraj pandey
Intro to Google TV
Intro to Google TV
GauntFace
Sql server column level encryption
Sql server column level encryption
muhammadhashir57
Java script frame window
Java script frame window
H K
JAVA GUI PART I
JAVA GUI PART I
OXUS 20
AWT Packages , Containers and Components
AWT Packages , Containers and Components
Sohanur63
Java GUI PART II
Java GUI PART II
OXUS 20
Lenguaje de programaci坦n
Lenguaje de programaci坦n
lhaylha moran
Lenguaje de programaci坦n
Lenguaje de programaci坦n
aldair fernandez
Complete java swing
Complete java swing
jehan1987
SQL express course for begginers
SQL express course for begginers
Dmytro Hvozdov
Booa8 際際滷 11
Booa8 際際滷 11
oswchavez
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Darwin Durand
Introj Query Pt2
Introj Query Pt2
kshyju
Android UI Reference
Android UI Reference
GauntFace
Graphical User Interface in JAVA
Graphical User Interface in JAVA
suraj pandey
Intro to Google TV
Intro to Google TV
GauntFace

Similar to Advance JFACE (20)

Android basics dialogs and floating activities
Android basics dialogs and floating activities
info_zybotech
Documentation For Tab Setup
Documentation For Tab Setup
vkeeton
Java_gui_with_AWT_and_its_components.ppt
Java_gui_with_AWT_and_its_components.ppt
JyothiAmpally
Eclipse Tricks
Eclipse Tricks
Kaniska Mandal
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
suraj pandey
The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180
Mahmoud Samir Fayed
UNIT-2-AJAVA.pdf
UNIT-2-AJAVA.pdf
PriyanshiPrajapati27
Abstract Window Toolkit
Abstract Window Toolkit
RutvaThakkar1
Dojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
Dojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
GWT training session 2
GWT training session 2
SNEHAL MASNE
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
David Voyles
Android sql examples
Android sql examples
Aravindharamanan S
Intake 38 9
Intake 38 9
Mahmoud Ouf
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
Katy Slemon
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)
iFour Technolab Pvt. Ltd.
Ingles 2do parcial
Ingles 2do parcial
Harry Ostaiza
Creating GUI.pptx Gui graphical user interface
Creating GUI.pptx Gui graphical user interface
pikachu02434
The Ring programming language version 1.9 book - Part 82 of 210
The Ring programming language version 1.9 book - Part 82 of 210
Mahmoud Samir Fayed
Csphtp1 12
Csphtp1 12
HUST
Android basics dialogs and floating activities
Android basics dialogs and floating activities
info_zybotech
Documentation For Tab Setup
Documentation For Tab Setup
vkeeton
Java_gui_with_AWT_and_its_components.ppt
Java_gui_with_AWT_and_its_components.ppt
JyothiAmpally
Basic of Abstract Window Toolkit(AWT) in Java
Basic of Abstract Window Toolkit(AWT) in Java
suraj pandey
The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180
Mahmoud Samir Fayed
Abstract Window Toolkit
Abstract Window Toolkit
RutvaThakkar1
Dojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
Dojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
GWT training session 2
GWT training session 2
SNEHAL MASNE
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
David Voyles
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
Katy Slemon
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)
iFour Technolab Pvt. Ltd.
Ingles 2do parcial
Ingles 2do parcial
Harry Ostaiza
Creating GUI.pptx Gui graphical user interface
Creating GUI.pptx Gui graphical user interface
pikachu02434
The Ring programming language version 1.9 book - Part 82 of 210
The Ring programming language version 1.9 book - Part 82 of 210
Mahmoud Samir Fayed
Csphtp1 12
Csphtp1 12
HUST
Ad

More from Rahul Shukla (6)

intro-kafka
intro-kafka
Rahul Shukla
Akka (1)
Akka (1)
Rahul Shukla
Advance RCP
Advance RCP
Rahul Shukla
Jface
Jface
Rahul Shukla
Introduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_Shukla
Rahul Shukla
Eclipse_Building_Blocks
Eclipse_Building_Blocks
Rahul Shukla
Introduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_Shukla
Rahul Shukla
Eclipse_Building_Blocks
Eclipse_Building_Blocks
Rahul Shukla
Ad

Advance JFACE

  • 2. When our table contains large data then we usually prefer Virtual Table Tree . It creates table items on demand. Faster in case of large data .
  • 3. public class VirtualTableViewer { public VirtualTableViewer(Shell shell) { final TableViewer v = new TableViewer(shell,SWT.VIRTUAL); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new ArrayContentProvider()); v.setUseHashlookup(true); v.setInput(createModel()); v.getTable().setLinesVisible(true); } private String[] createModel() { String[] elements = new String[1000000]; for (int i = 0; i < 1000000; i++) { elements[i] = "Item" + i; } return elements; }
  • 4. When we want lazy loading of data It Loads the data when it is required In TeamCenter our all Tree are Lazy Tree Create Item Virtually
  • 5. public class VirtualLazyTableViewer { private class MyContentProvider implements ILazyContentProvider { private TableViewer viewer; private String[] elements; public MyContentProvider(TableViewer viewer) { this.viewer = viewer;} public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { this.elements = (String[]) newInput;} public void updateElement(int index) { viewer.replace(elements[index], index);}} public VirtualLazyTableViewer(Shell shell) { final TableViewer v = new TableViewer(shell, SWT.VIRTUAL); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new MyContentProvider(v)); v.setUseHashlookup(true); String[] model = createModel(); v.setInput(createModel()); v.setItemCount(model.length); // This is the difference when using a ILazyContentProvider v.getTable().setLinesVisible(true);} private String[] createModel() { String[] elements = new String[10000]; for (int i = 0; i < 10000; i++) {elements[i] = "Item"+i;} return elements;} }
  • 6. Dialog A dialog is a specialized window used for narrow-focused communication with the user. Dialogs are usually modal. Consequently, it is generally bad practice to open a dialog without a parent. A modal dialog without a parent is not prevented from disappearing behind the application's other windows, making it very confusing for the user. If there is more than one modal dialog is open the second one should be parented off of the shell of the first one otherwise it is possible that the OS will give focus to the first dialog potentially blocking the UI. TrayDialog A TrayDialog is a specialized Dialog that can contain a tray on its side. The tray's content is provided as a DialogTray. It is recommended to subclass this class instead of Dialog in all cases except where the dialog should never show a tray. For example, dialogs which are very short, simple, and quick to dismiss (e.g. a message dialog with an OK button) should subclass Dialog. TitleAreaDialog A dialog for showing messages to the user. This concrete dialog class can be instantiated as is, or further subclassed as required.
  • 7. Simple Dialog TitleAreaDialog
  • 8. Confirmation Dialog boolean openConfirm = MessageDialog.openConfirm(getShell(), "Confirm Dialog", "Do You want To Continue"); Error Dialog MessageDialog.openError(getShell(), "Error Dialog", "Error Occured"); Warning Dialog MessageDialog.openWarning(getShell(), "Warning Dialog", "Doc is not given");
  • 9. protected Control createDialogArea(Composite parent) { Creates and returns the contents of the upper part of this dialog (above the button bar). The Dialog implementation of this framework method creates and returns a new Composite with standard margins and spacing. The returned control's layout data must be an instance of GridData. This method must not modify the parent's layout. Subclasses must override this method but may call super as in the following example: protected Button createButton(Composite parent, int id, String label,boolean defaultButton) Creates a new button with the given id. The Dialog implementation of this framework method creates a standard push button, registers it for selection events including button presses, and registers default buttons with its shell. The button id is stored as the button's client data. If the button id is IDialogConstants.CANCEL_ID, the new button will be accessible from getCancelButton(). If the button id is IDialogConstants.OK_ID, the new button will be accesible from getOKButton(). Note that the parent's layout is assumed to be a GridLayout and the number of columns in this layout is incremented. Subclasses may override.
  • 10. protected Control createButtonBar(Composite parent) { Creates and returns the contents of this dialog's button bar. The Dialog implementation of this framework method lays out a button bar and calls the createButtonsForButtonBar framework method to populate it. Subclasses may override. The returned control's layout data must be an instance of GridData. protected void createButtonsForButtonBar(Composite parent) { Adds buttons to this dialog's button bar. The Dialog implementation of this framework method adds standard ok and cancel buttons using the createButton framework method. These standard buttons will be accessible from getCancelButton, and getOKButton. Subclasses may override.
  • 11. A dialog to show a wizard to the end user. In typical usage, the client instantiates this class with a particular wizard. The dialog serves as the wizard container and orchestrates the presentation of its pages. The standard layout is roughly as follows: it has an area at the top containing both the wizard's title, description, and image; the actual wizard page appears in the middle; below that is a progress indicator (which is made visible if needed); and at the bottom of the page is message line and a button bar containing Help, Next, Back, Finish, and Cancel buttons (or some subset). Clients may subclass WizardDialog, although this is rarely required.
  • 12. public class WizardExamle extends Wizard { @Override public boolean performFinish() { // TODO Auto-generated method stub return false; } @Override public void addPages() { addPage(new WizardPage1("Page 1")); addPage(new WizardPage2("Page2")); super.addPages(); } @Override public boolean performCancel() { return super.performCancel(); } @Override public boolean canFinish() { return super.canFinish(); } }
  • 13. public class WizardPage2 extends WizardPage { protected WizardPage2(String pageName) { super(pageName); setTitle(pageName); } @Override public void createControl(Composite parent) { setControl(new Composite(parent, SWT.NONE)); setPageComplete(false); } @Override public boolean isPageComplete() { return super.isPageComplete(); } @Override public boolean canFlipToNextPage() { return super.canFlipToNextPage(); }