/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* DefaultLookup provides a way to customize the lookup done by the
* UIManager. The default implementation of DefaultLookup forwards
* the call to the UIManager.
* <p>
* <b>WARNING:</b> While this class is public, it should not be treated as
* public API and its API may change in incompatable ways between dot dot
* releases and even patch releases. You should not rely on this class even
* existing.
*
* @author Scott Violet
*/
public class DefaultLookup {
/**
* Key used to store DefaultLookup for AppContext.
*/
StringBuffer("DefaultLookup");
/**
* Thread that last asked for a default.
*/
/**
* DefaultLookup for last thread.
*/
/**
* If true, a custom DefaultLookup has been set.
*/
private static boolean isLookupSet;
/**
* Sets the DefaultLookup instance to use for the current
* <code>AppContext</code>. Null implies the UIManager should be
* used.
*/
synchronized(DefaultLookup.class) {
// Null was passed in, and no one has invoked setDefaultLookup
// with a non-null value, we don't need to do anything.
return;
}
// null was passed in, but someone has invoked setDefaultLookup
// with a non-null value, use an instance of DefautLookup
// which will fallback to UIManager.
lookup = new DefaultLookup();
}
isLookupSet = true;
}
}
boolean lookupSet;
synchronized(DefaultLookup.class) {
}
if (!lookupSet) {
// No one has set a valid DefaultLookup, use UIManager.
}
synchronized(DefaultLookup.class) {
// See if we've already cached the DefaultLookup for this thread,
// and use it if we have.
if (thisThread == currentDefaultThread) {
// It is cached, use it.
}
else {
// Not cached, get the DefaultLookup to use from the AppContext
// Fallback to DefaultLookup, which will redirect to the
// UIManager.
lookup = new DefaultLookup();
}
// Cache the values to make the next lookup easier.
}
}
}
//
// The following are convenience method that all use getDefault.
//
int defaultValue) {
return defaultValue;
}
}
}
return defaultValue;
}
}
}
boolean defaultValue) {
return defaultValue;
}
}
}
return defaultValue;
}
}
}
Icon defaultValue) {
return defaultValue;
}
}
}
return defaultValue;
}
}
}
// basic
}
}