History log of /sdk/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java
Revision Date Author Comments
13a9256cbb601228887eea910ce1dbd68a776b17 17-Dec-2012 Tor Norbye <tnorbye@google.com> Use the SDK common XmlPrettyPrinter

The XML pretty printer was moved up from the Eclipse plugin
into common (such that for example the resource merger can
use it).

This CL removes the old XML pretty printer and replaces it
by a subclass which customizes the formatter slightly (in
particular, taking advantage of the Eclipse DOM's ability
to remember whether an XML tag was an empty tag such at
<this/> rather than <this></this>.)

Change-Id: Ie0865c3c35f1340fa4dcaf42253599f278ce4997
12d4581faa6438941e65a9dc83213be34c6ca970 13-Sep-2012 Tor Norbye <tnorbye@google.com> Constants refactoring.

This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).

Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.

Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
0cb8e647ef345f5c2a6b7eb08b517421131bca4e 07-Aug-2012 Tor Norbye <tnorbye@google.com> Improvements to relative layout move and delete operations

This changeset improves the way the RelativeLayout editing support in
the layout editor handles deletions and moves.

First, during a move, if the move is simply within the same layout,
then the layout constraints are left alone such that if you for
example have

A
v
B < C < D

and you move B up to be next to A, you end up with

A < B < C < D

(It will however remove cycles if the move would result in them.)

Second, it now handles deletion better where deleting a view will
cause all references to any deleted views to be replaced by transitive
constraints.

For example, if you hve

A < B < C < D

and you delete B and C, you end up with

A < D

Change-Id: Icb9d3552e60aee20192f7941fe52be71ba52557f
fb6d52d71a7461cb1ac4149f4f71d6a63e7436da 04-Apr-2012 Tor Norbye <tnorbye@google.com> GridLayout support work

Lots of miscellaneous fixes to the GridLayout support in ADT. The
changes include using the GridLayout state (via reflection) to
populate the model; caching the grid model for performance, and a
bunch of fixes to the code which handles insertions and
removals. There are also some new unit tests. This is not done, but is
an improvement over the current state.

Change-Id: I4851153d3e409630c2d2024c4894d1ad1535fb47
7e4b8e9d595e45baa9d87cdb8282f02759e73abc 30-May-2012 Tor Norbye <tnorbye@google.com> Fix nullness annotations

Eclipse 4.2 includes analysis support for @Nullable and @NonNull
annotations. However, it requires these annotations to be *repeated*
on every single method implementing or overriding a superclass or
interface method (!).

This changeset basically applies the quickfixes to inline these
annotations. It also changes the retention of our nullness
annotations from source to class, since without this Eclipse believes
that a @NonNull annotation downstream is a redefinition of a @Nullable
annotation.

Finally, the null analysis revealed a dozen or so places where the
nullness annotation was either wrong, or some null checking on
parameters or return values needed to be done.

Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
a881b0b34678ad76c9f5eba62fac7a00a22ac606 20-May-2012 Tor Norbye <tnorbye@google.com> Move XML code to the common library

The ManifestMerger library needs to look up the prefix to use for the
Android namespace, and the Document.lookupPrefix method is not
implemented by the Eclipse DOM implementation (which throws an
exception). However, we have an implementation of this in the ADT
plugin.

This changeset creates a new XmlUtils class in the common/ library
(which is accessible by both ADT and the manifest merger, and the
anttasks where the manifest merger is used), and moves the namespace
prefix lookup code in there. It also moves the XML escape methods
into that class. It also adds a new method to the ManifestMerger for
merging directly from documents (rather than files), and makes sure
that all the merging code goes via the prefix utility method rather
than calling the document.lookupPrefix method.

Finally, it moves the various string constants associated with XML
namespaces into the single XmlUtils class, since these were spread
across several different classes before (and many of them are needed
in the XmlUtils class).

The vast majority of the diffs in this changeset are related to simple
import statement changes to reflect the new locations of these
constants.

Change-Id: Ib8f3d0e5c89e47e61ea509a23925af7b6580abee
ab36f4e7488358dea4ab6b54ee2b7bef3da0232b 21-Dec-2011 Tor Norbye <tnorbye@google.com> Update SDK codebase to JDK 6

This changeset makes the SDK codebase compile with source=1.6 (which
means it also requires JDK 6). This means that methods implementing an
interface requires @Override's. It also means we can start using APIs
like the ArrayDeque class and methods like String#isEmpty().

