Changeset 53 for domaineditor/src/main
- Timestamp:
- 12/18/24 13:28:59 (5 days ago)
- Location:
- domaineditor/src/main/java/geniusweb/domaineditor
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
domaineditor/src/main/java/geniusweb/domaineditor/ProfileEditor.java
r52 r53 15 15 import geniusweb.domaineditor.panels.profile.ProfileEditorPanel; 16 16 import tudelft.utilities.logging.Reporter; 17 import tudelft.utilities.mvc.model.ModelTime; 18 import tudelft.utilities.mvc.model.NoModelTime; 17 19 import tudelft.utilities.mvc.panels.PopupReporter; 18 20 … … 24 26 @SuppressWarnings("serial") 25 27 public class ProfileEditor extends JFrame { 28 public static ModelTime TIME = new NoModelTime(); 29 26 30 private final Reporter log; 27 31 private final LinearAdditiveUtilitySpaceModel model; -
domaineditor/src/main/java/geniusweb/domaineditor/model/BidModel.java
r52 r53 7 7 import java.util.logging.Level; 8 8 9 import geniusweb.domaineditor.ProfileEditor; 9 10 import geniusweb.issuevalue.Bid; 10 11 import geniusweb.issuevalue.DiscreteValue; 11 12 import geniusweb.issuevalue.NumberValue; 12 13 import geniusweb.issuevalue.Value; 13 import tudelft.utilities.listener.DefaultListenable; 14 import tudelft.utilities.listener.DefaultThrowingListenable; 15 import tudelft.utilities.listener.Unacceptable; 14 16 import tudelft.utilities.logging.Reporter; 15 17 import tudelft.utilities.mvc.model.BasicModel; … … 18 20 import tudelft.utilities.mvc.model.MapFromKeys; 19 21 import tudelft.utilities.mvc.model.MapModel; 22 import tudelft.utilities.mvc.model.Model; 23 import tudelft.utilities.mvc.model.ModelTime; 20 24 import tudelft.utilities.mvc.model.SelectionModel; 21 25 import tudelft.utilities.mvc.model.StringModel; 22 import tudelft.utilities.mvc.model.TypedModel;23 26 import tudelft.utilities.mvc.model.events.Added; 24 27 import tudelft.utilities.mvc.model.events.Changed; … … 38 41 * 39 42 */ 40 public class BidModel extends Default Listenable<Event> implements41 MapModel<StringModel, SelectionModel<BasicModel>>, TypedModel<Bid>{43 public class BidModel extends DefaultThrowingListenable<Event> 44 implements MapModel<StringModel, SelectionModel<BasicModel>>, Model { 42 45 private final MapModel<StringModel, ValueSetModel> issuevalues; 43 46 private final Map<StringModel, SelectionModel<BasicModel>> selections = new HashMap<>(); … … 66 69 67 70 private void add(StringModel key, ListModel value) { 68 selections.put(key, new DefaultSelectionModel(value ));71 selections.put(key, new DefaultSelectionModel(value, log, true)); 69 72 } 70 73 71 74 /** 72 75 * Domain change occured. Handle it. 76 * 77 * @throws Unacceptable 73 78 */ 74 private void handleChange(Event e) {79 private void handleChange(Event e) throws Unacceptable { 75 80 // we only handle add/remove of issues. If a value is removed, 76 81 // this should automatically reflect into the selectionmodel. 77 if (!(e instanceof Changed)) { 78 System.out.println("Unexpected event " + e); 79 return; 80 } 82 if (!(e instanceof Changed)) 83 throw new Unacceptable("Unexpected event " + e); 81 84 e = e.getChildEvent(); 82 85 if (e instanceof Removed) { … … 101 104 } 102 105 103 @Override104 106 public void remove(StringModel key) { 105 107 throw new UnsupportedOperationException(); … … 121 123 } 122 124 123 @Override124 125 public Bid getCurrentValue() throws IllegalStateException { 125 126 Map<String, Value> selectionmap = new HashMap<>(); … … 134 135 } 135 136 136 @Override137 137 public void setCurrentValue(Bid bid) throws IllegalArgumentException { 138 138 ListModel<StringModel> issues = issuevalues.getKeys(); … … 186 186 } 187 187 188 @Override 189 public ModelTime getTime() { 190 return ProfileEditor.TIME; 191 } 192 188 193 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/DiscreteValueSetModel.java
r52 r53 7 7 import java.util.logging.Level; 8 8 9 import geniusweb.domaineditor.ProfileEditor; 9 10 import geniusweb.issuevalue.DiscreteValue; 10 11 import geniusweb.issuevalue.DiscreteValueSet; … … 25 26 26 27 public DiscreteValueSetModel(List<StringModel> values, Reporter log) { 27 super(values, log );28 super(values, log, ProfileEditor.TIME); 28 29 } 29 30 30 31 public DiscreteValueSetModel(Reporter log) { 31 super(Arrays.asList(new StringModel("value", log)), log); 32 super(Arrays.asList(new StringModel("value", log, ProfileEditor.TIME)), 33 log, ProfileEditor.TIME); 32 34 } 33 35 … … 78 80 // first add the new vals because minimum size. 79 81 for (DiscreteValue val : valset.getValues()) { 80 add(new StringModel(val.getValue(), log ));82 add(new StringModel(val.getValue(), log, ProfileEditor.TIME)); 81 83 } 82 84 for (StringModel old : oldvals) { -
domaineditor/src/main/java/geniusweb/domaineditor/model/DomainModel.java
r52 r53 16 16 import geniusweb.issuevalue.Domain; 17 17 import geniusweb.issuevalue.ValueSet; 18 import tudelft.utilities.listener.Default Listenable;18 import tudelft.utilities.listener.DefaultThrowingListenable; 19 19 import tudelft.utilities.logging.Reporter; 20 20 import tudelft.utilities.mvc.model.DefaultMapModel; 21 21 import tudelft.utilities.mvc.model.MapModel; 22 22 import tudelft.utilities.mvc.model.Model; 23 import tudelft.utilities.mvc.model.ModelTime; 23 24 import tudelft.utilities.mvc.model.StringModel; 24 import tudelft.utilities.mvc.model.TypedModel;25 25 import tudelft.utilities.mvc.model.events.Changed; 26 26 import tudelft.utilities.mvc.model.events.Event; … … 33 33 * 34 34 */ 35 public class DomainModel extends Default Listenable<Event>36 implements TypedModel<Domain> {35 public class DomainModel extends DefaultThrowingListenable<Event> 36 implements Model { // model<Domain> 37 37 private static final ObjectMapper jackson = new ObjectMapper(); 38 38 private final StringModel domainname; … … 57 57 this(new SimpleStringModel("domainname", log), 58 58 new DefaultMapModel<StringModel, ValueSetModel>( 59 Collections.singletonMap(new StringModel("issue", log), 59 Collections.singletonMap( 60 new StringModel("issue", log, 61 ProfileEditor.TIME), 60 62 new DiscreteValueSetModel(log)), 61 log ) {63 log, ProfileEditor.TIME) { 62 64 @Override 63 65 public int getMinimumSize() { … … 88 90 Domain domain = jackson.readValue(file, Domain.class); 89 91 // FIXME 90 return new DomainModel(new StringModel(domain.getName(), log), null, 91 log); 92 return new DomainModel( 93 new StringModel(domain.getName(), log, ProfileEditor.TIME), 94 null, log); 92 95 } 93 96 … … 112 115 * @return the {@link Domain} contained in this model. 113 116 */ 114 @Override115 117 public Domain getCurrentValue() throws IllegalStateException { 116 118 Map<String, ValueSet> issues = new HashMap<>(); … … 131 133 * {@link Model}s are created where needed. 132 134 */ 133 @Override134 135 public void setCurrentValue(Domain dom) throws IllegalArgumentException { 135 136 domainname.setValue(dom.getName()); … … 145 146 ValueSetModelType.fromModel(dom.getValues(iss)), log); 146 147 valsetmodel.setCurrentValue(dom.getValues(iss)); 147 issuesmodel.put(new StringModel(iss, log), valsetmodel); 148 issuesmodel.put(new StringModel(iss, log, ProfileEditor.TIME), 149 valsetmodel); 148 150 } 149 151 // remove the old issues 150 152 for (StringModel iss : oldissues) 151 issuesmodel.remove(iss); 153 issuesmodel.getKeys().remove(iss); 154 } 155 156 @Override 157 public ModelTime getTime() { 158 return ProfileEditor.TIME; 152 159 } 153 160 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/NumberValueSetModel.java
r52 r53 5 5 import java.util.Map; 6 6 7 import geniusweb.domaineditor.ProfileEditor; 7 8 import geniusweb.issuevalue.NumberValueSet; 8 9 import geniusweb.issuevalue.ValueSet; 9 10 import tudelft.utilities.immutablelist.Range; 10 import tudelft.utilities.listener.DefaultListenable; 11 import tudelft.utilities.listener.DefaultThrowingListenable; 12 import tudelft.utilities.listener.Unacceptable; 11 13 import tudelft.utilities.logging.Reporter; 12 14 import tudelft.utilities.mvc.model.BasicModel; 13 15 import tudelft.utilities.mvc.model.ListModel; 16 import tudelft.utilities.mvc.model.ModelTime; 14 17 import tudelft.utilities.mvc.model.NumberModel; 15 18 import tudelft.utilities.mvc.model.events.Changed; … … 20 23 * 21 24 */ 22 public class NumberValueSetModel extends Default Listenable<Event>25 public class NumberValueSetModel extends DefaultThrowingListenable<Event> 23 26 implements ValueSetModel { 24 27 … … 27 30 28 31 public NumberValueSetModel(NumberModel lowv, NumberModel highv, 29 NumberModel stepv, Reporter log) {32 NumberModel stepv, Reporter log) throws Unacceptable { 30 33 this.low = lowv; 31 34 this.high = highv; … … 41 44 } 42 45 43 private void check() throws IllegalStateException{46 private void check() throws Unacceptable { 44 47 if (low.getValue().compareTo(high.getValue()) > 0) 45 throw new IllegalStateException("low must be <= high");48 throw new Unacceptable("low must be <= high"); 46 49 if (step.getValue().compareTo(BigDecimal.ZERO) <= 0) 47 throw new IllegalStateException("step must be >0");50 throw new Unacceptable("step must be >0"); 48 51 notifyListeners(new Changed(this, null)); 49 52 } … … 51 54 /* 52 55 * Default, bit arbitrary values. 56 * 57 * @throws something that should never happen 53 58 */ 54 public NumberValueSetModel(Reporter log) {55 this(new NumberModel(BigDecimal.ZERO, log ),56 new NumberModel(BigDecimal.TEN, log ),57 new NumberModel(BigDecimal.ONE, log ), log);59 public NumberValueSetModel(Reporter log) throws Unacceptable { 60 this(new NumberModel(BigDecimal.ZERO, log, ProfileEditor.TIME), 61 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 62 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 58 63 } 59 64 … … 116 121 } 117 122 123 @Override 124 public ModelTime getTime() { 125 return ProfileEditor.TIME; 126 } 127 118 128 } 119 129 … … 122 132 * 123 133 */ 124 class MyListModel extends Default Listenable<Event>134 class MyListModel extends DefaultThrowingListenable<Event> 125 135 implements ListModel<NumberModel> { 126 136 … … 143 153 BigDecimal val = numvalset.getCurrentValue().getRange().get(n); 144 154 if (!itemsCache.containsKey(val)) 145 itemsCache.put(val, new NumberModel(val, numvalset.log)); 155 itemsCache.put(val, 156 new NumberModel(val, numvalset.log, ProfileEditor.TIME)); 146 157 return itemsCache.get(val); 147 158 } … … 168 179 } 169 180 181 @Override 182 public ModelTime getTime() { 183 return ProfileEditor.TIME; 184 } 185 170 186 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/SimpleStringModel.java
r52 r53 1 1 package geniusweb.domaineditor.model; 2 2 3 import geniusweb.domaineditor.ProfileEditor; 4 import tudelft.utilities.listener.Unacceptable; 3 5 import tudelft.utilities.logging.Reporter; 4 6 import tudelft.utilities.mvc.model.StringModel; … … 10 12 11 13 public SimpleStringModel(String val, Reporter log) { 12 super(val, log );14 super(val, log, ProfileEditor.TIME); 13 15 } 14 16 15 17 @Override 16 protected void check() throws IllegalStateException{18 protected void check() throws Unacceptable { 17 19 if (!(getValue().matches("[a-zA-Z0-9]+"))) 18 throw new IllegalStateException(20 throw new Unacceptable( 19 21 "Only lower and upper case letters and numbers are allowed"); 20 22 super.check(); -
domaineditor/src/main/java/geniusweb/domaineditor/model/ValueSetModel.java
r52 r53 4 4 import tudelft.utilities.mvc.model.BasicModel; 5 5 import tudelft.utilities.mvc.model.ListModel; 6 import tudelft.utilities.mvc.model. TypedModel;6 import tudelft.utilities.mvc.model.Model; 7 7 8 8 /** … … 11 11 * 12 12 */ 13 public interface ValueSetModel extends TypedModel<ValueSet>{13 public interface ValueSetModel extends Model { 14 14 /** 15 15 * … … 25 25 public ListModel<? extends BasicModel> getList(); 26 26 27 /** 28 * 29 * @return the currently contained value in the model. We do NOT specify the 30 * type of the returned object because it would have to be a type 31 * parameter added to Model, which leads to all kinds of issues with 32 * excessive parameterization and issues when a class extends eg a 33 * MapModel. NOTE: also derived classes like ListModel should not 34 * specify that they return {@link List} or so: further subclassing 35 * of eg a ListModel might be eg a ValueSet which would not return a 36 * List again. 37 * @throws IllegalStateException if the model is not correctly filled in at 38 * this moment. 39 */ 40 public ValueSet getCurrentValue() throws IllegalStateException; 41 42 /** 43 * Sets the current value based on the proviced obj 44 * 45 * @param obj the object to load the model with. Mirror of 46 * {@link #getCurrentValue()} and the Object is the same type. 47 * @throws IllegalArgumentException if the object is not the expected object 48 * type 49 */ 50 public void setCurrentValue(ValueSet obj) throws IllegalArgumentException; 51 27 52 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/ValueSetModelType.java
r52 r53 4 4 import geniusweb.issuevalue.NumberValueSet; 5 5 import geniusweb.issuevalue.ValueSet; 6 import tudelft.utilities.listener.Unacceptable; 6 7 import tudelft.utilities.logging.Reporter; 7 8 … … 57 58 return new DiscreteValueSetModel(log); 58 59 case NUMBER: 59 return new NumberValueSetModel(log); 60 try { 61 return new NumberValueSetModel(log); 62 } catch (Unacceptable e) { 63 throw new RuntimeException(e);// shouldn't happen 64 } 60 65 } 61 66 return null; // unreachable code -
domaineditor/src/main/java/geniusweb/domaineditor/model/profile/DiscreteValueSetUtilitiesModel.java
r52 r53 5 5 import java.util.Map; 6 6 7 import geniusweb.domaineditor.ProfileEditor; 7 8 import geniusweb.domaineditor.model.DiscreteValueSetModel; 8 9 import geniusweb.issuevalue.DiscreteValue; 9 10 import geniusweb.profile.utilityspace.DiscreteValueSetUtilities; 10 11 import geniusweb.profile.utilityspace.ValueSetUtilities; 11 import tudelft.utilities.listener.DefaultListenable; 12 import tudelft.utilities.listener.DefaultThrowingListenable; 13 import tudelft.utilities.listener.Unacceptable; 12 14 import tudelft.utilities.logging.Reporter; 13 15 import tudelft.utilities.mvc.model.ListModel; 14 16 import tudelft.utilities.mvc.model.MapModel; 17 import tudelft.utilities.mvc.model.ModelTime; 15 18 import tudelft.utilities.mvc.model.NumberModel; 16 19 import tudelft.utilities.mvc.model.RestrictedNumberModel; … … 26 29 * 27 30 */ 28 public class DiscreteValueSetUtilitiesModel extends DefaultListenable<Event> 29 implements MapModel<StringModel, RestrictedNumberModel>, 30 ValueSetUtilitiesModel { 31 public class DiscreteValueSetUtilitiesModel 32 extends DefaultThrowingListenable<Event> implements 33 MapModel<StringModel, RestrictedNumberModel>, ValueSetUtilitiesModel { 34 31 35 private final ListModel<StringModel> values; 32 36 private final Map<StringModel, RestrictedNumberModel> utilities = new HashMap<>(); … … 37 41 private final static Reporter dummylog = new PopupReporter(null); 38 42 private final static NumberModel LOW = new NumberModel(BigDecimal.ZERO, 39 dummylog );43 dummylog, ProfileEditor.TIME); 40 44 private final static NumberModel HIGH = new NumberModel(BigDecimal.ONE, 41 dummylog );45 dummylog, ProfileEditor.TIME); 42 46 43 47 public DiscreteValueSetUtilitiesModel(DiscreteValueSetModel values, … … 50 54 public RestrictedNumberModel getValue(StringModel key) { 51 55 if (!utilities.containsKey(key)) { 52 utilities.put(key, 53 new RestrictedNumberModel(DEFAULT, LOW, HIGH, log)); 56 try { 57 utilities.put(key, new RestrictedNumberModel(DEFAULT, LOW, HIGH, 58 log, ProfileEditor.TIME)); 59 } catch (Unacceptable e) { 60 throw new RuntimeException(e);// this should not happen 61 } 54 62 } 55 63 return utilities.get(key); … … 61 69 } 62 70 63 @Override64 71 public void remove(StringModel key) { 65 72 throw new UnsupportedOperationException(); … … 113 120 } 114 121 122 @Override 123 public ModelTime getTime() { 124 return ProfileEditor.TIME; 125 } 126 115 127 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/profile/LinearAdditiveUtilitySpaceModel.java
r52 r53 8 8 import java.util.stream.Collectors; 9 9 10 import geniusweb.domaineditor.ProfileEditor; 10 11 import geniusweb.domaineditor.model.BidModel; 11 12 import geniusweb.domaineditor.model.DiscreteValueSetModel; … … 16 17 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace; 17 18 import geniusweb.profile.utilityspace.ValueSetUtilities; 18 import tudelft.utilities.listener.DefaultListenable; 19 import tudelft.utilities.listener.DefaultThrowingListenable; 20 import tudelft.utilities.listener.Unacceptable; 19 21 import tudelft.utilities.logging.Reporter; 20 22 import tudelft.utilities.mvc.model.ListModel; 21 23 import tudelft.utilities.mvc.model.MapFromKeys; 22 24 import tudelft.utilities.mvc.model.MapModel; 25 import tudelft.utilities.mvc.model.Model; 26 import tudelft.utilities.mvc.model.ModelTime; 23 27 import tudelft.utilities.mvc.model.NumberModel; 24 28 import tudelft.utilities.mvc.model.RestrictedNumberModel; 25 29 import tudelft.utilities.mvc.model.StringModel; 26 import tudelft.utilities.mvc.model.TypedModel;27 30 import tudelft.utilities.mvc.model.events.Event; 28 31 import tudelft.utilities.mvc.panels.PopupReporter; … … 31 34 * Model containing a {@link LinearAdditiveUtilitySpace} 32 35 */ 33 public class LinearAdditiveUtilitySpaceModel extends DefaultListenable<Event>34 implements ProfileModel, TypedModel<LinearAdditiveUtilitySpace> {36 public class LinearAdditiveUtilitySpaceModel extends 37 DefaultThrowingListenable<Event> implements ProfileModel, Model { // Model<<LinearAdditiveUtilitySpace>> 35 38 private final SimpleStringModel name; 36 39 /** … … 87 90 // we should never allow editing of these constants. 88 91 protected static final NumberModel CONSTANT0 = new NumberModel( 89 BigDecimal.ZERO, dummylog );92 BigDecimal.ZERO, dummylog, ProfileEditor.TIME); 90 93 protected static final NumberModel CONSTANT1 = new NumberModel( 91 BigDecimal.ONE, dummylog );94 BigDecimal.ONE, dummylog, ProfileEditor.TIME); 92 95 93 96 public LinearAdditiveUtilitySpaceModel(DomainModel domain, … … 108 111 final DomainModel domain2, final Reporter log) { 109 112 return new MapFromKeys<StringModel, RestrictedNumberModel>( 110 domain2.getIssues().getKeys(), log, true ) {113 domain2.getIssues().getKeys(), log, true, ProfileEditor.TIME) { 111 114 112 115 @Override 113 116 public RestrictedNumberModel create(StringModel key) { 114 return new RestrictedNumberModel(N05, CONSTANT0, CONSTANT1, 115 log); 117 try { 118 return new RestrictedNumberModel(N05, CONSTANT0, CONSTANT1, 119 log, ProfileEditor.TIME); 120 } catch (Unacceptable e) { 121 throw new RuntimeException(e); // shouldn't happen 122 } 116 123 } 117 124 … … 129 136 // different type 130 137 return new MapFromKeys<StringModel, ValueSetUtilitiesModel>( 131 domain2.getIssues().getKeys(), log, false ) {138 domain2.getIssues().getKeys(), log, false, ProfileEditor.TIME) { 132 139 @Override 133 140 public ValueSetUtilitiesModel create(StringModel key) { … … 137 144 (DiscreteValueSetModel) val, log); 138 145 if (val instanceof NumberValueSetModel) 139 return new NumberValueSetUtilitiesModel( 140 (NumberValueSetModel) val, log); 146 try { 147 return new NumberValueSetUtilitiesModel( 148 (NumberValueSetModel) val, log); 149 } catch (Unacceptable e) { 150 throw new RuntimeException(e); // shouldn't happen 151 } 141 152 throw new RuntimeException( 142 153 "Unsupported type " + val + "for key" + key); … … 190 201 } 191 202 192 @Override193 203 public LinearAdditiveUtilitySpace getCurrentValue() 194 204 throws IllegalStateException { … … 212 222 } 213 223 214 @Override215 224 public void setCurrentValue(LinearAdditiveUtilitySpace obj) 216 225 throws IllegalArgumentException { … … 258 267 } 259 268 269 @Override 270 public ModelTime getTime() { 271 return ProfileEditor.TIME; 272 } 273 260 274 } -
domaineditor/src/main/java/geniusweb/domaineditor/model/profile/NumberValueSetUtilitiesModel.java
r52 r53 3 3 import java.math.BigDecimal; 4 4 5 import geniusweb.domaineditor.ProfileEditor; 5 6 import geniusweb.domaineditor.model.NumberValueSetModel; 6 7 import geniusweb.profile.utilityspace.NumberValueSetUtilities; 7 8 import geniusweb.profile.utilityspace.ValueSetUtilities; 8 import tudelft.utilities.listener.DefaultListenable; 9 import tudelft.utilities.listener.DefaultThrowingListenable; 10 import tudelft.utilities.listener.Unacceptable; 9 11 import tudelft.utilities.logging.Reporter; 12 import tudelft.utilities.mvc.model.ModelTime; 10 13 import tudelft.utilities.mvc.model.NumberModel; 11 14 import tudelft.utilities.mvc.model.RestrictedNumberModel; … … 17 20 * 18 21 */ 19 public class NumberValueSetUtilitiesModel extends DefaultListenable<Event>20 implements ValueSetUtilitiesModel {22 public class NumberValueSetUtilitiesModel extends 23 DefaultThrowingListenable<Event> implements ValueSetUtilitiesModel { 21 24 22 25 private static final BigDecimal DEFAULT = new BigDecimal("0.5"); … … 25 28 private final static Reporter dummylog = new PopupReporter(null); 26 29 private final static NumberModel LOW = new NumberModel(BigDecimal.ZERO, 27 dummylog );30 dummylog, ProfileEditor.TIME); 28 31 private final static NumberModel HIGH = new NumberModel(BigDecimal.ONE, 29 dummylog );32 dummylog, ProfileEditor.TIME); 30 33 private final NumberModel lowValue; 31 34 private final RestrictedNumberModel lowUtility; … … 49 52 } 50 53 51 NumberValueSetUtilitiesModel(NumberValueSetModel valuesmodel, 52 Reporter log){54 NumberValueSetUtilitiesModel(NumberValueSetModel valuesmodel, Reporter log) 55 throws Unacceptable { 53 56 this(valuesmodel.getLow(), 54 new RestrictedNumberModel(DEFAULT, LOW, HIGH, log), 55 valuesmodel.getHigh(), 56 new RestrictedNumberModel(DEFAULT, LOW, HIGH, log)); 57 new RestrictedNumberModel(DEFAULT, LOW, HIGH, log, 58 ProfileEditor.TIME), 59 valuesmodel.getHigh(), new RestrictedNumberModel(DEFAULT, LOW, 60 HIGH, log, ProfileEditor.TIME)); 57 61 } 58 62 … … 95 99 highUtility.setValue(utils.getHighUtility()); 96 100 } 101 102 @Override 103 public ModelTime getTime() { 104 return ProfileEditor.TIME; 105 } 97 106 }; -
domaineditor/src/main/java/geniusweb/domaineditor/model/profile/ValueSetUtilitiesModel.java
r52 r53 2 2 3 3 import geniusweb.profile.utilityspace.ValueSetUtilities; 4 import tudelft.utilities.mvc.model. TypedModel;4 import tudelft.utilities.mvc.model.Model; 5 5 6 6 /** … … 8 8 * 9 9 */ 10 public interface ValueSetUtilitiesModel extends TypedModel<ValueSetUtilities> { 10 public interface ValueSetUtilitiesModel extends Model { 11 12 void setCurrentValue(ValueSetUtilities valueSetUtilities); 13 14 ValueSetUtilities getCurrentValue(); 11 15 12 16 } -
domaineditor/src/main/java/geniusweb/domaineditor/panels/DiscreteValueSetPanel.java
r52 r53 5 5 import javax.swing.JPanel; 6 6 7 import geniusweb.domaineditor.ProfileEditor; 7 8 import geniusweb.domaineditor.model.DiscreteValueSetModel; 8 9 import tudelft.utilities.logging.Reporter; … … 24 25 setLayout(new BorderLayout()); 25 26 add(new EditableListViewPanel(model.getList()) { 27 26 28 @Override 27 29 protected void addItem() { 28 model.add(new StringModel("value " + (n++), log)); 30 model.add(new StringModel("value " + (n++), log, 31 ProfileEditor.TIME)); 29 32 30 33 } -
domaineditor/src/main/java/geniusweb/domaineditor/panels/DomainEditorPanel.java
r52 r53 9 9 import javax.swing.JPanel; 10 10 11 import geniusweb.domaineditor.ProfileEditor; 11 12 import geniusweb.domaineditor.model.DiscreteValueSetModel; 12 13 import geniusweb.domaineditor.model.DomainModel; 13 14 import geniusweb.domaineditor.model.NumberValueSetModel; 14 15 import geniusweb.domaineditor.model.ValueSetModel; 16 import tudelft.utilities.listener.Unacceptable; 15 17 import tudelft.utilities.logging.Reporter; 16 18 import tudelft.utilities.mvc.model.MapModel; … … 39 41 40 42 add(new LabeledPanel("domain name ", 41 new StringPanel(domainmodel.getName())), 42 BorderLayout.NORTH); 43 new StringPanel(domainmodel.getName())), BorderLayout.NORTH); 43 44 add(new IssuesMapEditor(domainmodel.getIssues(), log), 44 45 BorderLayout.CENTER); … … 82 83 panel.add(combo, BorderLayout.CENTER); 83 84 JOptionPane.showMessageDialog(this, panel); 84 StringModel issuename = new StringModel("issue " + (n++), logger); 85 StringModel issuename = new StringModel("issue " + (n++), logger, 86 ProfileEditor.TIME); 85 87 ValueSetModel valuesetmodel; 86 88 if (combo.getSelectedItem().equals("discrete")) 87 89 valuesetmodel = new DiscreteValueSetModel(logger); 88 90 else 89 valuesetmodel = new NumberValueSetModel(logger); 91 try { 92 valuesetmodel = new NumberValueSetModel(logger); 93 } catch (Unacceptable e) { 94 throw new RuntimeException(e);// shouldn't happen 95 } 90 96 getModel().put(issuename, valuesetmodel); 91 97
Note:
See TracChangeset
for help on using the changeset viewer.