Revision eb9a2f74
Added by Patrick Plitzner about 8 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
154 | 154 |
|
155 | 155 |
//---search and filter--- |
156 | 156 |
derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this); |
157 |
derivateSearchCompositeController.setEnabled(CdmStore.isActive()); |
|
158 | 157 |
GridData gridDataSearchBar = new GridData(); |
159 | 158 |
gridDataSearchBar.horizontalAlignment = GridData.FILL; |
160 | 159 |
gridDataSearchBar.grabExcessHorizontalSpace = true; |
161 | 160 |
derivateSearchCompositeController.setLayoutData(gridDataSearchBar); |
161 |
derivateSearchCompositeController.setEnabled(CdmStore.isActive()); |
|
162 | 162 |
|
163 | 163 |
//---tree viewer--- |
164 | 164 |
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); |
... | ... | |
174 | 174 |
labelProvider.setConversation(conversation); |
175 | 175 |
viewer.setLabelProvider(labelProvider); |
176 | 176 |
viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); |
177 |
viewer.getTree().setEnabled(CdmStore.isActive()); |
|
177 | 178 |
// Propagate selection from viewer |
178 | 179 |
getSite().setSelectionProvider(viewer); |
179 | 180 |
|
... | ... | |
463 | 464 |
uuids.add(specimenOrObservationBase.getUuid()); |
464 | 465 |
} |
465 | 466 |
updateRootEntities(uuids); |
466 |
derivateSearchCompositeController.setTaxon(selectedTaxon); |
|
467 | 467 |
setPartName("Derivative Editor: " + selectedTaxon.getName()); |
468 | 468 |
} |
469 |
// if(part instanceof MultiPageTaxonEditor){ |
|
470 |
// Taxon taxon = ((MultiPageTaxonEditor) part).getTaxon(); |
|
471 |
// } |
|
472 | 469 |
} |
473 | 470 |
} |
474 | 471 |
|
... | ... | |
499 | 496 |
public void toggleListenToSelectionChange() { |
500 | 497 |
listenToSelectionChange = !listenToSelectionChange; |
501 | 498 |
derivateSearchCompositeController.setEnabled(!listenToSelectionChange); |
502 |
derivateSearchCompositeController.setTaxon(null); |
|
503 | 499 |
if(!listenToSelectionChange){ |
504 | 500 |
selectedTaxon = null; |
505 | 501 |
setPartName("Derivative Editor"); |
... | ... | |
526 | 522 |
@Override |
527 | 523 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
528 | 524 |
derivateSearchCompositeController.setEnabled(false); |
525 |
viewer.getTree().setEnabled(false); |
|
529 | 526 |
viewer.setInput(null); |
530 | 527 |
} |
531 | 528 |
|
... | ... | |
536 | 533 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
537 | 534 |
init(); |
538 | 535 |
derivateSearchCompositeController.setEnabled(!listenToSelectionChange); |
536 |
viewer.getTree().setEnabled(true); |
|
539 | 537 |
refreshTree(); |
540 | 538 |
} |
541 | 539 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java | ||
---|---|---|
15 | 15 |
import java.util.UUID; |
16 | 16 |
|
17 | 17 |
import org.eclipse.swt.SWT; |
18 |
import org.eclipse.swt.layout.GridData; |
|
18 | 19 |
import org.eclipse.swt.widgets.Composite; |
19 | 20 |
import org.eclipse.swt.widgets.Event; |
20 | 21 |
import org.eclipse.swt.widgets.Listener; |
... | ... | |
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
private void searchDerivates(){ |
71 |
// if(!conversation.isBound()){ |
|
72 |
// conversation.bind(); |
|
73 |
// } |
|
74 |
|
|
75 | 72 |
String queryString = derivateSearchComposite.getSearchField().getText(); |
76 | 73 |
SpecimenOrObservationType specimenType = comboSpecimenTypeController.getSelection(); |
77 | 74 |
|
... | ... | |
154 | 151 |
*/ |
155 | 152 |
public void setEnabled(boolean enabled) { |
156 | 153 |
if(!derivateSearchComposite.isDisposed()){ |
157 |
derivateSearchComposite.setEnabled(enabled); |
|
154 |
GridData layoutData = (GridData) derivateSearchComposite.getLayoutData(); |
|
155 |
layoutData.exclude = !enabled; |
|
156 |
derivateSearchComposite.setVisible(enabled); |
|
157 |
derivateSearchComposite.getParent().layout(true); |
|
158 | 158 |
} |
159 | 159 |
} |
160 | 160 |
|
... | ... | |
178 | 178 |
labelProvider.setConversation(conversationHolder); |
179 | 179 |
} |
180 | 180 |
|
181 |
/** |
|
182 |
* @param taxon |
|
183 |
*/ |
|
184 |
public void setTaxon(Taxon taxon) { |
|
185 |
if(taxon==null){ |
|
186 |
derivateSearchComposite.getTextTaxonName().setText(""); |
|
187 |
derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS); |
|
188 |
} |
|
189 |
else{ |
|
190 |
derivateSearchComposite.getTextTaxonName().setText(taxon.getTitleCache()); |
|
191 |
derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 | 181 |
} |
Also available in: Unified diff
Hide SearchBar when linking to taxon editor