import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import eu.etaxonomy.taxeditor.model.ColorResources;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
/**
* @author pplitzner
* @since Jan 23, 2019
private Label label;
private boolean isSelected;
private TermSearchResult result;
- private Label lblItemDash;
+ private Button btnCheck;
+ private Composite composite_1;
/**
* Create the composite.
setLayout(gridLayout);
Composite composite = new Composite(this, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.HORIZONTAL));
- composite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 2));
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+
+ btnCheck = new Button(composite, SWT.CHECK);
+ btnCheck.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
- lblItemDash = new Label(composite, SWT.NONE);
- lblItemDash.setText(" - ");
- label = new Label(this, SWT.NONE);
+ composite_1 = new Composite(this, SWT.NONE);
+ composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+ composite_1.setLayout(new GridLayout(1, false));
+ label = new Label(composite_1, SWT.NONE);
+ label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
label.setText(result.getContent().getRepresentation_L10n());
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
GridDataFactory.fillDefaults().applyTo(label);
-
- Label lblDescription = new Label(this, SWT.NONE);
- lblDescription.setText("Some description of the term. This can be a longer text. Also images appear in this area if they are present.");
label.addFocusListener(new FocusListener() {
@Override
public void mouseUp(MouseEvent e) {
System.out.println("mouseUp");
isSelected = !isSelected;
- setBgColor();
}
System.out.println("mouseDoubleClick");
}
});
+
+ Label lblDescription = new Label(composite_1, SWT.NONE);
+ lblDescription.setText("Some description of the term. This can be a longer text. Also images appear in this area if they are present.");
}
public boolean isSelected() {
return result;
}
- private void setBgColor() {
- if(isSelected){
- Color colorSelected = ColorResources.getColor(Resources.COLOR_LIST_EVEN);
- TermSearchResultComposite.this.setBackground(colorSelected);
- label.setBackground(colorSelected);
- lblItemDash.setBackground(colorSelected);
- }
- else{
- Color colorControlBackground = ColorResources.getColor(Resources.COLOR_SWT_BG_DEFAULT);
- TermSearchResultComposite.this.setBackground(colorControlBackground);
- label.setBackground(colorControlBackground);
- lblItemDash.setBackground(colorControlBackground);
- }
- }
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
+ public Button getBtnCheck() {
+ return btnCheck;
+ }
}