This changeset looks big but the change is trivial: it's basically
adding @Override in all the places that need it, along with some other
automatic Eclipse cleanup in certain files (such as reordering imports
where they were incorrectly ordered (because older versions of Eclipse
didn't always handle inner classes right)), as well as cleaning up
trailing whitespace and removing some $NON-NLS-1$ markers on lines
where there aren't any string literals anymore.

This changeset also sets the source and target JDK level to 6 in the
Eclipse compiler .settings file, and synchronizes this file to all the
other Eclipse SDK projects.

Change-Id: I6a9585aa44c3dee9a5c00739ab22fbdbcb9f8275
e287bc8580e19d72a911615475b353790cf000eb 16-Aug-2011 Tor Norbye <tnorbye@google.com> Layout editor property menu improvements

This changeset adds two forms of view attribute metadata:
* First, it records the most commonly used attributes for each
view. This was determined by gathering statistics on as many layout
files as I could find and then picking those that are used 10% or
more.

* Second, it records in the attribute metadata which View defines a
given attribute.

The context menu uses the above information to present the available
attributes in several ways:

* In the top level menu, where we had "Edit ID", and if applicable
"Edit Text", it now lists the top attributes instead. For example,
for a RatingBar the first handful of menu options are "Edit ID...",
"Edit NumStars...", "Edit StepSize...", "Edit Style..." and
"IsIndicator" (a boolean pull-right menu).

Incidentally this automatically handles some cases which were
manually handled before, so the code in LinearLayoutRule to add an
"Orientation" menu is no longer needed; it's just one of the two
common attributes handled by the new attribute list.

* The "Properties" menu is now called "Other Properties", and instead
of showing all properties, it has a new level of menus:

* "Recent". This is initially empty, but as you edit other attributes,
it gets populated (in most recently used order, kept up to date)
with recently edited properties.

* One submenu for each defining View super class listing exactly
the attributes defined by that view. This is useful for browsing
and editing related attributes. If you are looking at a textual
view like a Button for example, you can look at the "TextView"
menu to find all the text related options (TextColor, TextSize,
etc). These menus are listed from the nearest to the further
superclass, so for example if you right click on a CalendarView
you'll see these menus:

Recent >
----------------------------
Defined by CalendarView >
Inherited from FrameLayout >
Inherited from ViewGroup >
Inherited from View >
----------------------------
Layout Parameters >
----------------------------
All By Name >

* As you can see from the above, there are two more menus below the
inherited menu items. "Layout Parameters" lists all the layout
parameters available for the selected nodes (which is defined not
by the view itself but the view that it is contained within). And
finally there is "All By Name", which is a complete menu
containing all available attributes for the view (and this is what
the Properties menu used to contain).

* The code which computes a display name from an attribute was also
tweaked to capitalize not just the first letter but any first word
letter, so for example when you look at the possible values for
Gravity you now see "Clip Vertical" instead of "Clip vertical".

* The edit property dialog for the properties menus now uses @string
or @style resource choosers for the text, hint and style attributes
(used to just be a plain text box.)

Change-Id: I3b30d48b85fd13f0190c760756bf383a47b3f4a5
80d9301c2e874b29889c41adb0623666cf534fa0 10-Apr-2011 Tor Norbye <tnorbye@google.com> Resize & Guideline Support

RelativeLayout now has both drop/move and resize guidelines, and
existing constraints are visualized for the selection.

LinearLayout resizing now uses weights to change the size of nodes
rather than setting width/height.

All resize operations offer guidelines to snap to their "wrap_content"
size.

Various bug fixes in related areas as well.

Change-Id: I817e34c6e67ce61cfb137eb067076d91f69f99e9
adee9788a5ac646a39b516abe4cdd1022911a3f5 09-Mar-2011 Tor Norbye <tnorbye@google.com> Add drop-support for include tags

Add the include tag back into the palette, and add special drop
support for it such that when it is drop, a resource chooser pops up
and asks you which layout to include. A new validator prevents any
layouts from being chosen that would result in a cyclic
dependency.

This requires some infrastructure changes: First, drop handlers must
distinguish between a view getting created as part of a previewing
operation and getting created interactively. Second, in order to
support cancel removing an inserted include if the user decides not to
set an include, the node wrappers need to support removing an element.
Also, use the metadata originally intended for the preview icon
factory to also bypass palette drag previews for widgets that don't
have UI.

Change-Id: I1bdd1766ca4cfa2fdbca25b77c50c74e9c332cbd
bfcbad18934be1f51ae03d4b6255cfe2d7239aaf 24-Nov-2010 Tor Norbye <tnorbye@google.com> Extract layout constants into a separate constants class

Combine the constants in BaseView and a LayoutConstants class over in
the internal packages into a new LayoutConstants class, and reference
these constants elsewhere (statically imported). This was suggested by
in the feedback to review #18971.

Change-Id: I40b76f8f6045c34a98f7a2363f96d2942360d1f3
63a966c7d8a08f175d1a8aee688c74d0090af888 25-Oct-2010 Tor Norbye <tnorbye@google.com> Add layout unit tests

Add layout unit tests, and some infrastructure for testing. Also fix
some formatting errors (>100 column lines) in the previous commit.

Change-Id: I3eabf30998ab7deb84df57e4d0c10cf57ee399d5