mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
cleanup
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@204 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
b0e5f0e409
commit
36700fe040
2 changed files with 15 additions and 15 deletions
|
@ -90,13 +90,13 @@ class ZLTreeResource extends ZLResource {
|
|||
String name = attributeValue(attributes, "name");
|
||||
if (name != null) {
|
||||
String value = attributeValue(attributes, "value");
|
||||
Map<String, ZLTreeResource> children = myStack.peek().myChildren;
|
||||
ZLTreeResource peek = myStack.peek();
|
||||
ZLTreeResource node;
|
||||
if (children == null) {
|
||||
if (peek.myChildren == null) {
|
||||
node = null;
|
||||
children = new HashMap<String, ZLTreeResource>();
|
||||
} else {
|
||||
node = children.get(name);
|
||||
node = peek.myChildren.get(name);
|
||||
peek.myChildren = new HashMap<String,ZLTreeResource>();
|
||||
}
|
||||
if (node == null) {
|
||||
if (value != null) {
|
||||
|
@ -104,7 +104,7 @@ class ZLTreeResource extends ZLResource {
|
|||
} else {
|
||||
node = new ZLTreeResource(name);
|
||||
}
|
||||
children.put(name, node);
|
||||
peek.myChildren.put(name, node);
|
||||
} else {
|
||||
if (value != null) {
|
||||
node.setValue(value);
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.zlibrary.ui.swing.view.ZLSwingViewWidget;
|
|||
public class ZLSwingApplicationWindow extends ZLApplicationWindow {
|
||||
private JFrame myFrame;
|
||||
private JToolBar myToolbar;
|
||||
private Map<Item, Action> myItemActionMap = new HashMap<Item, Action>();
|
||||
private final Map<Item, Action> myItemActionMap = new HashMap<Item, Action>();
|
||||
|
||||
final private ZLIntegerRangeOption myXOption =
|
||||
new ZLIntegerRangeOption(ZLOption.LOOK_AND_FEEL_CATEGORY, "Options", "XPosition", 0, 2000, 10);
|
||||
|
@ -118,11 +118,7 @@ public class ZLSwingApplicationWindow extends ZLApplicationWindow {
|
|||
public void addToolbarItem(Item item) {
|
||||
if (item.getType() == Item.Type.BUTTON) {
|
||||
ButtonItem buttonItem = (ButtonItem)item;
|
||||
String iconFileName = "icons/toolbar/" + buttonItem.getIconName() + ".png";
|
||||
java.net.URL iconURL = getClass().getClassLoader().getResource(iconFileName);
|
||||
ImageIcon icon = (iconURL != null) ? new ImageIcon(iconURL) : new ImageIcon(iconFileName);
|
||||
Action action = new MyButtonAction(buttonItem);
|
||||
action.putValue(Action.SMALL_ICON, icon);
|
||||
myToolbar.add(action);
|
||||
myItemActionMap.put(item, action);
|
||||
} else {
|
||||
|
@ -131,25 +127,29 @@ public class ZLSwingApplicationWindow extends ZLApplicationWindow {
|
|||
}
|
||||
|
||||
private class MyButtonAction extends AbstractAction {
|
||||
private ButtonItem item;
|
||||
private ButtonItem myItem;
|
||||
|
||||
MyButtonAction(ButtonItem item) {
|
||||
this.item = item;
|
||||
myItem = item;
|
||||
|
||||
String iconFileName = "icons/toolbar/" + myItem.getIconName() + ".png";
|
||||
java.net.URL iconURL = getClass().getClassLoader().getResource(iconFileName);
|
||||
ImageIcon icon = (iconURL != null) ? new ImageIcon(iconURL) : new ImageIcon(iconFileName);
|
||||
putValue(Action.SMALL_ICON, icon);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
onButtonPress(item);
|
||||
onButtonPress(myItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void setToolbarItemState(Item item, boolean visible, boolean enabled) {
|
||||
AbstractAction action = (AbstractAction)myItemActionMap.get(item);
|
||||
Action action = myItemActionMap.get(item);
|
||||
if (action != null) {
|
||||
action.setEnabled(enabled);
|
||||
}
|
||||
//setVisible()???
|
||||
// TODO: implement
|
||||
|
||||
}
|
||||
|
||||
public void setToggleButtonState(ButtonItem item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue