mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-04 04:35:21 +00:00
update menu selection when configuration changed in advanced settings
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
@@ -33,6 +36,8 @@ public class ConfigurationItem<T> {
|
||||
|
||||
private boolean modified;
|
||||
|
||||
private List<ConfigurationItemChangeListener<T>> listeners;
|
||||
|
||||
public ConfigurationItem(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -71,12 +76,14 @@ public class ConfigurationItem<T> {
|
||||
hasValue = true;
|
||||
modified = true;
|
||||
this.value = value;
|
||||
fireConfigurationItemChanged(value);
|
||||
}
|
||||
|
||||
public void unset() {
|
||||
hasValue = false;
|
||||
modified = true;
|
||||
this.value = null;
|
||||
fireConfigurationItemChanged(defaultValue);
|
||||
}
|
||||
|
||||
public boolean hasValue() {
|
||||
@@ -91,4 +98,26 @@ public class ConfigurationItem<T> {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private void fireConfigurationItemChanged(T newValue) {
|
||||
if (listeners != null) {
|
||||
for (ConfigurationItemChangeListener<T> listener : listeners) {
|
||||
listener.configurationItemChanged(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(ConfigurationItemChangeListener<T> l) {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList<>();
|
||||
}
|
||||
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
public void removeListener(ConfigurationItemChangeListener<T> l) {
|
||||
if (listeners != null) {
|
||||
listeners.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ConfigurationItemChangeListener<T> {
|
||||
|
||||
public void configurationItemChanged(T newValue);
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.exporters.morphshape.CanvasMorphShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.BitmapExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import static com.jpexs.decompiler.flash.tags.base.DrawableTag.PARAMETER_RATIO;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.FILLSTYLEARRAY;
|
||||
|
||||
Reference in New Issue
Block a user