Project

General

Profile

« Previous | Next » 

Revision eccc9d31

Added by Katja Luther over 3 years ago

ref #9116: layout issues and improve handling if no source exist

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
22 22
import org.eclipse.swt.widgets.Control;
23 23
import org.eclipse.swt.widgets.Label;
24 24
import org.eclipse.swt.widgets.Text;
25
import org.eclipse.ui.forms.widgets.TableWrapData;
26 25

  
27 26
import eu.etaxonomy.cdm.common.CdmUtils;
28 27
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
......
121 120
	protected void createControls(ICdmFormElement formElement,
122 121
	        TaxonNode entity, int style) {
123 122
//	    taxon = entity.getTaxon();
123

  
124 124
	    Label taxonTitle = new Label(getLayoutComposite(), SWT.NULL);
125
        taxonTitle.setText(Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
126
        TableWrapData tableWrap = LayoutConstants.FILL_HORIZONTALLY(2, 2);
127
        tableWrap.valign = SWT.TOP;
128
        taxonTitle.setLayoutData(tableWrap);
129
        taxonTitle.setFont(FONT_BOLD);
125
	    taxonTitle.setText(Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
126
	    taxonTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
127
	    taxonTitle.setFont(FONT_BOLD);
128

  
129

  
130 130

  
131 131
	    if (isCreateNew()){
132 132
	        textNewTaxonName = formFactory.createTextWithLabelElement(formElement,
......
156 156
                    Messages.TaxonNodeWizardPage_TAXON_IS_PUBLISH, true, style);
157 157

  
158 158
            checkbox_publish.setEnabled(isCreateNew());
159

  
159
            Label spacer = new Label(getLayoutComposite(), SWT.NULL);
160
            spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 2));
160 161
            Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
161
            nodeTitle.setText(Messages.TaxonNodeWizardPage_TAXON_NODE);
162
            nodeTitle.setText("Taxon Node");
162 163
            nodeTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
163 164
            nodeTitle.setFont(FONT_BOLD);
165
//            LabelElement nodeTitle = formFactory.createLabel(formElement, Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
166
//            nodeTitle.setLayout(LayoutConstants.FILL_HORIZONTALLY(2, 1));
167
//            nodeTitle.setBackground(getPersistentBackground());
168
//            nodeTitle.setBold();
169

  
164 170
            selection_parentTaxonNode = formFactory
165 171
                    .createTaxonNodeSelectionElement(getConversationHolder(), formElement, Messages.TaxonNodeWizardPage_PARENT, parentNode,
166 172
                            EntitySelectionElement.DELETABLE, style, 100);
......
183 189
            }
184 190
            textTaxonSec.setEnabled(false);
185 191
            microReference.setEnabled(false);
192
            Label spacer = new Label(getLayoutComposite(), SWT.NULL);
193
            spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 2));
186 194

  
187 195
            Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
188 196
            nodeTitle.setText("Taxon Node");
189 197
            nodeTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
190 198
            nodeTitle.setFont(FONT_BOLD);
191 199

  
200
//            LabelElement nodeTitle = formFactory.createLabel(formElement, "Taxon Node");
201
//            nodeTitle.setLayout(LayoutConstants.FILL_HORIZONTALLY(2, 1));
202
//            nodeTitle.setBackground(getPersistentBackground());
203
//            nodeTitle.setBold();
204

  
205

  
192 206
            if (entity.getParent().getTaxon() == null){
193 207
                TextWithLabelElement textParent = formFactory.createTextWithLabelElement(
194 208
                        formElement,CLASSIFICATION_STR, entity.getClassification().getTitleCache(), style);
......
199 213
                textParent.setEnabled(false);
200 214
            }
201 215
	    }
202
	    Label spacer = new Label(getLayoutComposite(), SWT.NULL);
203
	    spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
216

  
217

  
204 218
        combo_status = formFactory.createEnumComboElement(TaxonNodeStatus.class, formElement, style, true);
205 219
        if (!isCreateNew()){
206 220
            combo_status.setSelection(entity.getStatus());
......
235 249
	        multiLanguageTextStatusNotes.setEnabled(entity.getStatus() != null);
236 250
	    }
237 251

  
238
		if (!isCreateNew()){
239
		    selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
240 252

  
241
		    selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
242
		    selectionNodeAgentRelation.setEntity(entity);
243
		}
244 253

  
245 254
		sourceSection = formFactory.createOriginalSourceElement(formElement, entity);
246
		if (isCreateNew()){
247
		    sourceSection.setEntity(null);
255
		if (isCreateNew() || entity.getSource() == null){
256
		    DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
257
		    entity.setSource(source);
258
		    sourceSection.setEntity(source);
248 259
		}else{
249 260
		    sourceSection.setEntity(entity.getSource());
261

  
250 262
		}
251 263

  
264
		selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
265
		selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
266
        selectionNodeAgentRelation.setEntity(entity);
267
        setBackground(getPersistentBackground());
252 268

  
253 269
	}
254 270

  
......
323 339
		}
324 340

  
325 341
        if (eventSource == sourceSection) {
326
            if(!isCreateNew()){
327
                getEntity().setSource((DescriptionElementSource)sourceSection.getEntity());
328
            }
342
//            getEntity().setSource((DescriptionElementSource)sourceSection.getEntity());
343

  
329 344
        }else if (eventSource == selection_SecRef) {
330 345
            if (taxon != null){
331 346
                taxon.setSec(selection_SecRef.getEntity());

Also available in: Unified diff