Skip to content

Commit

Permalink
Task #463 Updating of the CustomerDialog class
Browse files Browse the repository at this point in the history
  • Loading branch information
ngat_di authored and ngat_di committed Oct 16, 2023
1 parent e4c5a4a commit aa85ca3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
* Usage:
* 1. Create an instance of CustomDialog, providing the parent shell, initial features to display, and a callback for feature updates.
* 2. Open the dialog using the open() method.
*
* @author ngat_di
*/

public class CustomDialog extends Dialog {
Expand All @@ -59,7 +57,15 @@ public class CustomDialog extends Dialog {
private String[] features; // Array of features
private List featuresList; // SWT List for displaying features
private FeatureUpdateCallback featureUpdateCallback; // Callback for updating features



final int numColumnsinTheGrid = 3;
final int horizontalIndentForValueLabel = 10;
final int verticalSpan = 6;
final int horizontalIndentForFeatureLabel = 10;
final int width = 970;
final int height = 400;

/**
* Constructor for CustomDialog.
*
Expand All @@ -82,19 +88,20 @@ public CustomDialog(Shell parentShell, String[] initialFeatures, FeatureUpdateCa
protected void configureShell(Shell newShell) {
super.configureShell(newShell);

final int width = 970;
final int height = 400;
// Adjust the width and height as needed
newShell.setSize(width, height);

// Center the dialog on the screen
centerShellOnScreen(newShell);

// Set the title of the dialog
newShell.setText("User--Discipline");
}
@Override
protected Control createDialogArea(Composite parent) {
// Create the main container
Composite container = (Composite) super.createDialogArea(parent);
final int numColumnsinTheGrid = 3;

// Set up the layout for the container
GridLayout layout = new GridLayout(numColumnsinTheGrid, false);
container.setLayout(layout);
Expand All @@ -103,7 +110,7 @@ protected Control createDialogArea(Composite parent) {
valueLabel.setText("Value :");
valueLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); // Set the foreground color
GridData valueLabelGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
final int horizontalIndentForValueLabel = 10;

valueLabelGridData.horizontalIndent = horizontalIndentForValueLabel; // Adjust the indentation
valueLabel.setLayoutData(valueLabelGridData);

Expand All @@ -113,14 +120,14 @@ protected Control createDialogArea(Composite parent) {
// Features Label and List
Composite featuresComposite = new Composite(container, SWT.NONE);
featuresComposite.setLayout(new GridLayout());
final int verticalSpan = 6;

GridData featuresCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, verticalSpan);
featuresComposite.setLayoutData(featuresCompositeGridData);
Label featuresLabel = new Label(featuresComposite, SWT.NONE);
featuresLabel.setText("List of users :");
featuresLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); // Set the foreground color
GridData featuresLabelGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
final int horizontalIndentForFeatureLabel = 10;

featuresLabelGridData.horizontalIndent = horizontalIndentForFeatureLabel; // Adjust the indentation
featuresLabel.setLayoutData(featuresLabelGridData);
featuresList = new List(featuresComposite, SWT.BORDER | SWT.V_SCROLL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

/**
* Interface to handle feature update callback
* @author ngat_di
*/
public interface FeatureUpdateCallback {
void onFeaturesChanged(String[] updatedFeatures);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
/**
* UI Snippet for role management. Implements the IUiSnippet interface for role management.
* Manages disciplines and associated users.
* @author leps_je
* @author ngat_di
*
*/
public class UiSnippetRoleManagement extends AUiSnippetEStructuralFeatureTable implements IUiSnippet, FeatureUpdateCallback {
Expand Down

0 comments on commit aa85ca3

Please sign in to comment.