Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring improvements, added LayoutDataHelper for placing widgets,…
… added label showing total number of items in the table
- Loading branch information
Showing
7 changed files
with
228 additions
and
136 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
ch.qos.logback.beagle/src/ch/qos/logback/beagle/util/LayoutDataHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* Logback-beagle: The logback Console Plugin for Eclipse | ||
* Copyright (C) 2006-2012, QOS.ch. All rights reserved. | ||
* | ||
* This program and the accompanying materials are licensed under | ||
* either the terms of the Eclipse Public License v1.0 as published by | ||
* the Eclipse Foundation. | ||
*/ | ||
package ch.qos.logback.beagle.util; | ||
|
||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.FormAttachment; | ||
import org.eclipse.swt.layout.FormData; | ||
import org.eclipse.swt.widgets.Control; | ||
|
||
public class LayoutDataHelper { | ||
|
||
FormData formData; | ||
final Control control; | ||
|
||
public static LayoutDataHelper make(Control control) { | ||
return new LayoutDataHelper(control); | ||
} | ||
|
||
public static LayoutDataHelper make(Control control, int width, int height) { | ||
return new LayoutDataHelper(control, width, height); | ||
} | ||
|
||
|
||
public LayoutDataHelper(Control control) { | ||
this.control = control; | ||
formData = new FormData(); | ||
} | ||
|
||
public LayoutDataHelper(Control control, int width, int height) { | ||
this.control = control; | ||
formData = new FormData(width, height); | ||
} | ||
|
||
// relative to the control's parent ------------------------------- | ||
public LayoutDataHelper bottom(int offset) { | ||
formData.bottom = new FormAttachment(100, offset); | ||
return this; | ||
} | ||
|
||
public LayoutDataHelper left(int offset) { | ||
formData.left = new FormAttachment(0, offset); | ||
return this; | ||
} | ||
|
||
public LayoutDataHelper top(int offset) { | ||
formData.top = new FormAttachment(0, offset); | ||
return this; | ||
} | ||
|
||
|
||
public LayoutDataHelper right(int offset) { | ||
formData.right = new FormAttachment(100, offset); | ||
return this; | ||
} | ||
|
||
// relative to aControl, a control passed as parameter ------------------------------ | ||
|
||
public LayoutDataHelper rightOf(Control aControl, int offset) { | ||
formData.left = new FormAttachment(aControl, offset, SWT.RIGHT); | ||
return this; | ||
} | ||
|
||
public LayoutDataHelper leftOf(Control aControl, int offset) { | ||
formData.right = new FormAttachment(aControl, offset, SWT.LEFT); | ||
return this; | ||
} | ||
|
||
public LayoutDataHelper above(Control aControl, int offset) { | ||
formData.bottom = new FormAttachment(aControl, offset, SWT.TOP); | ||
return this; | ||
} | ||
|
||
public LayoutDataHelper below(Control aControl, int offset) { | ||
formData.top = new FormAttachment(aControl, offset, SWT.BOTTOM); | ||
return this; | ||
} | ||
|
||
|
||
public FormData getFormData() { | ||
return formData; | ||
} | ||
|
||
public void set() { | ||
control.setLayoutData(formData); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.