Present by Wu Kun-Tse Simplifying Preference Pages with Field Editors.

Slides:



Advertisements
Similar presentations
HTML Tags and Their Functions
Advertisements

Chapter 3 – Web Design Tables & Page Layout
Introduction to HTML & CSS
Customizing the MOSS 2007 Search Results November 2007 Rafael Perez.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Conversation Form l One path through a use case that emphasizes interactions between an actor and the system l Can show optional and repeated actions l.
Introducing Cascading Style Sheets  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles  Text Formatting with CSS.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
JavaServer Faces. Objectives To implement dynamic web pages with JavaServer Faces (JSF) technology To learn the syntactical elements of JavaServer Faces.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Web Page Development Identify elements of a Web Page Start Notepad
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Preferences in the Eclipse Workbench UI Present by Kun-Tse Wu.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Things to note... The Simple Cart is designed to give users an experience similar to other online shopping sites by separating the cart from the checkout.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Chapter 3 Working with Text and Cascading Style Sheets.
Open source administration software for education next generation student system Using the Kuali Student Configurable User Interaction Model & Framework.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
© Ms. Masihi.  The Dreamweaver Welcome Screen first opens when you start Dreamweaver.  This screen gives you quick access to previously opened files,
Web Technologies Website Development Trade & Industrial Education
1 Understanding Inheritance COSC 156 C++ Programming Lecture 8.
Screen Previews for Shopping Carts and Checkout Process 10.3 release October 05, 2010.
Chapter 8: Writing Graphical User Interfaces
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
Microsoft FrontPage 2003 Illustrated Complete Using a Dynamic Web Template.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Utterly Useless Widget creating your own Chameleon widget...
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Week 11 Creating Framed Layouts Objectives Understand the benefits and drawbacks of frames Understand and use frame syntax Customize frame characteristics.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
Introducing Cascading Style Sheets. Cascading Style Sheet Basics  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
Lesson 2 – Unit B. Quick review 1. What is the name of the eGCC host that you ftp your files? 2. What type of software do you use to create and edit web.
What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language, it is a markup.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
1 Copyright © 2014 Tata Consultancy Services Limited Assessment Knowledge Center – Item Creation Training Document.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML.
Glencoe Introduction to Web Design Chapter 4 XHTML Basics 1 Review Do you remember the vocabulary terms from this chapter? Use the following slides to.
Excel Tutorial 8 Developing an Excel Application
In this session, you will learn to:
Objectives Design a form Create a form Create text fields
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
HTML Forms and User Input
Eclipse Plug-in Development
Using Cascading Style Sheets (CSS)
Web Development Using ASP .NET
How to organize and document your classes
Presentation transcript:

Present by Wu Kun-Tse Simplifying Preference Pages with Field Editors

Outline Introduction When to use field editors (and when not to) Types of field editors How to use field editors Writing your own field editors Conclusion

Introduction A field editor is an object that presents the user with the value of a preference from a preference store. It implements the loading, storing, and validating of its associated value. Instance of FieldEditor are most often used in conjunction with a FieldEditorPreferencePage provides automatic validation handling and displays messages received from its field editors. We will discuss when field editors are most (and least) effective and briefly describe the available types of field editors.

When to use field editors (and when not to) Most of the field editor types supplied by JFace were created to handle simple preference types. Therefore, the simpler your preference page, the more useful field editors will be to you. If your preference page contains one or more complex widgets such as a List or Tree, a regular preference page can be a better solution. As a rule of thumb, use field editors whenever possible, but only use a FieldEditorPreferencePage if all the preference types on a page are supported by field editors or you are willing to write new field editors to support them.

Types of field editors JFace provides nine concrete subclasses of FieldEditor. Each corresponds to a common widget grouping used to present a preference. BooleanFieldEditor – This field editor takes the form of a checkbox with a label. It is used for presenting boolean preferences. IntegerFieldEditor – This field editor takes the form of a label and a text field. It is intended for presenting integers. StringFieldEditor – This field editor is a more general- purpose field editor with simpler validation rules. Normally, any string is valid.

Types of field editors (cont.) RadioGroupFieldEditor – This field editor takes the form of a group label and a set of radio buttons, each with a label of its own. It is used to present a set of mutually exclusive choices. ColorFieldEditor – This field editor is used to present color preference. ColorDialog allows the user to choose another color. FontFieldEditor – This field editor is used to select font preference. FontDialog allows the user to choose a new font, change the font’s style, and change it’s size.

Types of field editors (cont.) DirectoryFieldEditor – This field editor is used to display a directory path in the file system. Clicking on “Browse..” button allows the user to browse the file system and choose a new directory. FileFieldEditor – This field editor is similar to a DirectoryFieldEditor, but it allows the user to select a file instead of a directory. PathFieldEditor – This field editor is the most complex concrete field editor supplied by JFace. It consists of a title label, a list of directory paths, and a button bank to the left of the list with four buttons: “New…”, “Remove”, “Up”, “Down”.

