org.eclipse.swt.widgets.DateTime.getShell()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.eclipse.swt.widgets.DateTime.getShell()方法的一些代码示例,展示了DateTime.getShell()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.getShell()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.DateTime
类名称:DateTime
方法名:getShell

DateTime.getShell介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
  public void handleEvent (Event event) {
    Shell shell = ((Control)event.widget).getShell ();
    if (shell == DateTime.this.getShell ()) {
      handleFocus (SWT.FocusOut);
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
  public void handleEvent (Event event) {
    Shell shell = ((Control)event.widget).getShell ();
    if (shell == DateTime.this.getShell ()) {
      handleFocus (SWT.FocusOut);
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
  public void handleEvent (Event event) {
    Shell shell = ((Control)event.widget).getShell ();
    if (shell == DateTime.this.getShell ()) {
      handleFocus (SWT.FocusOut);
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void onDispose (Event event) {
  if (popupShell != null && !popupShell.isDisposed ()) {
    popupCalendar.removeListener (SWT.Dispose, popupListener);
    popupShell.dispose ();
  }
  Shell shell = getShell ();
  shell.removeListener (SWT.Deactivate, popupListener);
  Display display = getDisplay ();
  display.removeFilter (SWT.FocusIn, popupFilter);
  popupShell = null;
  popupCalendar = null;
  down = null;
  dateTimeString = null;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void onDispose (Event event) {
  if (popupShell != null && !popupShell.isDisposed ()) {
    popupCalendar.removeListener (SWT.Dispose, popupListener);
    popupShell.dispose ();
  }
  Shell shell = getShell ();
  shell.removeListener (SWT.Deactivate, popupListener);
  Display display = getDisplay ();
  display.removeFilter (SWT.FocusIn, popupFilter);
  popupShell = null;
  popupCalendar = null;
  down = null;
  dateTimeString = null;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void onDispose (Event event) {
  if (popupShell != null && !popupShell.isDisposed ()) {
    popupCalendar.removeListener (SWT.Dispose, popupListener);
    popupShell.dispose ();
  }
  Shell shell = getShell ();
  shell.removeListener (SWT.Deactivate, popupListener);
  Display display = getDisplay ();
  display.removeFilter (SWT.FocusIn, popupFilter);
  popupShell = null;
  popupCalendar = null;
  down = null;
  dateTimeString = null;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
  public void handleEvent (Event event) {
    if (event.widget == popupShell) {
      popupShellEvent (event);
      return;
    }
    if (event.widget == popupCalendar) {
      popupCalendarEvent (event);
      return;
    }
    if (event.widget == DateTime.this) {
      onDispose (event);
      return;
    }
    if (event.widget == getShell ()) {
      getDisplay ().asyncExec (new Runnable () {
        @Override
        public void run () {
          if (isDisposed ()) return;
          handleFocus (SWT.FocusOut);
        }
      });
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
  public void handleEvent (Event event) {
    if (event.widget == popupShell) {
      popupShellEvent (event);
      return;
    }
    if (event.widget == popupCalendar) {
      popupCalendarEvent (event);
      return;
    }
    if (event.widget == DateTime.this) {
      onDispose (event);
      return;
    }
    if (event.widget == getShell ()) {
      getDisplay ().asyncExec (new Runnable () {
        @Override
        public void run () {
          if (isDisposed ()) return;
          handleFocus (SWT.FocusOut);
        }
      });
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
  public void handleEvent (Event event) {
    if (event.widget == popupShell) {
      popupShellEvent (event);
      return;
    }
    if (event.widget == popupCalendar) {
      popupCalendarEvent (event);
      return;
    }
    if (event.widget == DateTime.this) {
      onDispose (event);
      return;
    }
    if (event.widget == getShell ()) {
      getDisplay ().asyncExec (new Runnable () {
        @Override
        public void run () {
          if (isDisposed ()) return;
          handleFocus (SWT.FocusOut);
        }
      });
    }
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

selectAll ();
hasFocus = true;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
shell.addListener (SWT.Deactivate, popupListener);
if (focusControl == down || focusControl == popupCalendar ) return;
hasFocus = false;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
Display display = getDisplay ();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

selectAll ();
hasFocus = true;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
shell.addListener (SWT.Deactivate, popupListener);
if (focusControl == down || focusControl == popupCalendar ) return;
hasFocus = false;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
Display display = getDisplay ();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

selectAll ();
hasFocus = true;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
shell.addListener (SWT.Deactivate, popupListener);
if (focusControl == down || focusControl == popupCalendar ) return;
hasFocus = false;
Shell shell = getShell ();
shell.removeListener (SWT.Deactivate, popupListener);
Display display = getDisplay ();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void createPopupShell (int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupCalendar = new DateTime (popupShell, SWT.CALENDAR);
  if (font != null) popupCalendar.setFont (font);
  if (fg != null) popupCalendar.setForeground (fg);
  if (bg != null) popupCalendar.setBackground (bg);

  mouseEventListener = new Listener () {
    @Override
    public void handleEvent (Event event) {
      if (event.widget instanceof Control) {
        Control c = (Control)event.widget;
        if (c != down && c.getShell () != popupShell)
          dropDownCalendar (false);
      }
    }
  };

  int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint};
  for (int i=0; i < listeners.length; i++) {
    popupShell.addListener (listeners [i], popupListener);
  }
  listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
  for (int i=0; i < listeners.length; i++) {
    popupCalendar.addListener (listeners [i], popupListener);
  }
  addListener (SWT.Dispose, popupListener);
  if (year != -1) popupCalendar.setDate (year, month, day);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void createPopupShell(int year, int month, int day) {
  popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
  popupShell.isPopup = true;
  popupShell.window.setHasShadow(true);

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void showCalendar() {
  if (isDropped ()) return;
  savedYear = getYear ();
  savedMonth = getMonth ();
  savedDay = getDay ();
  if (getShell() != popupShell.getParent ()) {
    disposePopupShell();
    createPopupShell (savedYear, savedMonth, savedDay);
  }
  Point dateBounds = getSize ();
  Point calendarSize = popupCalendar.computeSize (SWT.DEFAULT, SWT.DEFAULT, false);
  popupCalendar.setBounds (1, 1, Math.max (dateBounds.x - 2, calendarSize.x), calendarSize.y);
  popupCalendar.setDate(savedYear, savedMonth, savedDay);
  Rectangle parentRect = display.map (getParent (), null, getBounds ());
  Rectangle displayRect = getMonitor ().getClientArea ();
  int width = Math.max (dateBounds.x, calendarSize.x + 2);
  int height = calendarSize.y + 2;
  int x = parentRect.x;
  int y = parentRect.y + dateBounds.y;
  if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
  if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - calendarSize.x;
  popupShell.setBounds (x, y, width, height);
  popupShell.setVisible (true);
  if (isFocusControl()) popupCalendar.setFocus ();
  display.addFilter(SWT.MouseDown, clickListener); 
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

if (getShell () != popupShell.getParent ()) {
  recreateCalendar ();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

if (getShell () != popupShell.getParent ()) {
  recreateCalendar ();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

if (getShell () != popupShell.getParent ()) {
  recreateCalendar ();

相关文章

DateTime类方法