/*
* Jacareto Copyright (c) 2002-2005
* Applied Computer Science Research Group, Darmstadt University of
* Technology, Institute of Mathematics & Computer Science,
* Ludwigsburg University of Education, and Computer Based
* Learning Research Group, Aachen University. All rights reserved.
*
* Jacareto is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* Jacareto 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 for more details.
*
* You should have received a copy of the GNU General Public
* License along with Jacareto; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
package jacareto.cleverphl.gui;
import jacareto.cleverphl.menu.CleverPHLAction;
import jacareto.system.Environment;
import jacareto.toolkit.EnhancedHashtable;
import jacareto.toolkit.HashtableException;
import java.awt.Insets;
import javax.swing.JToolBar;
/**
* A cleverphl tool bar.
*
* @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
* @version 1.0
*/
public class CleverPHLToolBar extends JToolBar {
/**
* Creates a new toolbar.
*
* @param env the environment
* @param orientation the orientation of the toolbar
* @param key the customization key
* @param menuBar the menu bar which knows the actions
*/
public CleverPHLToolBar (Environment env, int orientation, String key, CleverPHLMenuBar menuBar) {
super(orientation);
createToolBar (env, key, menuBar);
setMargin (new Insets(1, 1, 1, 1));
}
/**
* Creates the toolbar.
*
* @param env the environment
* @param key the customization key
* @param menuBar the menu bar which knows the actions
*/
private void createToolBar (Environment env, String key, CleverPHLMenuBar menuBar) {
EnhancedHashtable map = env.getCustomization ().getMap (key + ".Items",
new EnhancedHashtable());
for (int i = 0; i < map.size (); i++) {
try {
CleverPHLAction action = (CleverPHLAction) menuBar.getAction (map.getString ("" +
i));
add (new CleverPHLButton(action));
} catch (HashtableException h) {
env.getLogger ().debug (env.getLanguage ().getString ("CleverPHL.Frame.Msg.ToolBarCreationProblem") +
" " + i);
}
}
}
}
|