- Timestamp:
- 09/24/11 04:17:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/ModelPropertiesDialog.java
r192 r194 3 3 import org.eclipse.swt.widgets.Dialog; 4 4 import org.eclipse.swt.widgets.Display; 5 import org.eclipse.swt.widgets.MessageBox; 5 6 import org.eclipse.swt.widgets.Shell; 6 7 import org.eclipse.swt.widgets.List; … … 13 14 import org.eclipse.swt.layout.FillLayout; 14 15 16 import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel; 17 import de.ugoe.cs.eventbench.models.IStochasticProcess; 18 import org.eclipse.swt.events.SelectionAdapter; 19 import org.eclipse.swt.events.SelectionEvent; 20 15 21 public class ModelPropertiesDialog extends Dialog { 16 22 23 private IStochasticProcess process; 24 17 25 protected Object result; 18 26 protected Shell shlModelProperties; … … 63 71 64 72 List list = new List(grpEvents, SWT.BORDER | SWT.V_SCROLL); 73 for( String symbol : process.getSymbolStrings() ) { 74 list.add(symbol); 75 } 65 76 66 77 Group grpStatistics = new Group(shlModelProperties, SWT.NONE); … … 75 86 Label label = new Label(grpStatistics, SWT.RIGHT); 76 87 label.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); 77 label.setText(" ####");88 label.setText(""+process.getNumSymbols()); 78 89 79 90 Label lblNumTrieLeafs = new Label(grpStatistics, SWT.NONE); 80 91 lblNumTrieLeafs.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); 81 lblNumTrieLeafs.setText("Size ( #Trie Leafs)");92 lblNumTrieLeafs.setText("Size (Flattend FOM)"); 82 93 83 94 Label label_1 = new Label(grpStatistics, SWT.RIGHT); 84 95 label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); 85 label_1.setText(" ####");96 label_1.setText(""+process.getNumFOMStates()); 86 97 87 98 Label lblEntropy = new Label(grpStatistics, SWT.NONE); … … 89 100 lblEntropy.setText("Entropy"); 90 101 91 Label label_2 = new Label(grpStatistics, SWT.RIGHT);92 label_2.setLayoutData(new GridData(SWT. RIGHT, SWT.TOP, false, false, 1, 1));102 final Label label_2 = new Label(grpStatistics, SWT.RIGHT); 103 label_2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); 93 104 label_2.setText("####"); 94 105 95 106 Button btnCalculateEntropy = new Button(shlModelProperties, SWT.NONE); 107 btnCalculateEntropy.addSelectionListener(new SelectionAdapter() { 108 @Override 109 public void widgetSelected(SelectionEvent e) { 110 if( process instanceof FirstOrderMarkovModel) { 111 label_2.setText(""+((FirstOrderMarkovModel) process).calcEntropy()); 112 } else { 113 MessageBox messageBox = new MessageBox(shlModelProperties, SWT.NONE); 114 messageBox.setText("Feature Not Available"); 115 messageBox.setMessage("The feature is currently only available for first-order Markov models."); 116 messageBox.open(); 117 } 118 } 119 }); 96 120 btnCalculateEntropy.setText("Calculate Entropy"); 97 121 … … 100 124 101 125 } 126 127 public void setStochasticProcess(IStochasticProcess process) { 128 this.process = process; 129 } 102 130 }
Note: See TracChangeset
for help on using the changeset viewer.