User Interface Specification:
JDK 1.5 Support

Author: Gabriel Tichy
$Revision: 1.8 $
Table of Contents:

  • 5 Issues

  • 1 Introduction

    JDK 1.5 introduces several extensions to the Java programming language:

    • Autoboxing/unboxing
    • Extended for Loop
    • Typesafe Enums
    • Static import
    • Variable arity methods (Varargs)
    • Program Annotation Facility (Metadata)
    • Generics

    1.1 References

    Summary of new Java language features is described in J2SE 1.5.0 - Summary of New Features and Enhancements.

    Features covered in this specification:

    • Generics - allows to abstract over types. This enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting. Refer to JSR 14.
    • Enums - flexible object-oriented enumerated type facility allows to create enumerated types with arbitrary methods and fields. Refer to JSR 201.
    • Varargs - this facility eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists. Refer to JSR 201.
    • Metadata - this facility allows classes, interfaces, fields, and methods to be marked as having particular attributes. Refer to JSR 175.

    1.2 Design Assumptions

    Goal of preliminary 1.5 support is to extend current IDE features so they are compliant with the new Java 1.5 extensions.

    Additionally, some of the involved features don't follow current UI principles, therefore the design should cover also this issue, at least partially. Basically, it concers mainly the dialog layouts.

    2 System-Wide UI Impact

    2.1 Overview of changes

    • Source Hierarchy: Java Elements nodes representation
    • Customizers and Properties of Java Elements nodes
    • Add New Method/Constructor, Add New Field, Add New Inner Class/Interface dialogs
    See detailed specification for actual changes.

    3 Detailed Specification

    3.1 Generics

    3.1.1 Display Name Format of Java Elements

    Default format of display name of all elements remains unchanged. However, tooltip and status area for these nodes should contain new full declaration header, i.e:
    • Class contains also optional Type Parameters section
    • Method contains also optional Type Parameters section
    3.1.1.1 Configuring Format
    Display Name format can be configured in Tools -> Options -> IDE Configuration -> Look and Feel -> specific Java Element node, using the plain text and defined substitution codes.

    Table of substitution codes should have also code for Type Parameters section:

    Substitution Code   Information Substituted
    ------------------------------------------------------------------
    {T}                 Type Parameters (for classed and methods only)
    

    3.1.2 (Inner) Class/Interface Node

    3.1.2.1 Customizer
    Customizer contains components for declaring the class header. It needs to be extended for a new optional Type Parameters section.

    New components of the dialog are:

    • Type Parameters textfield - user needs to write full type parameters section manually, i.e. also with consecutive type parameter brackets < >
    Components removed:
    • Type radiobutton group: read-only radio buttons Class & Interface.
    3.1.2.2 Properties
    Current properties remain unchanged. Following properties are added:
    • Type Parameters - a string property that lets the user specify the type parameters. Tooltip: Type parameters of this class.
    3.1.2.3 Action: New Method

    New Method dialog contains components for declaring the method header. It needs to be extended for a new optional Type Parameters section.

    New components of the dialog are:

    • Type Parameters textfield: user needs to write full type parameters section manually, i.e. also with consecutive type parameter brackets < >
    3.1.2.4 Action: New Field
    Dialog design follows the layout used in previous dialogs.

    3.1.2.5 Action: New Constructor

    Dialog design follows the layout used in previous dialogs.

    3.1.2.6 Action: New Inner Class

    Uses the same panel as customizer for Inner Class.

    3.1.2.7 Action: New Inner Interface

    Uses same panel as customizer for Inner Interface.

    3.1.3 Field Node

    3.1.3.1 Customizer
    Uses same panel as described in section 3.1.2.4
    Dialog title: Customize Field.
    3.1.3.2 Properties
    No properties are added.

    3.1.4 Constructor Node

    3.1.4.1 Customizer
    Uses same panel as described in section 3.1.2.5
    Dialog title: Customize Constructor.
    3.1.4.2 Properties
    Current properties remain unchanged. Following properties are added:
    • Type Parameters - a string property that lets the user specify the type parameters. Tooltip: Type parameters of this constructor.

    3.1.5 Method Node

    3.1.5.1 Customizer
    Uses same panel as described in section 3.1.2.3.
    Dialog title: Customize Method.
    3.1.5.2 Properties
    Current properties remain unchanged. Following properties are added:
    • Type Parameters - a string property that lets the user specify the type parameters. Tooltip: Type parameters of this method.

    3.2 Enums

    Enum is a new type of class. Enum declaration is permitted wherever a class declaration is now permitted, and it declares an enum class with the same visibility as a class declaration at the same point with the same access modifiers.

    3.2.1 Display Name Format of Enums

    3.2.1.1 Configuring Format
    Enums format should be configured in Tools -> Options -> IDE Configuration -> Look and Feel -> Enums property.
    3.2.1.2 Default Format
    enum {n}

    3.2.1 Enum Node

    3.2.1.1 Appearance
    • Icon: uses a new icon, similar to Class icon.
    • Display Name Format: uses the Enums format.
    3.2.1.2 Subnodes
    Enum node has following subnodes:
    • Constants
    • Fields
    • Constructors
    • Methods
    • individual Inner Classes and Inner Interfaces

    Unlike Class, it doesn't contain Bean Patterns node.

    3.2.1.3 Actions
    It contains the same actions as normal Class node.

    Additionally, it has the action for creating a new enum Constant: New Constant...
    Dialog contains only Name textfield.
    Title of the dialog: New Constant.

    3.2.1.4 Customizer

    Enum has no superclass and no type parameters.

    3.2.1.5 Properties
    It has the same properties as Class except Super Class and Type Parameters.

    3.2.2 Constants Node

    Node contains all defined enum constants, similarly as the Fields node.

    3.3 Varargs

    Varargs don't need any special handling. In corresponding dialogs, when user is editing parameters of a variable arity method or constructor, she needs to put the last variable arity parameter with an elipsis following the type.

    3.4 Metadata

    Program Annotation Facility introduces following concepts:

    Annotation Type

    • like interface: declaration with @interface
    • cannot extend other types, cannot be parametrized (generics)
    • contains members: methods
    • members can specify their default value
    • methods must not have parameters and type parameters (generics)
    • methods return types: primitive types, Class, String, enum, annotation type, array of preceding types
    • same namespace like interface
    • methods inherited from java.lang.annotation.Annotation are not members; it is illegal to use them
    Annotation
    • is a kind of new modifier
    • may be used as modifiers in any declaration: class, interface, field, method, parameter, constructor, enum, or local variable. Annotations may also be used on enum constants (which are implicit field declarations). Such annotations are placed immediately before the enum constant they annotate.
    • may be used on package declarations, with the restriction that at most one annotated package declaration is permitted for a given package
    • they may be freely intermixed with other modifiers
    • 3 kinds of annotation: normal, marker, single member
    Meta Annotation Type
    • used to annotate annotation type declarations

    3.4.1 Annotation Type Node

    3.2.1.1 Appearance
    • Icon: uses a new icon.
    • Display Name Format: uses the @interface format.
    3.2.1.2 Subnodes
    Annotation Type can contain the same subnodes as Class/Interface.
    3.2.1.3 New Annotation Type
    All Java Elements contains new action New->Annotation Type... New Annotation Type dialog contains components for declaring annotation type.

    Components of the dialog are:

    • Name textfield: annotation type identifier
    • Access combobox: possible access
    • Modifiers panel: possible interface modifiers
    3.2.1.4 New Method
    New Method dialog has Type Parameters and Parameters components disabled.
    3.2.1.5 Properties
    It has the same properties as Class except Extends, Implements and Type Parameters.

    3.4.2 Annotations

    Annotations may be used as modifiers in any Java element declaration (class, interface, method, field, enum, annotation type), therefore Modifiers section in these panels should be extended by Anntation textfield declaring the annotation:

    If user forget to write @ token, IDE should put it by default in the code. Annotation property displays annotations also with the @ token.

    3.4.3 Syntax Coloring

    Fonts and Colors editor (for Java) should contain new syntax item, which colorizes @ (at-sign) token both in annotation type declaration and in annotation.
    • Name: Java Annotation
    • Foreground Color: [0, 111, 0]
    • Background Color: Inherit
    • Font: Inherit

    4 Graphics

    4.1 Icons

    Description Icon
    Enum node
    Constant node
    Constants node
    Annotation Type node

    5 Issues

    5.1 Customizers & Properties

    As it is not possible to merge Refactoring functionality with Java elements customizers (i.e. Change Method Signature), it is probably obsolete to use these customizers.

    Specific properties for Java elements need to be readonly then.

    5.2 List features that will be implemented in next versions (after promo-D)

    • Annotations textfield.
    • Type Parameters textfields.
    • Type Parameters property will be disabled for now.

    Project Features

    About this Project

    ui was started in November 2009, is owned by Jiří Kovalský, and has 43 members.
    By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
     
     
    Close
    loading
    Please Confirm
    Close