Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Edit Token Dialog not displaying correct properties #1507

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,9 @@
import net.rptools.maptool.client.swing.GenericDialog;
import net.rptools.maptool.client.ui.zone.vbl.TokenVBL;
import net.rptools.maptool.language.I18N;
import net.rptools.maptool.model.AssetManager;
import net.rptools.maptool.model.Association;
import net.rptools.maptool.model.Grid;
import net.rptools.maptool.model.HeroLabData;
import net.rptools.maptool.model.ObservableList;
import net.rptools.maptool.model.Player;
import net.rptools.maptool.model.Token;
import net.rptools.maptool.model.*;
import net.rptools.maptool.model.Token.TerrainModifierOperation;
import net.rptools.maptool.model.Token.Type;
import net.rptools.maptool.model.TokenFootprint;
import net.rptools.maptool.model.TokenProperty;
import net.rptools.maptool.model.Zone.Layer;
import net.rptools.maptool.util.ExtractHeroLab;
import net.rptools.maptool.util.FunctionUtil;
Expand Down Expand Up @@ -297,9 +289,14 @@ public void run() {
// Updates the Property Type list.
updatePropertyTypeCombo();

// Set the selected item in the Property Type list. Also triggers a itemStateChanged event
// Set the selected item in Property Type list. Triggers a itemStateChanged event if index != 0
getPropertyTypeCombo().setSelectedItem(token.getPropertyType());

// If index == 0, the itemStateChanged event wasn't triggered, so we update. Fix #1504
if (getPropertyTypeCombo().getSelectedIndex() == 0) {
updatePropertiesTable((String) getPropertyTypeCombo().getSelectedItem());
}

getSightTypeCombo()
.setSelectedItem(
token.getSightType() != null
Expand Down Expand Up @@ -498,7 +495,6 @@ public JComboBox getShapeCombo() {

/** Initializes the Property Type dropdown list. */
public void initPropertyTypeCombo() {
updatePropertiesTable((String) getPropertyTypeCombo().getSelectedItem());
getPropertyTypeCombo()
.addItemListener(
new ItemListener() {
Expand Down