Search in sources :

Example 11 with DateTime

use of org.eclipse.swt.widgets.DateTime in project cubrid-manager by CUBRID.

the class TimeCellPopuoDialog method createDialogArea.

/**
	 * Create dialog area
	 * 
	 * @param parent Composite
	 * @return Control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    composite.setLayout(layout);
    timeComposite = new DateTime(composite, SWT.TIME | SWT.CALENDAR | SWT.BORDER);
    timeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    setNullBtn = new Button(composite, SWT.CHECK);
    setNullBtn.setText(Messages.btnSetNull);
    setNullBtn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    setNullBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            changeBtnStatus();
        }
    });
    initValue();
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DateTime(org.eclipse.swt.widgets.DateTime)

Example 12 with DateTime

use of org.eclipse.swt.widgets.DateTime in project cubrid-manager by CUBRID.

the class DateCellPopupDialog method createDialogArea.

/**
	 * Create dialog area
	 * 
	 * @param parent Composite
	 * @return Control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    composite.setLayout(layout);
    dateComposite = new DateTime(composite, SWT.CALENDAR | SWT.BORDER);
    dateComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, -1));
    setNullBtn = new Button(composite, SWT.CHECK);
    setNullBtn.setText(Messages.btnSetNull);
    setNullBtn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    setNullBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            changeBtnStatus();
        }
    });
    initValue();
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DateTime(org.eclipse.swt.widgets.DateTime)

Example 13 with DateTime

use of org.eclipse.swt.widgets.DateTime in project cubrid-manager by CUBRID.

the class DateTimeCellPopuoDialog method createDialogArea.

/**
	 * Create dialog area
	 * 
	 * @param parent Composite
	 * @return Control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    composite.setLayout(layout);
    dateComposite = new DateTime(composite, SWT.CALENDAR | SWT.BORDER);
    dateComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, -1));
    timeComposite = new DateTime(composite, SWT.TIME | SWT.BORDER);
    timeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    if (DataType.isDateTimeDataType(columnInfo.getType())) {
        millSpinner = new Spinner(composite, SWT.BORDER);
        millSpinner.setMinimum(0);
        millSpinner.setMaximum(999);
        millSpinner.setLayoutData(CommonUITool.createGridData(1, 1, 30, -1));
    }
    setNullBtn = new Button(composite, SWT.CHECK);
    setNullBtn.setText(Messages.btnSetNull);
    setNullBtn.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    setNullBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            changeBtnStatus();
        }
    });
    initValue();
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DateTime(org.eclipse.swt.widgets.DateTime)

Example 14 with DateTime

use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_DateTime method test_setBackgroundTimeDateTime.

@Test
public void test_setBackgroundTimeDateTime() {
    DateTime time = new DateTime(shell, SWT.TIME);
    Color color = new Color(time.getDisplay(), 255, 0, 0);
    time.setBackground(color);
    assertEquals("getBackground not equal after setBackground for SWT.TIME DateTime", color, time.getBackground());
    time.setBackground(null);
    assertTrue("getBackground unchanged after setBackground(null) for SWT.TIME DateTime", !time.getBackground().equals(color));
    color.dispose();
    color = new Color(time.getDisplay(), 255, 0, 0, 0);
    time.setBackground(color);
    assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.TIME DateTime", color, time.getBackground());
    time.setBackground(null);
    assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.TIME DateTime", !time.getBackground().equals(color));
    if ("gtk".equals(SWT.getPlatform())) {
        Color fg = new Color(time.getDisplay(), 0, 255, 0);
        time.setBackground(color);
        time.setForeground(fg);
        assertEquals("Setting a foreground disrupted the background color for SWT.TIME DateTime", color, time.getBackground());
        assertEquals("Setting a foreground onto an SWT.TIME DateTime with a background failed", fg, time.getForeground());
        fg.dispose();
    }
    color.dispose();
    time.dispose();
}
Also used : Color(org.eclipse.swt.graphics.Color) DateTime(org.eclipse.swt.widgets.DateTime) Test(org.junit.Test)

Example 15 with DateTime

use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_DateTime method test_setForegroundTimeDateTime.

@Test
public void test_setForegroundTimeDateTime() {
    DateTime time = new DateTime(shell, SWT.TIME);
    Color color = new Color(time.getDisplay(), 255, 0, 0);
    time.setForeground(color);
    assertEquals(color, time.getForeground());
    time.setForeground(null);
    assertFalse(time.getForeground().equals(color));
    if ("gtk".equals(SWT.getPlatform())) {
        Color bg = new Color(time.getDisplay(), 0, 255, 0);
        time.setForeground(color);
        time.setBackground(bg);
        assertEquals("Setting a background disrupted the foreground color for SWT.TIME DateTime", color, time.getForeground());
        assertEquals("Setting a background onto an SWT.TIME DateTime with a foreground failed", bg, time.getBackground());
        bg.dispose();
    }
    color.dispose();
    time.dispose();
}
Also used : Color(org.eclipse.swt.graphics.Color) DateTime(org.eclipse.swt.widgets.DateTime) Test(org.junit.Test)

Aggregations

DateTime (org.eclipse.swt.widgets.DateTime)27 GridData (org.eclipse.swt.layout.GridData)13 Color (org.eclipse.swt.graphics.Color)12 GridLayout (org.eclipse.swt.layout.GridLayout)12 Composite (org.eclipse.swt.widgets.Composite)12 Test (org.junit.Test)12 Label (org.eclipse.swt.widgets.Label)9 Button (org.eclipse.swt.widgets.Button)7 RowLayout (org.eclipse.swt.layout.RowLayout)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Text (org.eclipse.swt.widgets.Text)4 Calendar (java.util.Calendar)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Dimension (java.awt.Dimension)1 ComponentAdapter (java.awt.event.ComponentAdapter)1 ComponentEvent (java.awt.event.ComponentEvent)1 SimpleDateFormat (java.text.SimpleDateFormat)1 LocalResourceManager (org.eclipse.jface.resource.LocalResourceManager)1 ResourceManager (org.eclipse.jface.resource.ResourceManager)1