3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.swt
.widgets
.Button
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.swt
.widgets
.Display
;
16 import org
.eclipse
.swt
.widgets
.Text
;
17 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
18 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
26 public class ToggleableTextField
extends Composite
{
27 private final FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
29 private Button editButton
;
32 * Create the composite.
36 public ToggleableTextField(Composite parent
, int style
) {
38 setBackgroundMode(SWT
.INHERIT_DEFAULT
);
40 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
41 tableWrapLayout
.numColumns
= 2;
42 tableWrapLayout
.verticalSpacing
= 0;
43 tableWrapLayout
.topMargin
= 0;
44 tableWrapLayout
.rightMargin
= 0;
45 tableWrapLayout
.leftMargin
= 0;
46 tableWrapLayout
.horizontalSpacing
= 0;
47 tableWrapLayout
.bottomMargin
= 0;
48 setLayout(tableWrapLayout
);
51 text
= formToolkit
.createText(this, "New Text", SWT
.WRAP
);
53 TableWrapData twd_text
= new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1);
54 twd_text
.grabVertical
= true;
55 text
.setLayoutData(twd_text
);
57 editButton
= formToolkit
.createButton(this, "Edit", SWT
.TOGGLE
);
62 protected void checkSubclass() {
63 // Disable the check that prevents subclassing of SWT components
66 public Text
getText() {
69 public Button
getEditButton() {