Skip to content

Commit

Permalink
[gui2] replace Hashtable with HashMap; simplify (#4285)
Browse files Browse the repository at this point in the history
  • Loading branch information
grimreaper authored and karianna committed Oct 9, 2018
1 parent 2eb5d1c commit 03a9dcd
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions code/src/java/pcgen/gui2/tabs/TabTitle.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;

import pcgen.system.LanguageBundle;
import pcgen.util.enumeration.Tab;
Expand All @@ -33,15 +34,13 @@
public class TabTitle
{

public static final String FOREGROUND = "foreground"; //$NON-NLS-1$
public static final String BACKGROUND = "background"; //$NON-NLS-1$
public static final String ENABLED = "enabled"; //$NON-NLS-1$
static final String ENABLED = "enabled"; //$NON-NLS-1$
public static final String TITLE = "title"; //$NON-NLS-1$
public static final String ICON = "icon"; //$NON-NLS-1$
public static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
static final String ICON = "icon"; //$NON-NLS-1$
static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
public static final String TAB = "tab"; //$NON-NLS-1$
private final PropertyChangeSupport support;
private final Hashtable<String, Object> table;
private final Map<String, Object> propertyTable;

/**
* Create a new TabTitle instance for a specific tab.
Expand Down Expand Up @@ -80,27 +79,22 @@ public TabTitle(String title, Tab tab)
public TabTitle()
{
support = new PropertyChangeSupport(this);
table = new Hashtable<>();
propertyTable = new HashMap<>();
}

public void addPropertyChangeListener(PropertyChangeListener l)
{
support.addPropertyChangeListener(l);
}

public void removePropertyChangeListener(PropertyChangeListener l)
{
support.removePropertyChangeListener(l);
}

public Object getValue(String prop)
{
return table.get(prop);
return propertyTable.get(prop);
}

public void putValue(String prop, Object value)
{
support.firePropertyChange(prop, table.put(prop, value), value);
support.firePropertyChange(prop, propertyTable.put(prop, value), value);
}

public void setEnabled(boolean enable)
Expand Down

0 comments on commit 03a9dcd

Please sign in to comment.