Révision 1998
| tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 1998) | ||
|---|---|---|
| 5 | 5 |
import org.txm.chartsengine.core.ChartsEngine; |
| 6 | 6 |
import org.txm.core.preferences.TXMPreferences; |
| 7 | 7 |
import org.txm.utils.OSDetector; |
| 8 |
import org.txm.utils.logger.Log; |
|
| 8 | 9 |
|
| 9 | 10 |
/** |
| 10 | 11 |
* Preferences initializer and manager. |
| ... | ... | |
| 22 | 23 |
|
| 23 | 24 |
|
| 24 | 25 |
/** |
| 26 |
* The order list used when look for the first charts engine that can manage a chart type. |
|
| 27 |
*/ |
|
| 28 |
public final static String CHARTS_ENGINES_ORDER = "charts_engines_order"; //$NON-NLS-1$ |
|
| 29 |
|
|
| 30 |
|
|
| 31 |
/** |
|
| 25 | 32 |
* Constant for showing title or not in the charts. |
| 26 | 33 |
*/ |
| 27 | 34 |
public final static String SHOW_TITLE = "show_title"; //$NON-NLS-1$ |
| ... | ... | |
| 67 | 74 |
|
| 68 | 75 |
|
| 69 | 76 |
// local result preferences |
| 77 |
/** |
|
| 78 |
* Chart type. |
|
| 79 |
*/ |
|
| 70 | 80 |
public final static String CHART_TYPE = "chart_type"; //$NON-NLS-1$ |
| 71 | 81 |
|
| 72 |
|
|
| 82 |
/** |
|
| 83 |
* Default chart type name. |
|
| 84 |
*/ |
|
| 73 | 85 |
public final static String DEFAULT_CHART_TYPE = "[Default]"; //$NON-NLS-1$ |
| 74 | 86 |
|
| 75 | 87 |
|
| ... | ... | |
| 120 | 132 |
|
| 121 | 133 |
preferences.put(FONT, defaultFont); |
| 122 | 134 |
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
/** |
|
| 138 |
* Gets the engines order from the specified string with | separator. |
|
| 139 |
* @param enginesOrder |
|
| 140 |
* @return |
|
| 141 |
*/ |
|
| 142 |
public static String[] getEnginesOrder(String enginesOrder) {
|
|
| 143 |
|
|
| 144 |
String[] orderedEnginesNames = enginesOrder.split("\\|");
|
|
| 145 |
|
|
| 146 |
if(orderedEnginesNames.length == 1 && orderedEnginesNames[0].isEmpty()) {
|
|
| 147 |
return null; |
|
| 148 |
} |
|
| 149 |
else {
|
|
| 150 |
return orderedEnginesNames; |
|
| 151 |
} |
|
| 152 |
} |
|
| 153 |
|
|
| 154 |
|
|
| 155 |
/** |
|
| 156 |
* Creates the engines order string with | separator from the specified engines list. |
|
| 157 |
* @param enginesNames |
|
| 158 |
* @return |
|
| 159 |
*/ |
|
| 160 |
public static String createEnginesOrder(String[] enginesNames) {
|
|
| 161 |
StringBuilder sb = new StringBuilder(); |
|
| 162 |
for (int i = 0; i < enginesNames.length; i++) {
|
|
| 163 |
if(i > 0) {
|
|
| 164 |
sb.append("|");
|
|
| 165 |
} |
|
| 166 |
sb.append(enginesNames[i]); |
|
| 167 |
} |
|
| 168 |
|
|
| 169 |
Log.finest("ChartsEnginePreferences.createChartsEnginesOrder():" + sb);
|
|
| 170 |
|
|
| 171 |
return sb.toString(); |
|
| 172 |
} |
|
| 173 |
|
|
| 174 |
/** |
|
| 175 |
* Gets the name of the first engine stored in the engines order preference. |
|
| 176 |
* @param enginesOrder |
|
| 177 |
* @return |
|
| 178 |
*/ |
|
| 179 |
public static String getFirstEngineName() {
|
|
| 180 |
return getEnginesOrder(getInstance().getString(CHARTS_ENGINES_ORDER))[0]; |
|
| 181 |
} |
|
| 182 |
|
|
| 183 |
|
|
| 184 |
/** |
|
| 185 |
* Gets the engines order from stored in the preferences. |
|
| 186 |
* @return |
|
| 187 |
*/ |
|
| 188 |
public String[] getEnginesOrder() {
|
|
| 189 |
return getEnginesOrder(this.getString(ChartsEnginePreferences.CHARTS_ENGINES_ORDER)); |
|
| 190 |
} |
|
| 191 |
|
|
| 192 |
|
|
| 123 | 193 |
} |
| 124 | 194 |
|
Formats disponibles : Unified diff