Gridarta Editor
MainToolbar.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.misc;
21 
22 import java.awt.Component;
25 import net.sf.japi.swing.action.ActionBuilder;
26 import net.sf.japi.swing.action.ActionBuilderFactory;
27 import org.jetbrains.annotations.NotNull;
28 
33 public class MainToolbar {
34 
38  @NotNull
39  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
40 
44  @NotNull
45  private final Component toolbar;
46 
50  @NotNull
52 
53  @Override
54  public void showMainToolbarChanged(final boolean visible) {
55  toolbar.setVisible(visible);
56  }
57 
58  };
59 
64  public MainToolbar(@NotNull final EditorSettings editorSettings) {
65  toolbar = ACTION_BUILDER.createToolBar("main");
66  editorSettings.addEditorSettingsListener(editorSettingsListener);
67  toolbar.setVisible(editorSettings.isShowMainToolbar());
68  }
69 
74  @NotNull
75  public Component getComponent() {
76  return toolbar;
77  }
78 
79 }
static final ActionBuilder ACTION_BUILDER
Action Builder to create Actions.
final EditorSettingsListener editorSettingsListener
The EditorSettingsListener used to detect settings changes.
Component getComponent()
Returns the toolbar component.
final Component toolbar
The toolbar.
Base package of all Gridarta classes.
Interface for listeners interested in EditorSettings events.
MainToolbar(@NotNull final EditorSettings editorSettings)
Creates a new instance.
Settings that apply to the editor.
The main toolbar of the application.