Révision 2695
| tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 2695) | ||
|---|---|---|
| 94 | 94 |
* @author mdecorde |
| 95 | 95 |
*/ |
| 96 | 96 |
public class CooccurrencesEditor extends TXMEditor<Cooccurrence> {
|
| 97 |
|
|
| 97 |
|
|
| 98 | 98 |
/** The Constant ID. */ |
| 99 |
public static final String ID = CooccurrencesEditor.class.getName(); //$NON-NLS-1$
|
|
| 100 |
|
|
| 99 |
public static final String ID = CooccurrencesEditor.class.getName(); |
|
| 100 |
|
|
| 101 | 101 |
/** The cooc. */ |
| 102 | 102 |
Cooccurrence cooc; |
| 103 |
|
|
| 104 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 | 105 |
/** The empant panel. */ |
| 106 | 106 |
EmpantWidget empantPanel; |
| 107 |
|
|
| 107 |
|
|
| 108 | 108 |
/** The line table viewer. */ |
| 109 | 109 |
TableViewer viewer; |
| 110 |
|
|
| 110 |
|
|
| 111 | 111 |
/** The n column. */ |
| 112 | 112 |
TableColumn nColumn; |
| 113 |
|
|
| 113 |
|
|
| 114 | 114 |
/** The occ column. */ |
| 115 | 115 |
TableColumn occColumn; |
| 116 |
|
|
| 116 |
|
|
| 117 | 117 |
/** The freq column. */ |
| 118 | 118 |
TableColumn freqColumn; |
| 119 |
|
|
| 119 |
|
|
| 120 | 120 |
/** The nbocc column. */ |
| 121 | 121 |
TableColumn nboccColumn; |
| 122 |
|
|
| 122 |
|
|
| 123 | 123 |
/** The score column. */ |
| 124 | 124 |
TableColumn scoreColumn; |
| 125 |
|
|
| 125 |
|
|
| 126 | 126 |
/** The dist column. */ |
| 127 | 127 |
TableColumn distColumn; |
| 128 |
|
|
| 128 |
|
|
| 129 | 129 |
/** The current comparator. */ |
| 130 | 130 |
CLineComparator currentComparator; |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 | 134 |
// params |
| 135 | 135 |
/** The query widget. */ |
| 136 |
@Parameter(key=CooccurrencePreferences.QUERY)
|
|
| 136 |
@Parameter(key = CooccurrencePreferences.QUERY)
|
|
| 137 | 137 |
AssistedQueryWidget queryWidget; |
| 138 |
|
|
| 139 |
// /** The query widget. */
|
|
| 140 |
// @Parameter(key=CooccurrencePreferences.QUERY_FILTER)
|
|
| 141 |
// AssistedQueryWidget coocQueryWidget;
|
|
| 142 |
|
|
| 138 |
|
|
| 139 |
// /** The query widget. */
|
|
| 140 |
// @Parameter(key=CooccurrencePreferences.QUERY_FILTER)
|
|
| 141 |
// AssistedQueryWidget coocQueryWidget;
|
|
| 142 |
|
|
| 143 | 143 |
/** The props area. */ |
| 144 |
@Parameter(key=TXMPreferences.UNIT_PROPERTIES)
|
|
| 144 |
@Parameter(key = TXMPreferences.UNIT_PROPERTIES)
|
|
| 145 | 145 |
PropertiesSelector<WordProperty> propertiesSelector; |
| 146 |
|
|
| 146 |
|
|
| 147 | 147 |
/** The T freq. */ |
| 148 |
@Parameter(key=TXMPreferences.F_MIN)
|
|
| 148 |
@Parameter(key = TXMPreferences.F_MIN)
|
|
| 149 | 149 |
Spinner fMin; |
| 150 |
|
|
| 150 |
|
|
| 151 | 151 |
/** The T count. */ |
| 152 |
@Parameter(key=CooccurrencePreferences.MIN_COUNT)
|
|
| 152 |
@Parameter(key = CooccurrencePreferences.MIN_COUNT)
|
|
| 153 | 153 |
Spinner cMin; |
| 154 |
|
|
| 154 |
|
|
| 155 | 155 |
/** The T score. */ |
| 156 |
@Parameter(key=CooccurrencePreferences.MIN_SCORE)
|
|
| 156 |
@Parameter(key = CooccurrencePreferences.MIN_SCORE)
|
|
| 157 | 157 |
FloatSpinner minScore; |
| 158 |
|
|
| 158 |
|
|
| 159 | 159 |
private Label infoLine; |
| 160 |
|
|
| 161 |
|
|
| 162 |
|
|
| 160 |
|
|
| 161 |
|
|
| 162 |
|
|
| 163 | 163 |
/** |
| 164 | 164 |
* Initialize the editor with the cooccurrences TXMResult |
| 165 | 165 |
* |
| ... | ... | |
| 175 | 175 |
@Override |
| 176 | 176 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
| 177 | 177 |
super.init(site, input); |
| 178 |
|
|
| 178 |
|
|
| 179 | 179 |
this.cooc = (Cooccurrence) ((TXMResultEditorInput<?>) input).getResult(); |
| 180 | 180 |
} |
| 181 |
|
|
| 181 |
|
|
| 182 | 182 |
/** |
| 183 | 183 |
* Creates the part control. |
| 184 | 184 |
* |
| ... | ... | |
| 188 | 188 |
*/ |
| 189 | 189 |
@Override |
| 190 | 190 |
public void _createPartControl() {
|
| 191 |
|
|
| 191 |
|
|
| 192 | 192 |
final Composite paramArea = this.getExtendedParametersGroup(); |
| 193 | 193 |
FormLayout paramLayout = new FormLayout(); |
| 194 | 194 |
paramArea.setLayout(paramLayout); |
| 195 |
|
|
| 195 |
|
|
| 196 | 196 |
// Computing listeners |
| 197 | 197 |
ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this); |
| 198 | 198 |
ComputeKeyListener computeKeyListener = new ComputeKeyListener(this); |
| 199 |
|
|
| 200 |
|
|
| 201 | 199 |
|
| 200 |
|
|
| 201 |
|
|
| 202 | 202 |
// Main parameters area |
| 203 | 203 |
Composite queryArea = new Composite(paramArea, SWT.NONE); |
| 204 |
|
|
| 204 |
|
|
| 205 | 205 |
FormData queryLayoutData = new FormData(); |
| 206 | 206 |
queryLayoutData.top = new FormAttachment(0); |
| 207 | 207 |
queryLayoutData.left = new FormAttachment(0); |
| 208 | 208 |
queryLayoutData.right = new FormAttachment(100); |
| 209 | 209 |
queryArea.setLayoutData(queryLayoutData); |
| 210 |
|
|
| 210 |
|
|
| 211 | 211 |
queryArea.setLayout(new GridLayout(3, false)); |
| 212 |
|
|
| 212 |
|
|
| 213 | 213 |
this.getMainParametersComposite().getLayout().numColumns = 3; |
| 214 | 214 |
this.getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
| 215 |
|
|
| 215 |
|
|
| 216 | 216 |
Label queryLabel = new Label(getMainParametersComposite(), SWT.NONE); |
| 217 | 217 |
queryLabel.setText(TXMCoreMessages.common_query); |
| 218 | 218 |
queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true)); |
| 219 |
|
|
| 219 |
|
|
| 220 | 220 |
// [ (v)] |
| 221 | 221 |
queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, this.cooc.getCorpus()); |
| 222 | 222 |
GridData layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER); |
| ... | ... | |
| 225 | 225 |
queryWidget.setLayoutData(layoutData); |
| 226 | 226 |
queryWidget.addKeyListener(computeKeyListener); |
| 227 | 227 |
queryWidget.getQueryWidget().addModifyListener(computeKeyListener); |
| 228 |
|
|
| 229 |
|
|
| 230 |
//TODO add new parameter to select the cooccurrents with a CQL
|
|
| 231 |
// queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
|
|
| 232 |
// queryLabel.setText("Cooc");
|
|
| 233 |
// queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true));
|
|
| 234 |
// // [ (v)]
|
|
| 235 |
// coocQueryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, this.cooc.getCorpus());
|
|
| 236 |
// layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
|
| 237 |
// layoutData.horizontalAlignment = GridData.FILL;
|
|
| 238 |
// layoutData.grabExcessHorizontalSpace = true;
|
|
| 239 |
// coocQueryWidget.setLayoutData(layoutData);
|
|
| 240 |
// coocQueryWidget.addKeyListener(computeKeyListener);
|
|
| 241 |
|
|
| 228 |
|
|
| 229 |
|
|
| 230 |
// TODO add new parameter to select the cooccurrents with a CQL
|
|
| 231 |
// queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
|
|
| 232 |
// queryLabel.setText("Cooc");
|
|
| 233 |
// queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true));
|
|
| 234 |
// // [ (v)]
|
|
| 235 |
// coocQueryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, this.cooc.getCorpus());
|
|
| 236 |
// layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
|
| 237 |
// layoutData.horizontalAlignment = GridData.FILL;
|
|
| 238 |
// layoutData.grabExcessHorizontalSpace = true;
|
|
| 239 |
// coocQueryWidget.setLayoutData(layoutData);
|
|
| 240 |
// coocQueryWidget.addKeyListener(computeKeyListener);
|
|
| 241 |
|
|
| 242 | 242 |
// FIXME: became useless? |
| 243 |
// final Button go = new Button(queryArea, SWT.BOLD);
|
|
| 244 |
// go.setText(CooccurrenceUIMessages.CooccurrencesEditor_2);
|
|
| 243 |
// final Button go = new Button(queryArea, SWT.BOLD);
|
|
| 244 |
// go.setText(CooccurrenceUIMessages.CooccurrencesEditor_2);
|
|
| 245 | 245 |
// |
| 246 |
// Font f = go.getFont();
|
|
| 247 |
// FontData defaultFont = f.getFontData()[0];
|
|
| 248 |
// defaultFont.setStyle(SWT.BOLD);
|
|
| 249 |
// Font newf = new Font(go.getDisplay(), defaultFont);
|
|
| 250 |
// go.setFont(newf);
|
|
| 246 |
// Font f = go.getFont();
|
|
| 247 |
// FontData defaultFont = f.getFontData()[0];
|
|
| 248 |
// defaultFont.setStyle(SWT.BOLD);
|
|
| 249 |
// Font newf = new Font(go.getDisplay(), defaultFont);
|
|
| 250 |
// go.setFont(newf);
|
|
| 251 | 251 |
// |
| 252 |
// layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
|
| 253 |
// layoutData.horizontalAlignment = GridData.FILL;
|
|
| 254 |
// layoutData.grabExcessHorizontalSpace = false;
|
|
| 255 |
// go.setLayoutData(layoutData);
|
|
| 252 |
// layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
|
| 253 |
// layoutData.horizontalAlignment = GridData.FILL;
|
|
| 254 |
// layoutData.grabExcessHorizontalSpace = false;
|
|
| 255 |
// go.setLayoutData(layoutData);
|
|
| 256 | 256 |
// |
| 257 |
// go.addSelectionListener(new SelectionListener() {
|
|
| 258 |
// @Override
|
|
| 259 |
// public void widgetSelected(SelectionEvent e) {
|
|
| 260 |
// updateResultFromEditor();
|
|
| 261 |
// compute(true);
|
|
| 262 |
// // FIXME old method
|
|
| 263 |
// //TXMEditor.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this);
|
|
| 264 |
// }
|
|
| 257 |
// go.addSelectionListener(new SelectionListener() {
|
|
| 258 |
// @Override
|
|
| 259 |
// public void widgetSelected(SelectionEvent e) {
|
|
| 260 |
// updateResultFromEditor();
|
|
| 261 |
// compute(true);
|
|
| 262 |
// // FIXME old method
|
|
| 263 |
// //TXMEditor.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this);
|
|
| 264 |
// }
|
|
| 265 | 265 |
// |
| 266 |
// @Override |
|
| 267 |
// public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 268 |
// } |
|
| 269 |
// }); |
|
| 270 |
|
|
| 266 |
// @Override |
|
| 267 |
// public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 268 |
// } |
|
| 269 |
// }); |
|
| 271 | 270 |
|
| 272 | 271 |
|
| 273 | 272 |
|
| 273 |
|
|
| 274 | 274 |
// Extended parameters |
| 275 | 275 |
|
| 276 | 276 |
// Filters |
| ... | ... | |
| 285 | 285 |
layout.wrap = true; |
| 286 | 286 |
layout.center = true; |
| 287 | 287 |
filtercontrols.setLayout(layout); |
| 288 |
|
|
| 288 |
|
|
| 289 | 289 |
// | Properties: word_pos [Edit] | |
| 290 |
propertiesSelector = new PropertiesSelector<WordProperty>(filtercontrols, SWT.NONE);
|
|
| 290 |
propertiesSelector = new PropertiesSelector<>(filtercontrols, SWT.NONE); |
|
| 291 | 291 |
propertiesSelector.setLayout(new GridLayout(4, false)); |
| 292 | 292 |
propertiesSelector.setCorpus(this.getCorpus()); |
| 293 | 293 |
propertiesSelector.setTitle(CooccurrenceUIMessages.cooccurrentsPropertiesColon); |
| 294 | 294 |
propertiesSelector.addSelectionListener(computeSelectionListener); |
| 295 |
|
|
| 295 |
|
|
| 296 | 296 |
// Thresholds |
| 297 | 297 |
// Fmin |
| 298 | 298 |
LabeledSpinner fMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.thresholdsColonFmin); |
| 299 | 299 |
this.fMin = fMin.getSpinner(); |
| 300 |
|
|
| 300 |
|
|
| 301 | 301 |
// Cmin |
| 302 | 302 |
LabeledSpinner cMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.cmin); |
| 303 | 303 |
this.cMin = cMin.getSpinner(); |
| 304 |
|
|
| 304 |
|
|
| 305 | 305 |
// Minimum score |
| 306 | 306 |
LabeledSpinner minimumScore = new LabeledSpinner(filtercontrols, this, new Label(filtercontrols, SWT.NONE), new FloatSpinner(filtercontrols, SWT.BORDER), CooccurrenceUIMessages.score_2); |
| 307 | 307 |
this.minScore = (FloatSpinner) minimumScore.getSpinner(); |
| 308 |
|
|
| 308 |
|
|
| 309 | 309 |
// empant |
| 310 | 310 |
empantPanel = new EmpantWidget(paramArea, SWT.NONE, this.getCorpus()); |
| 311 |
|
|
| 311 |
|
|
| 312 | 312 |
FormData empantLayoutData = new FormData(); |
| 313 | 313 |
empantLayoutData.top = new FormAttachment(filtercontrols, 0); |
| 314 | 314 |
empantLayoutData.bottom = new FormAttachment(100); |
| ... | ... | |
| 325 | 325 |
|
| 326 | 326 |
// result area |
| 327 | 327 |
Composite resultArea = this.getResultArea(); |
| 328 |
|
|
| 328 |
|
|
| 329 | 329 |
viewer = new TableViewer(resultArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); |
| 330 | 330 |
viewer.getTable().addKeyListener(new TableKeyListener(viewer)); |
| 331 | 331 |
viewer.getTable().setLinesVisible(true); |
| 332 | 332 |
viewer.getTable().setHeaderVisible(true); |
| 333 |
|
|
| 333 |
|
|
| 334 | 334 |
String fontName = cooc.getCorpus().getFont(); |
| 335 | 335 |
if (fontName != null && fontName.length() > 0) {
|
| 336 | 336 |
Font old = viewer.getTable().getFont(); |
| ... | ... | |
| 340 | 340 |
Font font = new Font(Display.getCurrent(), fontName, fD.getHeight(), fD.getStyle()); |
| 341 | 341 |
viewer.getTable().setFont(font); |
| 342 | 342 |
} |
| 343 |
|
|
| 343 |
|
|
| 344 | 344 |
viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 345 |
|
|
| 345 |
|
|
| 346 | 346 |
viewer.setLabelProvider(new LineLabelProvider()); |
| 347 | 347 |
viewer.setContentProvider(new LineContentProvider()); |
| 348 |
|
|
| 348 |
|
|
| 349 | 349 |
nColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 350 | 350 |
nColumn.setText(" "); //$NON-NLS-1$
|
| 351 | 351 |
nColumn.pack(); |
| 352 |
|
|
| 352 |
|
|
| 353 | 353 |
occColumn = new TableColumn(viewer.getTable(), SWT.LEFT); |
| 354 | 354 |
occColumn.setText(CooccurrenceUIMessages.cooccurrent); |
| 355 | 355 |
occColumn.setToolTipText(CooccurrenceUIMessages.cooccurrent); |
| 356 | 356 |
occColumn.setWidth(200); |
| 357 | 357 |
occColumn.addSelectionListener(new SelectionListener() {
|
| 358 |
|
|
| 358 | 359 |
@Override |
| 359 | 360 |
public void widgetSelected(SelectionEvent e) {
|
| 360 | 361 |
setColComparator(new OccComparator(), occColumn); |
| 361 | 362 |
sort(); |
| 362 | 363 |
} |
| 363 |
|
|
| 364 |
|
|
| 364 | 365 |
@Override |
| 365 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 366 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 366 | 367 |
}); |
| 367 |
|
|
| 368 |
|
|
| 368 | 369 |
freqColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 369 | 370 |
freqColumn.setText(TXMCoreMessages.common_frequency); |
| 370 | 371 |
freqColumn.setToolTipText(TXMCoreMessages.common_frequency); |
| 371 | 372 |
freqColumn.setWidth(100); |
| 372 | 373 |
freqColumn.addSelectionListener(new SelectionListener() {
|
| 374 |
|
|
| 373 | 375 |
@Override |
| 374 | 376 |
public void widgetSelected(SelectionEvent e) {
|
| 375 | 377 |
setColComparator(new FreqComparator(), freqColumn); |
| 376 | 378 |
sort(); |
| 377 | 379 |
} |
| 378 |
|
|
| 380 |
|
|
| 379 | 381 |
@Override |
| 380 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 382 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 381 | 383 |
}); |
| 382 |
|
|
| 384 |
|
|
| 383 | 385 |
nboccColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 384 | 386 |
nboccColumn.setText(CooccurrenceUIMessages.cofrequency); |
| 385 | 387 |
nboccColumn.setToolTipText(CooccurrenceUIMessages.cofrequency); |
| 386 | 388 |
nboccColumn.setWidth(130); |
| 387 | 389 |
nboccColumn.addSelectionListener(new SelectionListener() {
|
| 390 |
|
|
| 388 | 391 |
@Override |
| 389 | 392 |
public void widgetSelected(SelectionEvent e) {
|
| 390 | 393 |
setColComparator(new NbOccComparator(), nboccColumn); |
| 391 | 394 |
sort(); |
| 392 | 395 |
} |
| 393 |
|
|
| 396 |
|
|
| 394 | 397 |
@Override |
| 395 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 398 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 396 | 399 |
}); |
| 397 |
|
|
| 400 |
|
|
| 398 | 401 |
scoreColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 399 | 402 |
scoreColumn.setText(CooccurrenceUIMessages.score); |
| 400 | 403 |
scoreColumn.setToolTipText(CooccurrenceUIMessages.score); |
| 401 | 404 |
scoreColumn.setWidth(100); |
| 402 | 405 |
scoreColumn.addSelectionListener(new SelectionListener() {
|
| 406 |
|
|
| 403 | 407 |
@Override |
| 404 | 408 |
public void widgetSelected(SelectionEvent e) {
|
| 405 | 409 |
setColComparator(new ScoreComparator(), scoreColumn); |
| 406 | 410 |
sort(); |
| 407 | 411 |
} |
| 408 |
|
|
| 412 |
|
|
| 409 | 413 |
@Override |
| 410 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 414 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 411 | 415 |
}); |
| 412 |
|
|
| 416 |
|
|
| 413 | 417 |
distColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 414 | 418 |
distColumn.setText(CooccurrenceUIMessages.meanDistance); |
| 415 | 419 |
distColumn.setToolTipText(CooccurrenceUIMessages.meanDistance); |
| 416 | 420 |
distColumn.setWidth(130); |
| 417 | 421 |
distColumn.addSelectionListener(new SelectionListener() {
|
| 422 |
|
|
| 418 | 423 |
@Override |
| 419 | 424 |
public void widgetSelected(SelectionEvent e) {
|
| 420 | 425 |
setColComparator(new DistComparator(), distColumn); |
| 421 | 426 |
sort(); |
| 422 | 427 |
} |
| 423 |
|
|
| 428 |
|
|
| 424 | 429 |
@Override |
| 425 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 430 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 426 | 431 |
}); |
| 427 |
|
|
| 432 |
|
|
| 428 | 433 |
TableColumn n2Column = new TableColumn(viewer.getTable(), SWT.RIGHT); |
| 429 | 434 |
n2Column.setText(""); //$NON-NLS-1$
|
| 430 | 435 |
n2Column.pack(); |
| 431 |
|
|
| 432 |
|
|
| 433 |
|
|
| 436 |
|
|
| 437 |
|
|
| 438 |
|
|
| 434 | 439 |
// Add double click, "Send to" command |
| 435 | 440 |
TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$ |
| 436 |
|
|
| 441 |
|
|
| 437 | 442 |
// Register the context menu |
| 438 | 443 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
| 439 |
|
|
| 444 |
|
|
| 440 | 445 |
// descending initial sorting on score column |
| 441 | 446 |
viewer.getTable().setSortColumn(scoreColumn); |
| 442 | 447 |
viewer.getTable().setSortDirection(SWT.UP); |
| 443 | 448 |
currentComparator = new ScoreComparator(); |
| 444 | 449 |
setColComparator(new ScoreComparator(), scoreColumn); |
| 445 | 450 |
sort(); |
| 446 |
|
|
| 451 |
|
|
| 447 | 452 |
} |
| 448 |
|
|
| 453 |
|
|
| 449 | 454 |
/** |
| 450 | 455 |
* Sets the col comparator. |
| 451 | 456 |
* |
| ... | ... | |
| 469 | 474 |
currentComparator.initialize(cooc.getCorpus()); |
| 470 | 475 |
} |
| 471 | 476 |
} |
| 472 |
|
|
| 473 |
|
|
| 477 |
|
|
| 478 |
|
|
| 474 | 479 |
/** |
| 475 | 480 |
* Gets the pointed column. |
| 476 | 481 |
* |
| ... | ... | |
| 486 | 491 |
if (x < sumWidthColumn) {
|
| 487 | 492 |
return 0; |
| 488 | 493 |
} |
| 489 |
|
|
| 494 |
|
|
| 490 | 495 |
sumWidthColumn += this.occColumn.getWidth(); |
| 491 | 496 |
if (x < sumWidthColumn) {
|
| 492 | 497 |
return 1; |
| 493 | 498 |
} |
| 494 |
|
|
| 499 |
|
|
| 495 | 500 |
sumWidthColumn += this.freqColumn.getWidth(); |
| 496 | 501 |
if (x < sumWidthColumn) {
|
| 497 | 502 |
return 2; |
| 498 | 503 |
} |
| 499 |
|
|
| 504 |
|
|
| 500 | 505 |
sumWidthColumn += this.nboccColumn.getWidth(); |
| 501 | 506 |
if (x < sumWidthColumn) {
|
| 502 | 507 |
return 3; |
| 503 | 508 |
} |
| 504 |
|
|
| 509 |
|
|
| 505 | 510 |
sumWidthColumn += this.scoreColumn.getWidth(); |
| 506 | 511 |
if (x < sumWidthColumn) {
|
| 507 | 512 |
return 4; |
| 508 | 513 |
} |
| 509 |
|
|
| 514 |
|
|
| 510 | 515 |
sumWidthColumn += this.distColumn.getWidth(); |
| 511 | 516 |
if (x < sumWidthColumn) {
|
| 512 | 517 |
return 5; |
| 513 | 518 |
} |
| 514 |
|
|
| 519 |
|
|
| 515 | 520 |
return 5; |
| 516 | 521 |
} |
| 517 |
|
|
| 522 |
|
|
| 518 | 523 |
/** |
| 519 | 524 |
* Creates some parameters from the current widget values. |
| 520 | 525 |
* |
| 521 | 526 |
* @return |
| 522 | 527 |
*/ |
| 523 | 528 |
public TXMParameters getWidgetsParameters() {
|
| 524 |
|
|
| 529 |
|
|
| 525 | 530 |
TXMParameters parameters = new TXMParameters(); |
| 526 | 531 |
parameters.put(CooccurrencePreferences.UNIT_PROPERTIES, new ArrayList<Property>(this.propertiesSelector.getSelectedProperties())); |
| 527 | 532 |
parameters.put(CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT, this.empantPanel.getStruct()); |
| ... | ... | |
| 533 | 538 |
parameters.put(CooccurrencePreferences.MIN_COUNT, this.cMin.getSelection()); |
| 534 | 539 |
parameters.put(CooccurrencePreferences.INCLUDE_X_PIVOT, this.empantPanel.getXPivot()); |
| 535 | 540 |
parameters.put(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE, this.getBooleanParameterValue(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE)); |
| 536 |
|
|
| 541 |
|
|
| 537 | 542 |
Double minScore = 0.0; |
| 538 | 543 |
try {
|
| 539 | 544 |
Double d = Double.parseDouble(this.minScore.getText().replace(",", "."));
|
| 540 | 545 |
minScore = d; |
| 541 |
} catch (Exception e) {
|
|
| 546 |
} |
|
| 547 |
catch (Exception e) {
|
|
| 542 | 548 |
Log.severe(NLS.bind(CooccurrenceUIMessages.theScoreThresholdMustBeARealNumberCurrentValueEqualsP0, this.minScore.getText())); |
| 543 | 549 |
} |
| 544 |
|
|
| 550 |
|
|
| 545 | 551 |
parameters.put(CooccurrencePreferences.MIN_SCORE, minScore); |
| 546 |
|
|
| 552 |
|
|
| 547 | 553 |
return parameters; |
| 548 | 554 |
} |
| 549 |
|
|
| 550 |
|
|
| 551 |
|
|
| 555 |
|
|
| 556 |
|
|
| 557 |
|
|
| 552 | 558 |
/** |
| 553 | 559 |
* Gets the corpus. |
| 554 | 560 |
* |
| ... | ... | |
| 557 | 563 |
public CQPCorpus getCorpus() {
|
| 558 | 564 |
return cooc.getCorpus(); |
| 559 | 565 |
} |
| 560 |
|
|
| 566 |
|
|
| 561 | 567 |
/** |
| 562 | 568 |
* Gets the cooc. |
| 563 | 569 |
* |
| ... | ... | |
| 566 | 572 |
public Cooccurrence getCooc() {
|
| 567 | 573 |
return this.cooc; |
| 568 | 574 |
} |
| 569 |
|
|
| 575 |
|
|
| 570 | 576 |
/** |
| 571 | 577 |
* Sort. |
| 572 | 578 |
*/ |
| 573 | 579 |
public void sort() {
|
| 574 | 580 |
if (cooc != null && !cooc.isDirty() && currentComparator != null) {
|
| 575 |
|
|
| 581 |
|
|
| 576 | 582 |
try {
|
| 577 | 583 |
Log.fine(NLS.bind(CooccurrenceUIMessages.sortByColonP0, currentComparator.getName())); |
| 578 |
|
|
| 584 |
|
|
| 579 | 585 |
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
|
| 586 |
|
|
| 580 | 587 |
@Override |
| 581 | 588 |
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
| 582 | 589 |
try {
|
| 583 | 590 |
cooc.sort(currentComparator); |
| 584 |
} catch (CqiClientException e) {
|
|
| 591 |
} |
|
| 592 |
catch (CqiClientException e) {
|
|
| 585 | 593 |
Log.severe(TXMCoreMessages.error_errorWhileSortingResult); |
| 586 | 594 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 587 | 595 |
} |
| 588 | 596 |
} |
| 589 | 597 |
}); |
| 590 |
} catch (Exception e) {
|
|
| 598 |
} |
|
| 599 |
catch (Exception e) {
|
|
| 591 | 600 |
Log.severe(TXMCoreMessages.error_errorWhileSortingResult); |
| 592 | 601 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 593 | 602 |
} |
| 594 | 603 |
TXMEditor.packColumns(this.viewer); |
| 595 | 604 |
} |
| 596 | 605 |
} |
| 597 |
|
|
| 598 |
|
|
| 606 |
|
|
| 607 |
|
|
| 599 | 608 |
@Override |
| 600 | 609 |
public void updateEditorFromResult(boolean update) {
|
| 601 |
|
|
| 610 |
|
|
| 602 | 611 |
if (this.cooc.getProperties() != null) {
|
| 603 | 612 |
List<WordProperty> available; |
| 604 | 613 |
try {
|
| 605 |
available = new ArrayList<WordProperty>(this.cooc.getCorpus().getProperties());
|
|
| 614 |
available = new ArrayList<>(this.cooc.getCorpus().getProperties()); |
|
| 606 | 615 |
available.removeAll(cooc.getProperties()); |
| 607 | 616 |
this.propertiesSelector.setProperties(available, cooc.getProperties()); |
| 608 |
} catch (Exception e) {
|
|
| 617 |
} |
|
| 618 |
catch (Exception e) {
|
|
| 609 | 619 |
// TODO Auto-generated catch block |
| 610 | 620 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 611 | 621 |
} |
| 612 | 622 |
} |
| 613 |
|
|
| 623 |
|
|
| 614 | 624 |
// Structural unit limit |
| 615 | 625 |
empantPanel.setStructure(this.cooc.getStructuralUnitLimit()); |
| 616 |
|
|
| 626 |
|
|
| 617 | 627 |
// Contexts |
| 618 | 628 |
empantPanel.setMinLeft(this.getIntParameterValue(CooccurrencePreferences.MIN_LEFT) - 1); |
| 619 | 629 |
empantPanel.setMaxLeft(this.getIntParameterValue(CooccurrencePreferences.MAX_LEFT) - 1); |
| 620 | 630 |
empantPanel.setMinRight(this.getIntParameterValue(CooccurrencePreferences.MIN_RIGHT) - 1); |
| 621 | 631 |
empantPanel.setMaxRight(this.getIntParameterValue(CooccurrencePreferences.MAX_RIGHT) - 1); |
| 622 |
|
|
| 623 |
|
|
| 632 |
empantPanel.setXPivot(this.getBooleanParameterValue(CooccurrencePreferences.INCLUDE_X_PIVOT)); |
|
| 633 |
|
|
| 624 | 634 |
String txt = "t pivot " + cooc.getNumberOfKeyword() + ", v cooc " + cooc.getNumberOfDifferentCooccurrents() + ", t cooc " + cooc.getNumberOfCooccurrents(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 625 | 635 |
try {
|
| 626 | 636 |
txt += ", T corpus " + cooc.getCorpus().getSize(); //$NON-NLS-1$ |
| ... | ... | |
| 629 | 639 |
Log.severe(CooccurrenceUIMessages.errorWhileReadingCorpusSize); |
| 630 | 640 |
} |
| 631 | 641 |
String tooltip = "- " + txt.replaceAll(", ", "\n- "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
| 632 |
|
|
| 633 |
//empantPanel.setInfo(txt, tooltip); |
|
| 642 |
|
|
| 643 |
// empantPanel.setInfo(txt, tooltip);
|
|
| 634 | 644 |
infoLine.setText(txt); |
| 635 | 645 |
infoLine.setToolTipText(tooltip); |
| 636 | 646 |
|
| 637 | 647 |
viewer.setInput(cooc.getLines()); |
| 638 | 648 |
sort(); |
| 639 |
|
|
| 649 |
|
|
| 640 | 650 |
// Pack the columns |
| 641 | 651 |
TXMEditor.packColumns(viewer); |
| 642 |
|
|
| 652 |
|
|
| 643 | 653 |
// FIXME: need to be done in another way after the plugin split |
| 644 | 654 |
QueriesView.refresh(); |
| 645 | 655 |
RVariablesView.refresh(); |
| 646 |
|
|
| 656 |
|
|
| 647 | 657 |
viewer.getTable().setFocus(); |
| 648 | 658 |
} |
| 649 |
|
|
| 650 |
|
|
| 659 |
|
|
| 660 |
|
|
| 651 | 661 |
@Override |
| 652 | 662 |
public void updateResultFromEditor() {
|
| 653 | 663 |
TXMParameters parameters = getWidgetsParameters(); |
| 654 | 664 |
cooc.setParameters(parameters); |
| 655 | 665 |
} |
| 656 |
} |
|
| 666 |
} |
|
| tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/EmpantWidget.java (revision 2695) | ||
|---|---|---|
| 49 | 49 |
* author mdecorde. |
| 50 | 50 |
*/ |
| 51 | 51 |
public class EmpantWidget extends Composite {
|
| 52 |
|
|
| 52 |
|
|
| 53 | 53 |
/** The struct type. */ |
| 54 | 54 |
Button structType; |
| 55 | 55 |
|
| ... | ... | |
| 79 | 79 |
|
| 80 | 80 |
/** The check xword. */ |
| 81 | 81 |
Button checkRight; |
| 82 |
|
|
| 83 |
//Label infoLabel; |
|
| 84 | 82 |
|
| 83 |
// Label infoLabel; |
|
| 84 |
|
|
| 85 | 85 |
/** The corpus. */ |
| 86 | 86 |
CQPCorpus corpus; |
| 87 |
|
|
| 87 |
|
|
| 88 | 88 |
/** |
| 89 | 89 |
* Instantiates a new empant widget. |
| 90 | 90 |
* |
| ... | ... | |
| 96 | 96 |
super(parent, style); |
| 97 | 97 |
this.corpus = corpus; |
| 98 | 98 |
GridLayout mainLayout = new GridLayout(1, true); |
| 99 |
//mainLayout.verticalSpacing = 0; |
|
| 99 |
// mainLayout.verticalSpacing = 0;
|
|
| 100 | 100 |
mainLayout.marginWidth = 0; |
| 101 | 101 |
this.setLayout(mainLayout); |
| 102 | 102 |
|
| ... | ... | |
| 104 | 104 |
Composite line2 = new Composite(this, style); |
| 105 | 105 |
line1.setLayout(new GridLayout(7, false)); |
| 106 | 106 |
line2.setLayout(new GridLayout(9, false)); |
| 107 |
line1.setLayoutData(new GridData(GridData.FILL, GridData.FILL,true,true));
|
|
| 108 |
line2.setLayoutData(new GridData(GridData.FILL, GridData.FILL,true,true));
|
|
| 107 |
line1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 108 |
line2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
| 109 | 109 |
|
| 110 | 110 |
|
| 111 | 111 |
Label l = new Label(line1, SWT.NONE); |
| 112 | 112 |
l.setText(TXMUIMessages.contextColon); |
| 113 |
|
|
| 113 |
|
|
| 114 | 114 |
wordType = new Button(line1, SWT.RADIO); |
| 115 | 115 |
wordType.setText(TXMUIMessages.word); |
| 116 | 116 |
wordType.addSelectionListener(new SelectionListener() {
|
| 117 |
|
|
| 117 | 118 |
@Override |
| 118 | 119 |
public void widgetSelected(SelectionEvent e) {
|
| 119 | 120 |
structs.setEnabled(false); |
| 120 | 121 |
checkXword.setEnabled(false); |
| 121 | 122 |
} |
| 122 |
|
|
| 123 |
|
|
| 123 | 124 |
@Override |
| 124 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 125 |
} |
|
| 125 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 126 | 126 |
}); |
| 127 | 127 |
wordType.setSelection(true); |
| 128 |
|
|
| 128 |
|
|
| 129 | 129 |
structType = new Button(line1, SWT.RADIO); |
| 130 | 130 |
structType.setText(TXMUIMessages.structure); |
| 131 | 131 |
structType.addSelectionListener(new SelectionListener() {
|
| 132 |
|
|
| 132 | 133 |
@Override |
| 133 | 134 |
public void widgetSelected(SelectionEvent e) {
|
| 134 | 135 |
structs.setEnabled(true); |
| 135 | 136 |
checkXword.setEnabled(true); |
| 136 | 137 |
} |
| 137 |
|
|
| 138 |
|
|
| 138 | 139 |
@Override |
| 139 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 140 |
} |
|
| 140 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 141 | 141 |
}); |
| 142 |
|
|
| 142 |
|
|
| 143 | 143 |
// [info] |
| 144 | 144 |
structs = new Combo(line1, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER); |
| 145 | 145 |
GridData layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER); |
| 146 | 146 |
structs.setLayoutData(layoutData); |
| 147 |
|
|
| 147 |
|
|
| 148 | 148 |
checkLeft = new Button(line1, SWT.CHECK); |
| 149 | 149 |
checkLeft.setSelection(true); |
| 150 | 150 |
checkLeft.setText(TXMUIMessages.useLeftWindow); |
| 151 | 151 |
checkLeft.addSelectionListener(new SelectionListener() {
|
| 152 |
|
|
| 152 | 153 |
@Override |
| 153 | 154 |
public void widgetSelected(SelectionEvent e) {
|
| 154 | 155 |
boolean sel = checkLeft.getSelection(); |
| ... | ... | |
| 157 | 158 |
} |
| 158 | 159 |
|
| 159 | 160 |
@Override |
| 160 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 161 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 161 | 162 |
}); |
| 162 | 163 |
|
| 163 | 164 |
checkRight = new Button(line1, SWT.CHECK); |
| 164 | 165 |
checkRight.setSelection(true); |
| 165 | 166 |
checkRight.setText(TXMUIMessages.useRightWindow); |
| 166 | 167 |
checkRight.addSelectionListener(new SelectionListener() {
|
| 168 |
|
|
| 167 | 169 |
@Override |
| 168 | 170 |
public void widgetSelected(SelectionEvent e) {
|
| 169 | 171 |
boolean sel = checkRight.getSelection(); |
| ... | ... | |
| 172 | 174 |
} |
| 173 | 175 |
|
| 174 | 176 |
@Override |
| 175 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
| 177 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 176 | 178 |
}); |
| 177 | 179 |
|
| 178 | 180 |
checkXword = new Button(line1, SWT.CHECK); |
| 179 | 181 |
checkXword.setText(TXMUIMessages.includeTheKeywordStructureInTheCount); |
| 180 |
|
|
| 181 | 182 |
|
| 183 |
|
|
| 182 | 184 |
// LINE 2 |
| 183 | 185 |
l = new Label(line2, SWT.NONE); |
| 184 | 186 |
l.setText(TXMUIMessages.from); |
| 185 |
|
|
| 187 |
|
|
| 186 | 188 |
// | [ ] [ ] [ |v] [ ] [ ] | |
| 187 | 189 |
maxLeft = new Spinner(line2, SWT.BORDER); |
| 188 | 190 |
maxLeft.setMinimum(0); |
| ... | ... | |
| 190 | 192 |
maxLeft.setIncrement(1); |
| 191 | 193 |
maxLeft.setPageIncrement(10); |
| 192 | 194 |
maxLeft.addSelectionListener(new SelectionListener() {
|
| 195 |
|
|
| 193 | 196 |
@Override |
| 194 | 197 |
public void widgetSelected(SelectionEvent e) {
|
| 195 | 198 |
minLeft.setMaximum(maxLeft.getSelection()); |
| 196 | 199 |
} |
| 197 |
|
|
| 200 |
|
|
| 198 | 201 |
@Override |
| 199 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 200 |
} |
|
| 202 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 201 | 203 |
}); |
| 202 |
|
|
| 204 |
|
|
| 203 | 205 |
l = new Label(line2, SWT.NONE); |
| 204 | 206 |
l.setText(TXMUIMessages.to_2); |
| 205 |
|
|
| 207 |
|
|
| 206 | 208 |
minLeft = new Spinner(line2, SWT.BORDER); |
| 207 | 209 |
minLeft.setMinimum(0); |
| 208 | 210 |
minLeft.setMaximum(9999); |
| 209 | 211 |
minLeft.setIncrement(1); |
| 210 | 212 |
minLeft.setPageIncrement(10); |
| 211 | 213 |
minLeft.addSelectionListener(new SelectionListener() {
|
| 214 |
|
|
| 212 | 215 |
@Override |
| 213 | 216 |
public void widgetSelected(SelectionEvent e) {
|
| 214 | 217 |
maxLeft.setMinimum(minLeft.getSelection()); |
| 215 | 218 |
} |
| 216 |
|
|
| 219 |
|
|
| 217 | 220 |
@Override |
| 218 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 219 |
} |
|
| 221 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 220 | 222 |
}); |
| 221 |
|
|
| 223 |
|
|
| 222 | 224 |
l = new Label(line2, SWT.NONE); |
| 223 | 225 |
l.setText(TXMUIMessages.andFrom); |
| 224 |
|
|
| 226 |
|
|
| 225 | 227 |
// [>] |
| 226 | 228 |
minRight = new Spinner(line2, SWT.BORDER); |
| 227 | 229 |
minRight.setMinimum(0); |
| ... | ... | |
| 229 | 231 |
minRight.setIncrement(1); |
| 230 | 232 |
minRight.setPageIncrement(10); |
| 231 | 233 |
minRight.addSelectionListener(new SelectionListener() {
|
| 234 |
|
|
| 232 | 235 |
@Override |
| 233 | 236 |
public void widgetSelected(SelectionEvent e) {
|
| 234 | 237 |
maxRight.setMinimum(minRight.getSelection()); |
| 235 | 238 |
} |
| 236 |
|
|
| 239 |
|
|
| 237 | 240 |
@Override |
| 238 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 239 |
} |
|
| 241 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 240 | 242 |
}); |
| 241 |
|
|
| 243 |
|
|
| 242 | 244 |
l = new Label(line2, SWT.NONE); |
| 243 | 245 |
l.setText(TXMUIMessages.to_3); |
| 244 |
|
|
| 246 |
|
|
| 245 | 247 |
// [>|] |
| 246 | 248 |
maxRight = new Spinner(line2, SWT.BORDER); |
| 247 | 249 |
maxRight.setMinimum(0); |
| ... | ... | |
| 249 | 251 |
maxRight.setIncrement(1); |
| 250 | 252 |
maxRight.setPageIncrement(10); |
| 251 | 253 |
maxRight.addSelectionListener(new SelectionListener() {
|
| 254 |
|
|
| 252 | 255 |
@Override |
| 253 | 256 |
public void widgetSelected(SelectionEvent e) {
|
| 254 | 257 |
minRight.setMaximum(maxRight.getSelection()); |
| 255 | 258 |
} |
| 256 |
|
|
| 259 |
|
|
| 257 | 260 |
@Override |
| 258 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 259 |
} |
|
| 261 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 260 | 262 |
}); |
| 261 |
|
|
| 262 |
// infoLabel = new Label(line2, SWT.NONE); |
|
| 263 |
// GridData infoLabelData = new GridData(GridData.END, GridData.CENTER, true, false); |
|
| 264 |
// infoLabel.setLayoutData(infoLabelData); |
|
| 265 | 263 |
|
| 264 |
// infoLabel = new Label(line2, SWT.NONE); |
|
| 265 |
// GridData infoLabelData = new GridData(GridData.END, GridData.CENTER, true, false); |
|
| 266 |
// infoLabel.setLayoutData(infoLabelData); |
|
| 267 |
|
|
| 266 | 268 |
loadStructs(); |
| 267 | 269 |
structs.setEnabled(false); |
| 268 | 270 |
checkXword.setEnabled(false); |
| 269 | 271 |
} |
| 270 |
//
|
|
| 271 |
// public void setInfo(String txt, String tooltip) {
|
|
| 272 |
// infoLabel.setText(txt);
|
|
| 273 |
// infoLabel.setToolTipText(tooltip);
|
|
| 274 |
// }
|
|
| 275 |
|
|
| 272 |
//
|
|
| 273 |
// public void setInfo(String txt, String tooltip) {
|
|
| 274 |
// infoLabel.setText(txt);
|
|
| 275 |
// infoLabel.setToolTipText(tooltip);
|
|
| 276 |
// }
|
|
| 277 |
|
|
| 276 | 278 |
/** |
| 277 | 279 |
* Load structs. |
| 278 | 280 |
*/ |
| ... | ... | |
| 289 | 291 |
if (corpusstructuralunits.size() > 0) {
|
| 290 | 292 |
structs.select(0); |
| 291 | 293 |
} |
| 292 |
} catch (CqiClientException e) {
|
|
| 294 |
} |
|
| 295 |
catch (CqiClientException e) {
|
|
| 293 | 296 |
// TODO Auto-generated catch block |
| 294 | 297 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 295 | 298 |
} |
| 296 | 299 |
} |
| 297 |
|
|
| 300 |
|
|
| 298 | 301 |
/** |
| 299 | 302 |
* Adds the first listener. |
| 300 | 303 |
* |
| ... | ... | |
| 303 | 306 |
public void addFirstListener(SelectionListener selectionListener) {
|
| 304 | 307 |
maxLeft.addSelectionListener(selectionListener); |
| 305 | 308 |
} |
| 306 |
|
|
| 309 |
|
|
| 307 | 310 |
/** |
| 308 | 311 |
* Adds the next listener. |
| 309 | 312 |
* |
| ... | ... | |
| 312 | 315 |
public void addNextListener(SelectionListener selectionListener) {
|
| 313 | 316 |
minRight.addSelectionListener(selectionListener); |
| 314 | 317 |
} |
| 315 |
|
|
| 318 |
|
|
| 316 | 319 |
/** |
| 317 | 320 |
* Adds the previous listener. |
| 318 | 321 |
* |
| ... | ... | |
| 321 | 324 |
public void addPreviousListener(SelectionListener selectionListener) {
|
| 322 | 325 |
minLeft.addSelectionListener(selectionListener); |
| 323 | 326 |
} |
| 324 |
|
|
| 327 |
|
|
| 325 | 328 |
/** |
| 326 | 329 |
* Adds the last listener. |
| 327 | 330 |
* |
| ... | ... | |
| 330 | 333 |
public void addLastListener(SelectionListener selectionListener) {
|
| 331 | 334 |
maxRight.addSelectionListener(selectionListener); |
| 332 | 335 |
} |
| 333 |
|
|
| 336 |
|
|
| 334 | 337 |
/** |
| 335 | 338 |
* Sets the max left. |
| 336 | 339 |
* |
| ... | ... | |
| 339 | 342 |
public void setMaxLeft(int maxleft) {
|
| 340 | 343 |
this.maxLeft.setSelection(maxleft); |
| 341 | 344 |
} |
| 342 |
|
|
| 345 |
|
|
| 343 | 346 |
/** |
| 344 | 347 |
* Sets the min left. |
| 345 | 348 |
* |
| ... | ... | |
| 348 | 351 |
public void setMinLeft(int minleft) {
|
| 349 | 352 |
this.minLeft.setSelection(minleft); |
| 350 | 353 |
} |
| 351 |
|
|
| 354 |
|
|
| 352 | 355 |
/** |
| 353 | 356 |
* Sets the max right. |
| 354 | 357 |
* |
| ... | ... | |
| 357 | 360 |
public void setMaxRight(int maxright) {
|
| 358 | 361 |
this.maxRight.setSelection(maxright); |
| 359 | 362 |
} |
| 360 |
|
|
| 363 |
|
|
| 361 | 364 |
/** |
| 362 | 365 |
* Sets the min right. |
| 363 | 366 |
* |
| ... | ... | |
| 366 | 369 |
public void setMinRight(int minright) {
|
| 367 | 370 |
this.minRight.setSelection(minright); |
| 368 | 371 |
} |
| 369 |
|
|
| 372 |
|
|
| 370 | 373 |
/** |
| 371 | 374 |
* Gets the max left. |
| 372 | 375 |
* |
| ... | ... | |
| 377 | 380 |
return maxLeft.getSelection(); |
| 378 | 381 |
return -1; |
| 379 | 382 |
} |
| 380 |
|
|
| 383 |
|
|
| 381 | 384 |
/** |
| 382 | 385 |
* Gets the min left. |
| 383 | 386 |
* |
| ... | ... | |
| 388 | 391 |
return minLeft.getSelection(); |
| 389 | 392 |
return -1; |
| 390 | 393 |
} |
| 391 |
|
|
| 394 |
|
|
| 392 | 395 |
/** |
| 393 | 396 |
* Gets the max right. |
| 394 | 397 |
* |
| ... | ... | |
| 399 | 402 |
return maxRight.getSelection(); |
| 400 | 403 |
return -1; |
| 401 | 404 |
} |
| 402 |
|
|
| 405 |
|
|
| 403 | 406 |
/** |
| 404 | 407 |
* Gets the min right. |
| 405 | 408 |
* |
| ... | ... | |
| 410 | 413 |
return minRight.getSelection(); |
| 411 | 414 |
return -1; |
| 412 | 415 |
} |
| 413 |
|
|
| 416 |
|
|
| 414 | 417 |
/** |
| 415 | 418 |
* Sets the structure. If null then swap to word mode. |
| 416 | 419 |
* |
| ... | ... | |
| 432 | 435 |
checkXword.setEnabled(false); |
| 433 | 436 |
} |
| 434 | 437 |
} |
| 435 |
|
|
| 438 |
|
|
| 436 | 439 |
/** |
| 437 | 440 |
* Gets the struct. |
| 438 | 441 |
* |
| ... | ... | |
| 447 | 450 |
return null; |
| 448 | 451 |
} |
| 449 | 452 |
return this.corpus.getStructuralUnit(structs.getText()); |
| 450 |
} catch (CqiClientException e) {
|
|
| 453 |
} |
|
| 454 |
catch (CqiClientException e) {
|
|
| 451 | 455 |
// TODO Auto-generated catch block |
| 452 | 456 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 453 | 457 |
} |
| 454 | 458 |
return null; |
| 455 | 459 |
} |
| 456 |
|
|
| 460 |
|
|
| 457 | 461 |
/** |
| 458 | 462 |
* Gets the x pivot. |
| 459 | 463 |
* |
| ... | ... | |
| 462 | 466 |
public boolean getXPivot() {
|
| 463 | 467 |
return this.checkXword.getSelection(); |
| 464 | 468 |
} |
| 465 |
|
|
| 469 |
|
|
| 470 |
/** |
|
| 471 |
* Gets the x pivot. |
|
| 472 |
* |
|
| 473 |
* @return the x pivot |
|
| 474 |
*/ |
|
| 475 |
public void setXPivot(boolean sel) {
|
|
| 476 |
this.checkXword.setSelection(sel); |
|
| 477 |
} |
|
| 478 |
|
|
| 466 | 479 |
public void addSelectionListener(SelectionListener listener) {
|
| 467 | 480 |
structType.addSelectionListener(listener); |
| 468 | 481 |
wordType.addSelectionListener(listener); |
| ... | ... | |
| 489 | 502 |
checkRight.removeSelectionListener(listener); |
| 490 | 503 |
} |
| 491 | 504 |
|
| 492 |
public void addMinMaxKeyListener(KeyListener listener) {
|
|
| 505 |
public void addMinMaxKeyListener(KeyListener listener) {
|
|
| 493 | 506 |
maxLeft.addKeyListener(listener); |
| 494 | 507 |
maxRight.addKeyListener(listener); |
| 495 | 508 |
minRight.addKeyListener(listener); |
| 496 | 509 |
minLeft.addKeyListener(listener); |
| 497 | 510 |
} |
| 498 |
|
|
| 499 |
} |
|
| 511 |
|
|
| 512 |
} |
|
Formats disponibles : Unified diff