NewDesignerAPI

New Designer API

This document describes suggestion of the new Designer module API. It approaches from the minimalistic version, keeping in mind, that as the implementation will go further, the other methods will be defined and consequently implemented.

Description of the API and Use Cases

  • Creating the component

There should be a factory method which allow to create the Designer component. It will be named DesignerFactory. public Designer createDesigner(BrowserType);
Method creating the Designer instance.

Now the Designer interface.

  • Method to retrieve the component

public JComponent getComponent();

  • Method to create the Document (probably needed to use the Document provided by the individual browser implemenation). Ideally would be if there is also a possibility to pass our Document impl, but that doesn't seem to be the case yet.

public Document createDocument(InputStream);
Note the returned document should be mutable.

  • Methods providing mapping between elements and locations in the component

public Point getLocation(Element);
public Rectangles\ \ getBoxRectangles(Element);
public Element getElementAt(Point);

  • Methods controlling selection

public Element[[ | ]] getSelected();
public void setSelected(Element[[ | ]]);

public void addSelectionListener(SelectionListener);
public void removeSelectionListener(SelectionListener);

TBD Further refinements or possible enhancements will be coming as we will progress in the implementation.

Summary of the API in tables:

DesignerFactory class
Method Name Purpose of the Method
public Designer createDesigner(BrowserType) Factory method creating Designer component instances of specified browser type.


Designer interface
Method Name Purpose of the Method
public JComponent getComponent() Gets Swing component representing the browser component with editing layer on top of it.
public org.w3c.dom.Document createDocument(InputStream) Creates DOM document based on provided input stream. This could be overloaded by other parameters, or also provide other ways how to get to the DOM Document.
public Point getLocation(Element) Gets location of the element on the canvas.
public Rectangle\ \ getBoxRectangles(Element) Gets rectangles of all boxes representing the element.
public Element getElementAt(Point) Gets element located at specified point on canvas.
public Element\ \ getSelected() Gets selected elements.
public void setSelected(Element\ \) Sets selected elements.
public void addSelectionListener(SelectionListener) Adds selection listener. Note the selection listener API needs to be specified or used existing Swing API listener instead.
public void removeSelectionListener(SelectionListener) Removes selection listener. Note the selection listener API needs to be specified or used existing Swing API listener instead.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo