All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.swt.widgets.Item Maven / Gradle / Ivy

Go to download

The osx x86_64 swt jar as available in the Eclipse 4.6 (Neon) release for OSX. It is suitable for use with jface and other dependencies available from maven central in the org.eclipse.scout.sdk.deps group. The sources is copied from swt-4.6-cocoa-macosx-x86_64.zip from http://download.eclipse.org/eclipse/downloads/drops4/R-4.6-201606061100/ and javadoc is generated from sources.

The newest version!
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.widgets;


import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.BidiUtil;

/**
 * This class is the abstract superclass of all non-windowed
 * user interface objects that occur within specific controls.
 * For example, a tree will contain tree items.
 * 
*
Styles:
*
(none)
*
Events:
*
(none)
*
* * @see Sample code and further information */ public abstract class Item extends Widget { String text; Image image; /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * The item is added to the end of the items maintained by its parent. *

* The style value is either one of the style constants defined in * class SWT which is applicable to instances of this * class, or must be built by bitwise OR'ing together * (that is, using the int "|" operator) two or more * of those SWT style constants. The class description * lists the style constants that are applicable to the class. * Style bits are also inherited from superclasses. *

* * @param parent a widget which will be the parent of the new instance (cannot be null) * @param style the style of item to construct * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • *
* @exception SWTException
    *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • *
* * @see SWT * @see Widget#getStyle */ public Item (Widget parent, int style) { super (parent, style); text = ""; } /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance, * and the index at which to place it in the items maintained * by its parent. *

* The style value is either one of the style constants defined in * class SWT which is applicable to instances of this * class, or must be built by bitwise OR'ing together * (that is, using the int "|" operator) two or more * of those SWT style constants. The class description * lists the style constants that are applicable to the class. * Style bits are also inherited from superclasses. *

* * @param parent a widget which will be the parent of the new instance (cannot be null) * @param style the style of item to construct * @param index the zero-relative index at which to store the receiver in its parent * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • *
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the parent (inclusive)
  • *
* @exception SWTException
    *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • *
* * @see SWT * @see Widget#getStyle */ public Item (Widget parent, int style, int index) { this (parent, style); } @Override protected void checkSubclass () { /* Do Nothing - Subclassing is allowed */ } /** * Returns the receiver's image if it has one, or null * if it does not. * * @return the receiver's image * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public Image getImage () { checkWidget (); return image; } @Override String getNameText () { return getText (); } /** * Returns the receiver's text, which will be an empty * string if it has never been set. * * @return the receiver's text * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public String getText () { checkWidget(); return text; } @Override void releaseWidget () { super.releaseWidget (); text = null; image = null; } /** * Sets the receiver's image to the argument, which may be * null indicating that no image should be displayed. * * @param image the image to display on the receiver (may be null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the image has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setImage (Image image) { checkWidget (); if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); this.image = image; } /** * Sets the receiver's text. *

* Note: If control characters like '\n', '\t' etc. are used * in the string, then the behavior is platform dependent. *

* @param string the new text * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the text is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setText (String string) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); text = string; if ((state & HAS_AUTO_DIRECTION) != 0) { updateTextDirection (AUTO_TEXT_DIRECTION); } } boolean updateTextDirection(int textDirection) { /* * textDirection argument passed here is either (1) AUTO_TEXT_DIRECTION, or * (2) 0 (i.e. match orientation) or FLIP_TEXT_DIRECTION (mismatch orientation). */ if (textDirection == AUTO_TEXT_DIRECTION) { state |= HAS_AUTO_DIRECTION; textDirection = (style ^ BidiUtil.resolveTextDirection (text)) == 0 ? 0 : SWT.FLIP_TEXT_DIRECTION; } else { state &= ~HAS_AUTO_DIRECTION; } if (((style & SWT.FLIP_TEXT_DIRECTION) ^ textDirection) != 0) { style ^= SWT.FLIP_TEXT_DIRECTION; return true; } return textDirection == AUTO_TEXT_DIRECTION; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy