Skip to content

Commit 0a6ac36

Browse files
committed
set options strings to default mode and calendar mode
1 parent 4f985e6 commit 0a6ac36

5 files changed

Lines changed: 69 additions & 67 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>eu.nbdemetra</groupId>
66
<artifactId>SpecParser</artifactId>
7-
<version>1.6.1</version>
7+
<version>1.6.2</version>
88
<packaging>nbm</packaging>
99

1010
<name>SpecParser</name>

src/main/java/Logic/SpecCollector.java

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ private void writeRegressors(WinX12SpecSeparator separator) {
297297
curName = regName[i];
298298

299299
int counter_single_usertype = i;
300-
if(regTyp.length ==1 && regTyp.length != regressor.length){
300+
if (regTyp.length == 1 && regTyp.length != regressor.length) {
301301
counter_single_usertype = 0;
302302
}
303-
303+
304304
//is there a regressor with this curName?
305305
if (wsItem.getOwner().getContext().getTsVariableDictionary().contains(reg_SpecParser + "." + curName)) {
306306

@@ -364,62 +364,64 @@ private void writeRegressors(WinX12SpecSeparator separator) {
364364
}
365365

366366
Preferences node = NbPreferences.forModule(SpecParserOptionsPanelController.class);
367-
String vars_loc = node.get(SpecParserOptionsPanelController.SPECPARSER_VARS_LOCATION, "regular");
368-
369-
switch (vars_loc.toLowerCase()) {
370-
case "in calendars":
371-
td.add(reg_SpecParser + "." + curName);
372-
break;
373-
case "regular":
374-
default:
375-
switch (regTyp[counter_single_usertype].toUpperCase()) {
376-
case "TD":
377-
td.add(reg_SpecParser + "." + curName);
378-
break;
379-
case "USER":
380-
TsVariableDescriptor userVar = new TsVariableDescriptor();
381-
userVar.setName(reg_SpecParser + "." + curName);
382-
383-
// differences for final = user
384-
if (separator.isFinalUser()) {
385-
userVar.setEffect(TsVariableDescriptor.UserComponentType.Series);
386-
} else {
387-
//default: final != user
388-
userVar.setEffect(TsVariableDescriptor.UserComponentType.Irregular);
389-
}
390-
user.add(userVar);
391-
break;
392-
case "SEASONAL":
393-
TsVariableDescriptor var = new TsVariableDescriptor();
394-
var.setName(reg_SpecParser + "." + curName);
395-
var.setEffect(TsVariableDescriptor.UserComponentType.Seasonal);
396-
user.add(var);
397-
break;
398-
case "LS":
399-
TsVariableDescriptor v = new TsVariableDescriptor();
400-
v.setName(reg_SpecParser + "." + curName);
401-
v.setEffect(TsVariableDescriptor.UserComponentType.Trend);
402-
user.add(v);
403-
break;
404-
/*Version 1.5.6 Sylwias Mail vom 12.10.*/
405-
case "HOLIDAY":
367+
String vars_loc = node.get(SpecParserOptionsPanelController.SPECPARSER_VARS_LOCATION, SpecParserOptionsPanelController.DEFAULT_MODE);
368+
369+
if (vars_loc.equals(SpecParserOptionsPanelController.CALENDAR_MODE)) {
370+
// switch (vars_loc.toLowerCase()) {
371+
// case SpecParserOptionsPanelController.CALENDAR_MODE:
372+
td.add(reg_SpecParser + "." + curName);
373+
// break;
374+
} else {
375+
// case SpecParserOptionsPanelController.DEFAULT_MODE:
376+
// default:
377+
switch (regTyp[counter_single_usertype].toUpperCase()) {
378+
case "TD":
379+
td.add(reg_SpecParser + "." + curName);
380+
break;
381+
case "USER":
382+
TsVariableDescriptor userVar = new TsVariableDescriptor();
383+
userVar.setName(reg_SpecParser + "." + curName);
384+
385+
// differences for final = user
386+
if (separator.isFinalUser()) {
387+
userVar.setEffect(TsVariableDescriptor.UserComponentType.Series);
388+
} else {
389+
//default: final != user
390+
userVar.setEffect(TsVariableDescriptor.UserComponentType.Irregular);
391+
}
392+
user.add(userVar);
393+
break;
394+
case "SEASONAL":
395+
TsVariableDescriptor var = new TsVariableDescriptor();
396+
var.setName(reg_SpecParser + "." + curName);
397+
var.setEffect(TsVariableDescriptor.UserComponentType.Seasonal);
398+
user.add(var);
399+
break;
400+
case "LS":
401+
TsVariableDescriptor v = new TsVariableDescriptor();
402+
v.setName(reg_SpecParser + "." + curName);
403+
v.setEffect(TsVariableDescriptor.UserComponentType.Trend);
404+
user.add(v);
405+
break;
406+
/*Version 1.5.6 Sylwias Mail vom 12.10.*/
407+
case "HOLIDAY":
406408
// td.add(reg_SpecParser + "." + curName);
407-
TsVariableDescriptor vars = new TsVariableDescriptor();
408-
vars.setName(reg_SpecParser + "." + curName);
409-
vars.setEffect(TsVariableDescriptor.UserComponentType.Undefined);
410-
user.add(vars);
411-
break;
412-
default:
413-
TsVariableDescriptor userVar2 = new TsVariableDescriptor();
414-
userVar2.setName(reg_SpecParser + "." + curName);
415-
416-
// differences for final = user
417-
userVar2.setEffect(TsVariableDescriptor.UserComponentType.Irregular);
418-
user.add(userVar2);
419-
break;
420-
}
409+
TsVariableDescriptor vars = new TsVariableDescriptor();
410+
vars.setName(reg_SpecParser + "." + curName);
411+
vars.setEffect(TsVariableDescriptor.UserComponentType.Undefined);
412+
user.add(vars);
413+
break;
414+
default:
415+
TsVariableDescriptor userVar2 = new TsVariableDescriptor();
416+
userVar2.setName(reg_SpecParser + "." + curName);
417+
418+
// differences for final = user
419+
userVar2.setEffect(TsVariableDescriptor.UserComponentType.Irregular);
420+
user.add(userVar2);
421+
break;
422+
}
423+
// }
421424
}
422-
423425
}
424426
separator.setRegressorsInSpec(td.toArray(new String[0]), user.toArray(new TsVariableDescriptor[0]));
425427
}

src/main/java/options/SpecParserOptionsPanelController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public final class SpecParserOptionsPanelController extends OptionsPanelControll
2626
public static final String ID = "Demetra/SpecParser";
2727
public static final String SPECPARSER_VARS_LOCATION = "specparser_vars_location";
2828

29+
public static final String DEFAULT_MODE = "Default mode",
30+
CALENDAR_MODE = "Calendar mode";
31+
2932
private SpecParserPanel panel;
3033
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
3134
private boolean changed;

src/main/java/options/SpecParserPanel.form

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
2222
<EmptySpace type="separate" max="-2" attributes="0"/>
2323
<Component id="jComboBox1" min="-2" max="-2" attributes="0"/>
24-
<EmptySpace pref="76" max="32767" attributes="0"/>
24+
<EmptySpace pref="130" max="32767" attributes="0"/>
2525
</Group>
2626
</Group>
2727
</DimensionLayout>
@@ -49,10 +49,7 @@
4949
<Component class="javax.swing.JComboBox" name="jComboBox1">
5050
<Properties>
5151
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
52-
<StringArray count="2">
53-
<StringItem index="0" value="regular"/>
54-
<StringItem index="1" value="in calendars"/>
55-
</StringArray>
52+
<StringArray count="0"/>
5653
</Property>
5754
</Properties>
5855
</Component>

src/main/java/options/SpecParserPanel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ final class SpecParserPanel extends javax.swing.JPanel {
1414
SpecParserPanel(SpecParserOptionsPanelController controller) {
1515
this.controller = controller;
1616
initComponents();
17-
// TODO listen to changes in form fields and call controller.changed()
17+
// TODO listen to changes in form fields and call controller.changed()
18+
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { SpecParserOptionsPanelController.DEFAULT_MODE, SpecParserOptionsPanelController.CALENDAR_MODE}));
19+
1820
}
1921

2022
/**
@@ -30,8 +32,6 @@ private void initComponents() {
3032

3133
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SpecParserPanel.class, "SpecParserPanel.jLabel1.text")); // NOI18N
3234

33-
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "regular", "in calendars" }));
34-
3535
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
3636
this.setLayout(layout);
3737
layout.setHorizontalGroup(
@@ -41,7 +41,7 @@ private void initComponents() {
4141
.addComponent(jLabel1)
4242
.addGap(18, 18, 18)
4343
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
44-
.addContainerGap(76, Short.MAX_VALUE))
44+
.addContainerGap(130, Short.MAX_VALUE))
4545
);
4646
layout.setVerticalGroup(
4747
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -56,7 +56,7 @@ private void initComponents() {
5656

5757
void load() {
5858

59-
String saveMethod = NbPreferences.forModule(SpecParserOptionsPanelController.class).get(SpecParserOptionsPanelController.SPECPARSER_VARS_LOCATION, "regular");
59+
String saveMethod = NbPreferences.forModule(SpecParserOptionsPanelController.class).get(SpecParserOptionsPanelController.SPECPARSER_VARS_LOCATION, "Default mode");
6060
jComboBox1.setSelectedItem(saveMethod);
6161
}
6262

0 commit comments

Comments
 (0)