|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.explorer.propertysheet; import java.util.HashMap; import java.util.Map; /** * Keeps a global list of scroll positions and selected tabs for the property * sheet. */ class SelectionAndScrollPositionManager { private String lastSelectedGroup = ""; private static Map groupsToNodes = new HashMap(); private static Map namesToPositions = new HashMap(); private String nodeName = null; /** * Stores the current node name. * * @param name */ public void setCurrentNodeName (String name) { nodeName = name; } public String getCurrentNodeName() { return nodeName; } public String getLastSelectedGroupName() { return lastSelectedGroup; } /** * Store the current scroll position. * * @param pos A scroll position. Will only be stored if > 0. * @param name A node or tab name */ public void storeScrollPosition (int pos, String name) { if (pos > 0) { synchronized (namesToPositions) { namesToPositions.put (name, new Integer(pos)); } } } /** * Stores the last selected group * @param group */ public void storeLastSelectedGroup (String group) { if (nodeName != null) { synchronized (groupsToNodes) { lastSelectedGroup = group; groupsToNodes.put(nodeName, group); } } } /** * Fetch the remembered group selection name. The returned value * may or may not actually be present in the list of tab names for * a given node. * |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.