Project

General

Profile

« Previous | Next » 

Revision 3752053a

Added by Katja Luther over 4 years ago

fix visibility of distribution in distribution editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistDropdownSelectionListenerE4.java
48 48
    // SearchOption option
49 49
    public void add(DefinedTermBase<DefinedTermBase> term) {
50 50
        MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
51
//        if (PreferencesUtil) {
52
//            menuItem.setText(term.getTitleCache());
53
//        }
51
   
52
           menuItem.setText(term.getTitleCache());
53

  
54 54
        if (PreferencesUtil.getPreferenceStore().getBoolean(term.getUuid().toString())) {
55 55
            menuItem.setSelection(true);
56 56
        } else {
......
68 68
                DefinedTermBase<DefinedTermBase> selectedTerm = null;
69 69
                if (termSet != null) {
70 70
                	TableColumn[] columns = viewer.getTable().getColumns();
71
                	for(int i=0; i<columns.length; i++){
72
                		if(selected.getText().equalsIgnoreCase(columns[i].getText())){
73
                			column = columns[i];
74
                			logger.info("Column no " +i +" Column Header "+ column.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
75
                			for (DefinedTermBase<DefinedTermBase> term : termSet) {
76
                				if(column.getText().equalsIgnoreCase(term.getTitleCache())){
77
                					selectedTerm = term;
78
                					break;
79
                				}
80
                			}
81
                		}
82
                	}
83
                }
84
                if (column != null && column.getWidth() == 0) {
85
                    // save column status if shown or not
86
                    if (selectedTerm != null) {
87
                        PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), true);
88
                    }
89
                    column.setWidth(100);
90
                } else if (column != null) {
91
                    if (selectedTerm != null) {
92
                        PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), false);
93
                    }
94
                    column.setWidth(0);
71
                	for (DefinedTermBase<DefinedTermBase> term : termSet) {
72
                		if(selected.getText().equalsIgnoreCase(term.getTitleCache())){
73
        					selectedTerm = term;
74
        					for(int i=0; i<columns.length; i++){
75
        						column = null;
76
                        		if(columns[i].getText().equalsIgnoreCase(term.getIdInVocabulary())){
77
                        			column = columns[i];
78
                        			logger.info("Column no " +i +" Column Header "+ column.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
79
                				}else if (columns[i].getText().equalsIgnoreCase(term.getTitleCache())){
80
                					column = columns[i];
81
                        			logger.info("Column no " +i +" Column Header "+ column.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
82
                        			
83
                        		}
84
                        		if (column != null && column.getWidth() == 0) {
85
                                    // save column status if shown or not
86
                                    if (selectedTerm != null) {
87
                                        PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), true);
88
                                    }
89
                                    column.setWidth(50);
90
                                } else if (column != null) {
91
                                    if (selectedTerm != null) {
92
                                        PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), false);
93
                                    }
94
                                    column.setWidth(0);
95
                                }
96
                        	}
97
        					break;
98
        				}
99
                		
100
        			}
101
                	
95 102
                }
103
                
104
                editor.refresh();
105
                
96 106
            }
97 107
        });
98 108
    }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
343 343
                if(restoreValuesForColumnWidth.get(columnIndex)){
344 344
                    column.getColumn().setWidth(50);
345 345
                }else{
346
                    column.getColumn().setWidth(50);
346
                    column.getColumn().setWidth(0);
347 347
                }
348 348
                column.setEditingSupport(new DistributionEditingSupportE4(viewer, this, columnIndex));
349 349

  
......
529 529
    	hideDistributionColumns(oldTerms);
530 530
    	createToolbarItems();
531 531
    	toolItem.addSelectionListener(dropListener);
532
    	
532 533
    	for(DefinedTermBase term:newTerms){
533 534
    		int count = viewer.getTable().getColumnCount();
534
    		addTableViewerColumn(term.getTitleCache(), 200, count);
535
    		String termLable = term.getTitleCache();;
536
    		if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
537
    			if (term.getIdInVocabulary() != null){
538
    				termLable = term.getIdInVocabulary();
539
    	        } 
540
    		}
541
    		addTableViewerColumn(termLable, 200, count);
535 542
    		acitivateNewColumnInDropDownMenu(term);
536 543
    	}
537 544
        viewer.setLabelProvider(labelProvider);

Also available in: Unified diff