Sample: Improved Master/Detail Implementation
Demonstration:
- public String()
- public String(StringBuffer buffer)
- public String(String original)
- public String(char[] value)
- public String(byte[] bytes)
String object so that it
represents an empty character sequence. Note that use of this
constructor is unnecessary since Strings are immutable.
- StringBuffer buffer: a
StringBuffer.
String object so that it
represents the same sequence of characters as the argument; in other
words, the newly created string is a copy of the argument string. Unless
an explicit copy of original is needed, use of this
constructor is unnecessary since Strings are immutable.
Parameters:
- String original: a
String.
String so that it represents the
sequence of characters currently contained in the character array
argument. The contents of the character array are copied; subsequent
modification of the character array does not affect the newly created
string.
Parameters:
- char[] value: the initial value of the string.
The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required.
Parameters:- byte[] bytes: the bytes to be decoded into characters
Description:
The last master/detail has a slight flaw. Unselected items are hidden and selected items are shown. The CSS 'display' property is used, which does the right thing: it removes hidden elements from the flow so that they don't take up any space. However, the selected/shown element has a unique height, which is a function of the amount of content within it. So toggling items causes content below this feature to move up or down.
The main remedy to this problem is to use CSS positioning. We can assign a fixed height to the block containing all the descriptions and position all the blocks at the same location (since only one will ever be visible at any one time). You'll notice that the text below the feature is unaffected by any dynamic behavior.
References
[tbd]: javadocs - methods listing with method details. others?