Changeset 7195
- Timestamp:
- 11/12/10 21:04:17 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/maven/projects/slim-plugin/src/main/java/loci/slim/ui/UserInterfacePanel.java
r7167 r7195 63 63 import loci.slim.SLIMProcessor.FitFunction; 64 64 import loci.slim.SLIMProcessor.FitRegion; 65 import loci.slim.analysis.SLIMAnalysis; 65 66 66 67 /** … … 113 114 public IUserInterfacePanelListener m_listener; 114 115 115 int m_fitted Components= 0;116 int m_fittedParameterCount = 0; 116 117 117 118 // UI panel … … 123 124 JComboBox m_algorithmComboBox; 124 125 JComboBox m_functionComboBox; 126 JComboBox m_analysisComboBox; 127 JCheckBox m_fitAllChannels; 125 128 126 129 // fit settings … … 192 195 JButton m_fitButton; 193 196 194 public UserInterfacePanel(boolean showTau ) {197 public UserInterfacePanel(boolean showTau, SLIMAnalysis analysis) { 195 198 String lifetimeLabel = "" + (showTau ? TAU : LAMBDA); 196 199 197 200 m_frame = new JFrame("SLIM Plugin"); 198 m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);201 //m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 199 202 200 203 // create outer panel … … 206 209 innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); 207 210 208 JPanel fitPanel = createFitPanel( );211 JPanel fitPanel = createFitPanel(analysis); 209 212 fitPanel.setBorder(border("Fit")); 210 213 innerPanel.add(fitPanel); … … 297 300 } 298 301 299 private JPanel createFitPanel( ) {302 private JPanel createFitPanel(SLIMAnalysis analysis) { 300 303 JPanel fitPanel = new JPanel(); 301 304 fitPanel.setBorder(new EmptyBorder(0, 0, 8, 8)); … … 331 334 fitPanel.add(m_functionComboBox); 332 335 336 JLabel analysisLabel = new JLabel("Analysis"); 337 analysisLabel.setHorizontalAlignment(SwingConstants.RIGHT); 338 fitPanel.add(analysisLabel); 339 m_analysisComboBox = new JComboBox(analysis.getNames()); 340 fitPanel.add(m_analysisComboBox); 341 333 342 // rows, cols, initX, initY, xPad, yPad 334 SpringUtilities.makeCompactGrid(fitPanel, 3, 2, 4, 4, 4, 4);343 SpringUtilities.makeCompactGrid(fitPanel, 4, 2, 4, 4, 4, 4); 335 344 336 345 JPanel panel = new JPanel(new BorderLayout()); 337 346 panel.add("North", fitPanel); 338 347 348 m_fitAllChannels = new JCheckBox("Fit all channels"); 349 m_fitAllChannels.setSelected(true); 350 351 panel.add("South", m_fitAllChannels); 339 352 return panel; 340 353 } … … 758 771 */ 759 772 private void enableAll(boolean enable) { 773 // fit algorithm settings 760 774 m_regionComboBox.setEnabled(enable); 761 775 m_algorithmComboBox.setEnabled(enable); 762 776 m_functionComboBox.setEnabled(enable); 763 764 // fit settings 777 m_analysisComboBox.setEnabled(enable); 778 m_fitAllChannels.setEnabled(enable); 779 780 // fit control settings 765 781 m_xField.setEditable(enable); 766 782 m_yField.setEditable(enable); … … 877 893 } 878 894 895 public String getAnalysis() { 896 String selected = (String) m_analysisComboBox.getSelectedItem(); 897 return selected; 898 } 899 900 public boolean getFitAllChannels() { 901 return m_fitAllChannels.isSelected(); 902 } 903 879 904 public int getX() { 880 905 return parseInt(m_xField); … … 917 942 } 918 943 919 public int get Components() {920 int co mponents= 0;944 public int getParameterCount() { 945 int count = 0; 921 946 String function = (String) m_functionComboBox.getSelectedItem(); 922 947 if (function.equals(SINGLE_EXPONENTIAL)) { 923 co mponents= 3;948 count = 3; 924 949 } 925 950 else if (function.equals(DOUBLE_EXPONENTIAL)) { 926 co mponents= 5;951 count = 5; 927 952 } 928 953 else if (function.equals(TRIPLE_EXPONENTIAL)) { 929 co mponents= 7;954 count = 7; 930 955 } 931 956 else if (function.equals(STRETCHED_EXPONENTIAL)) { 932 co mponents= 4;933 } 934 return co mponents;935 } 936 937 public void setFitted Components(int components) {938 m_fitted Components = components;957 count = 4; 958 } 959 return count; 960 } 961 962 public void setFittedParameterCount(int count) { 963 m_fittedParameterCount = count; 939 964 } 940 965 … … 1122 1147 } 1123 1148 1124 void reconcileStartParam() { 1125 boolean enable = (m_fittedComponents == getComponents()); 1149 /** 1150 * This decides whether the existing parameters could be used as the 1151 * initial values for another fit. 1152 */ 1153 private void reconcileStartParam() { 1154 // parameter counts happen to be unique for each fit function 1155 boolean enable = (m_fittedParameterCount == getParameterCount()); 1126 1156 m_startParam1.setEnabled(enable); 1127 1157 m_startParam2.setEnabled(enable);
Note: See TracChangeset
for help on using the changeset viewer.