use of com.ramussoft.gui.common.ViewPlugin in project ramus by Vitaliy-Yakovchuk.
the class PlugableFrame method createToolBars.
@SuppressWarnings("unchecked")
private void createToolBars() {
toolBarsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
for (Object object : toolBarActions) {
Entry<String, Object> entry = (Entry<String, Object>) object;
List<Action> list = (List) entry.getValue();
JToolBar toolBar = new JToolBar();
for (Action a : list) {
if (a == null)
toolBar.addSeparator();
else {
AbstractButton button;
if (a.getValue(Action.SELECTED_KEY) == null)
button = toolBar.add(a);
else {
ButtonGroup group = (ButtonGroup) a.getValue(BUTTON_GROUP);
button = new JToggleButton(a);
button.setToolTipText(button.getText());
button.setText(null);
toolBar.add(button);
Boolean added = (Boolean) a.getValue(BUTTON_GROUP_ADDED);
if (added == null)
added = Boolean.FALSE;
if ((group != null) && (!added.booleanValue())) {
group.add(button);
a.putValue(BUTTON_GROUP_ADDED, Boolean.TRUE);
}
}
button.setFocusable(false);
}
}
toolBars.put(entry.getKey(), toolBar);
toolBarsPanel.add(toolBar);
}
for (ViewPlugin p : plugins) {
for (JToolBar bar : p.getToolBars()) {
toolBarsPanel.add(bar);
}
}
}
use of com.ramussoft.gui.common.ViewPlugin in project ramus by Vitaliy-Yakovchuk.
the class PlugableFrame method initActions.
private void initActions() {
for (ViewPlugin plugin : plugins) {
ActionDescriptor[] actionDescriptors = plugin.getActionDescriptors();
for (ActionDescriptor actionDescriptor : actionDescriptors) {
Action action = actionDescriptor.getAction();
if (action != null) {
String command = (String) action.getValue(Action.ACTION_COMMAND_KEY);
String des = plugin.getString(getActionShortDescriptionKey(command));
if (des == null) {
des = plugin.getString(getActionName(command));
if (des == null) {
StringGetter getter = (StringGetter) action.getValue(StringGetter.ACTION_STRING_GETTER);
if (getter != null)
des = getter.getString(getActionName(command));
}
}
action.putValue(Action.SHORT_DESCRIPTION, des);
String value = plugin.getString(getActionName(command));
if (value == null)
value = command;
action.putValue(Action.NAME, value);
des = plugin.getString(getActionLongDescriptionKey(command));
if (des == null)
des = (String) action.getValue(Action.SHORT_DESCRIPTION);
action.putValue(Action.LONG_DESCRIPTION, des);
if (actionDescriptor.getActionLevel().equals(ActionLevel.VIEW)) {
viewActions.put(command, action);
action.setEnabled(false);
}
}
add(actionDescriptor, plugin);
}
}
}
Aggregations