Types of field editors (cont.)

How to use field editors This section will describe two example preference pages which make use of field editors. The two pages store the preferences for a simple HTML editor. The editor has the ability to auto-format HTML, display text in different colors based on context, open a web browser for visually checking HTML files, and perform some minimal error checking. HTMLEditorPlugin.java HTMLPreferencePage.java ErrorPreferencePage.java (ErrorPreferencePage2.java)

Using field editors with a FieldEditorPreferencePage The main preference page for the HTML editor is a subclass of FieldEditorPreferencePage, since all of the preferences on the page are of types supported by field editors. public class HTMLPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { public HTMLPreferencePage() { … } protected void createFieldEditors() { … } public void init(IWorkbench workbench) {} }

HTMLPreferencePage() The constructors for FieldEditorPreferencePage each take as an argument an int representing the layout style of the page. The constant FieldEditorPreferencePage.GRID indicates that the controls of the field editors will be place into a single grid layout. The alternative constant is FieldEditorPreferencePage.FLAT, which indicates that each field editor is handled separately. A subclass of FieldEditorPreferencePage must instantiate and set a preference store for the preference page.

createFieldEditors() In this method, we instantiate all of the field editors on the page, and then add them to the page by calling FieldEditorPreferencePage.addField(FieldEditor). If field editors are instantiated but not added to the preference page, their values will not be saved in the preference store, and will therefore have no effect. A separate call is made to getFieldEditorParent() for each field editor. According to the method’s documentation, a new parent may be created each time the method is called. Caching the value disobeys the method’s contract.

Using field editors with a regular PreferencePage The HTML editor has a secondary page for controlling its error detecting facilities. The are two options: “Don’t show errors” and “Show error if a closing tag is missing”. RadioGroupFieldEditor is suited for this preference. The page also contains a list (a list of HTML tags for which a closing tag is not required), for which there is no suitable field editor, so we will subclass PreferencePage rather than FieldEditorPreferencePage.

Using field editors with a regular PreferencePage In addition to creating the preference store and instantiating field editors, we must write code to load preferences, store preferences, and restore defaults. When using field editors with a regular preference page, you should instantiate them in the createContents(Composite) method. Since we are using a regular preference page, we must also override performOK() and performDefaults(). Subclassing PreferencePage instead of FieldEditorPreferencePage requires more coding, but it allows you to mix field editor with other controls necessary to display all the preference.

Writing your own field editors If none of the concrete FieldEditor subclasses provided by JFace are suitable for your needs, you can always write your own type of field editor. In addition to the concrete subclasses already discussed before, there are two abstract field editors which may be useful: StringButtonFieldEditor – This field editor can be subclassed to produce field editors that consist of a label, a text field, and a button that performs some action. Both DirectoryFieldEditor and FileFieldEditor are subclasses of this class.

Writing your own field editors (cont.) ListEditor – This field editor can be subclassed to produce field editors that consist of a list of items and a button bank (“Add” and “Remove” buttons for adding and removing values, and “Up” and “Down” buttons to adjust the order of elements in the list). If you need a field editor just slightly different from an existing field editor subtype, you can subclass that type. If the field editor you need is not very similar to the subclasses provided by JFace, just subclass FieldEditor.

AddRemoveListFieldEditor For example, we can implement a field editor to replace the list, buttons, and text field in ErrorPreferencePage. When subclassing FieldEditor, there are six abstract methods that must be implemented. doLoad(), doLoadDefault(), doStore() – These are the methods which translate a preference in a preference store. getNumberOfControls() – just returns the highest number of controls that appear on one line in the field editor’s parent composite. adjustForNumColumns(int numColumns) – must ensure that the field editor is displayed correctly if the number of columns in the parent Composite changes after this field editor has been laid out. doFillIntoGrid(Composite parent, int numColumns) – initially lays out the field editor in the given parent Composite.

ErrorPreferencePage2 Now that we have a field editor that stores a list of string and allows the user to add items and remove them, the implementation of our error preference page becomes trivial. ErrorPreferencePage2 extends FieldEditorPreferencePage instead of PreferencePage and uses AddRemoveListFieldEditor to re-implement ErrorPreferencePage.

Conclusion This article has familiarized you with the different types of field editors and demonstrated their use. It has explained how field editors work so you can safely write your own. We encourage the use of field editors, and hope the knowledge provided by this article will help you easily implement cleaner preference pages for your plugins.

Reference From: Editors/field_editors.htmlhttp:// Editors/field_editors.html Source Code: field_editors.zipfield_editors.zip