1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
33 |
|
|
34 |
import java.util.logging.Level; |
import java.util.logging.Level; |
35 |
|
|
36 |
|
import javax.swing.SwingUtilities; |
37 |
|
|
38 |
import org.jsampler.CC; |
import org.jsampler.CC; |
39 |
import org.jsampler.HF; |
import org.jsampler.HF; |
40 |
|
|
|
|
|
41 |
/** |
/** |
42 |
* This class provides information about the available views in the current distribution. |
* This class provides information about the available views in the current distribution. |
43 |
* @author Grigor Iliev |
* @author Grigor Iliev |
101 |
CC.getLogger().info("Missing view: " + viewName); |
CC.getLogger().info("Missing view: " + viewName); |
102 |
return; |
return; |
103 |
} |
} |
104 |
|
if(CC.getMainFrame() != null) { |
105 |
|
SwingUtilities.invokeLater(new Runnable() { |
106 |
|
public void |
107 |
|
run() { CC.getMainFrame().setVisible(false); } |
108 |
|
}); |
109 |
|
} |
110 |
|
|
111 |
if(CC.getMainFrame() != null) CC.getMainFrame().setVisible(false); |
try { |
112 |
|
CC.setViewConfig ( |
113 |
try { CC.setMainFrame((JSMainFrame) Class.forName(entry.mainFrame).newInstance()); } |
(JSViewConfig)Class.forName(entry.viewConfig).newInstance() |
114 |
catch(Exception e) { |
); |
115 |
|
} catch(Exception e) { |
116 |
CC.getLogger().info(HF.getErrorMessage(e)); |
CC.getLogger().info(HF.getErrorMessage(e)); |
|
if(CC.getMainFrame() != null) CC.getMainFrame().setVisible(true); |
|
117 |
return; |
return; |
118 |
} |
} |
119 |
|
|
120 |
try { CC.setProgressIndicator ( |
final ViewEntry e = entry; |
121 |
(JSProgress)Class.forName(entry.progressIndicator).newInstance() |
SwingUtilities.invokeLater(new Runnable() { |
122 |
);} catch(Exception e) { CC.getLogger().info(HF.getErrorMessage(e)); } |
public void |
123 |
|
run() { setView0(e); } |
124 |
CC.getMainFrame().setVisible(true); |
}); |
125 |
|
} |
126 |
currentView = viewName; |
|
127 |
|
private static void |
128 |
|
setView0(ViewEntry entry) { |
129 |
|
try { |
130 |
|
CC.setMainFrame((JSMainFrame)Class.forName(entry.mainFrame).newInstance()); |
131 |
|
CC.setProgressIndicator ( |
132 |
|
(JSProgress)Class.forName(entry.progressIndicator).newInstance() |
133 |
|
); |
134 |
|
CC.getMainFrame().setVisible(true); |
135 |
|
currentView = entry.name; |
136 |
|
} catch(Exception e) { |
137 |
|
CC.getLogger().log(Level.INFO, HF.getErrorMessage(e), e); |
138 |
|
return; |
139 |
|
} |
140 |
} |
} |
141 |
|
|
142 |
/** |
/** |
167 |
|
|
168 |
ViewEntry ve = new ViewEntry(); |
ViewEntry ve = new ViewEntry(); |
169 |
ve.name = a.getValue("View-Name"); |
ve.name = a.getValue("View-Name"); |
170 |
|
ve.viewConfig = a.getValue("View-Config"); |
171 |
ve.mainFrame = a.getValue("Main-Frame"); |
ve.mainFrame = a.getValue("Main-Frame"); |
172 |
ve.progressIndicator = a.getValue("Progress-Indicator"); |
ve.progressIndicator = a.getValue("Progress-Indicator"); |
173 |
|
|
184 |
|
|
185 |
private static class ViewEntry { |
private static class ViewEntry { |
186 |
String name; |
String name; |
187 |
|
String viewConfig; |
188 |
String mainFrame; |
String mainFrame; |
189 |
String progressIndicator; |
String progressIndicator; |
190 |
} |
} |