本文整理匯總了Java中org.eclipse.swt.widgets.Item類的典型用法代碼示例。如果您正苦於以下問題:Java Item類的具體用法?Java Item怎麽用?Java Item使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Item類屬於org.eclipse.swt.widgets包,在下文中一共展示了Item類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: useItem
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
protected void useItem ( final Item item )
{
if ( this.label != null )
{
item.setText ( this.label );
}
item.setImage ( getEmptyImage () );
this.blinker = new StyleBlinker () {
@Override
public void update ( final CurrentStyle currentStyle )
{
if ( !item.isDisposed () )
{
updateItem ( item, currentStyle );
}
}
};
this.styler = new StateStyler ( this.blinker );
this.styler.style ( new SummaryStateInformation ( this.summaryInformation ) );
}
示例2: getValue
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
public Object getValue(Object element, String property) {
int columnIndex = Arrays.asList(tableViewer.getColumnProperties()).indexOf(property);
CellEditor[] cellEditors = tableViewer.getCellEditors();
CellEditor cellEditor = cellEditors[columnIndex];
boolean isComboBoxEditor = cellEditor instanceof ComboBoxCellEditor;
if (element instanceof Item) {
element = ((Item) element).getData();
}
ArrayEditorRow row = (ArrayEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
return object;
}
示例3: getValue
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
public Object getValue(Object element, String property) {
int columnIndex = Arrays.asList(tableViewer.getColumnProperties()).indexOf(property);
CellEditor[] cellEditors = tableViewer.getCellEditors();
CellEditor cellEditor = cellEditors[columnIndex];
boolean isComboBoxEditor = cellEditor instanceof ComboBoxCellEditor;
boolean isTextCellEditor = cellEditor instanceof TextCellEditor;
if (element instanceof Item) {
element = ((Item) element).getData();
}
TableEditorRow row = (TableEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
if (isTextCellEditor && (!(object instanceof String))) {
object = object.toString();
}
return object;
}
示例4: updateChildrenItems
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
/**
* Updates the check state of all created children
*/
private void updateChildrenItems(TreeItem parent) {
boolean state = parent.getChecked();
// do not implicitly check children, only uncheck
if(state) {
return;
}
Item[] children = getChildren(parent);
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
if (curr.getData() != null
&& ((curr.getChecked() != state) || curr.getGrayed())) {
curr.setChecked(state);
curr.setGrayed(false);
updateChildrenItems(curr);
}
}
}
示例5: updateParentItems
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children = getChildren(item);
boolean containsChecked = false;
boolean containsUnchecked = false;
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
示例6: getCheckedElements
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public Object[] getCheckedElements() {
Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList<Object> result = new ArrayList<>();
for (int i = 0; i < checked.length; i++) {
Object curr = checked[i];
result.add(curr);
Widget item = findItem(curr);
if (item != null) {
Item[] children = getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
示例7: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
{
element = ((Item) element).getData();
}
FilterProperties filterProperties = (FilterProperties) element;
int indexOfSelectedField= transformDialog.getATMapping().getOutputFieldList().indexOf(filterProperties);
filterProperties.setPropertyname((String )value);
if(indexOfSelectedField==-1)
transformDialog.getATMapping().getOutputFieldList().add(filterProperties);
transformDialog.refreshOutputTable();
transformDialog.showHideValidationMessage();
viewer.refresh();
}
示例8: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
/**
* Modifies the element
*
* @param element
* the element
* @param property
* the property
* @param value
* the value
*/
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
SecondaryColumnKeysInformation p = (SecondaryColumnKeysInformation) element;
if (COLUMNNAME.equals(property)){
if(ParameterUtil.isParameter((String)value)){
p.setSortOrder(Constants.NONE_SORT_ORDER);
}
p.setColumnName(((String) value));
}else if (SORTORDER.equals(property)){
if(!ParameterUtil.isParameter(p.getColumnName()) && !Constants.NONE_SORT_ORDER.equals((String) value)){
p.setSortOrder((String) value);
}else
p.setSortOrder(Constants.ASCENDING_SORT_ORDER);
}
// Force the viewer to refresh
viewer.refresh();
}
示例9: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
LookupMapProperty mapp = (LookupMapProperty) element;
if (ELTLookupMapWizard.PROPERTY_NAME.equals(property)){
if(ParameterUtil.isParameter((String)value)){
mapp.setOutput_Field((String)value);
}
mapp.setSource_Field((String)value);
}
if (ELTLookupMapWizard.PROPERTY_VALUE.equals(property)){
if(ParameterUtil.isParameter((String)value)){
mapp.setSource_Field((String)value);
}
mapp.setOutput_Field((String)value);
}
viewer.refresh();
}
示例10: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public void modify(final Object element, final String property, final Object value) {
final CSSNode node = (CSSNode) (element instanceof Item ? ((Item) element).getData() : element);
if (node.getURI().length() == 0) {
// this is a new node.
if (value == null || value.toString() == null || value.toString().trim().length() == 0) {
// No name provided - remove the new node.
final CSSNode parent = node.getParentNode();
parent.removeChildNode(node);
cssControl.getTreeViewer().setSelection(new StructuredSelection(parent));
cssControl.getTreeViewer().refresh(parent);
return;
}
cssControl.newNode(node, value.toString().trim());
} else {
// Renaming a node
if (value == null || value.toString() == null || value.toString().trim().length() == 0) {
return;
}
cssControl.renameNode(node, value.toString().trim());
}
}
示例11: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public void modify(final Object element, final String property, final Object value) {
final PolicyConfiguration policyConfiguration =
(PolicyConfiguration) (element instanceof Item ? ((Item) element).getData() : element);
final String sValue = (String) value;
int priority;
try {
priority = Integer.parseInt(sValue);
} catch (final NumberFormatException e) {
return;
}
policyConfiguration.setPriority(priority);
viewer.update(policyConfiguration, new String[] {
property
});
}
示例12: modify
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
@Override
public void modify(final Object element, final String property, final Object value) {
if (KEEP_COL.equals(property) || DELETE_COL.equals(property)) {
IRetentionPolicy policy;
if (element instanceof Item) {
policy = (IRetentionPolicy) ((Item) element).getData();
} else {
policy = (IRetentionPolicy) element;
}
final int selectedIndex = ((Integer) value).intValue();
if (KEEP_COL.equals(property)) {
if (selectedIndex < 0 || values[selectedIndex] < 0) {
return;
}
policy.setNumberToKeep(values[selectedIndex]);
} else {
if (selectedIndex < 0 || deleteValues[selectedIndex] == null) {
return;
}
policy.setDeleteOptions((deleteValues[selectedIndex]));
}
viewer.update(policy, null);
}
}
示例13: updateParentItems
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children= getChildren(item);
boolean containsChecked= false;
boolean containsUnchecked= false;
for (int i= 0; i < children.length; i++) {
TreeItem curr= (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
示例14: getCheckedElements
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
public Object[] getCheckedElements() {
Object[] checked= super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList result= new ArrayList();
for (int i= 0; i < checked.length; i++) {
Object curr= checked[i];
result.add(curr);
Widget item= findItem(curr);
if (item != null) {
Item[] children= getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
示例15: doCheckStateChanged
import org.eclipse.swt.widgets.Item; //導入依賴的package包/類
/**
* Update the parent and children nodes after a checkstate change (e.g. recalculation of the grayed state, automatic
* checking/unchecking of children)
*
* @param element
* the element that was checked/unchecked
*/
protected void doCheckStateChanged(final Object element) {
final Widget item = findItem(element);
if (item instanceof TreeItem) {
final TreeItem treeItem = (TreeItem) item;
updateChildrenItems(treeItem);
final Item[] children = getChildren(item);
if (children.length > 0) {
boolean containsChecked = false;
boolean containsUnchecked = false;
for (final Item element2 : children) {
final TreeItem curr = (TreeItem) element2;
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
treeItem.setChecked(containsChecked);
treeItem.setGrayed(containsChecked && containsUnchecked);
}
updateParentItems(treeItem.getParentItem());
}
}