Java 类org.eclipse.swt.widgets.Item 实例源码

项目:neoscada    文件:BaseFolderImplementation.java   
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 ) );
}
项目:convertigo-eclipse    文件:ArrayEditorCellModifier.java   
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;
}
项目:convertigo-eclipse    文件:TableEditorCellModifier.java   
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;
}
项目:pgcodekeeper    文件:CheckedTreeViewer.java   
/**
 * 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);
        }
    }
}
项目:pgcodekeeper    文件:CheckedTreeViewer.java   
/**
 * 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());
    }
}
项目:pgcodekeeper    文件:CheckedTreeViewer.java   
@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();
}
项目:Hydrograph    文件:TransformMappingOutputTableCellModifier.java   
@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();

}
项目:Hydrograph    文件:SecondaryColumnKeysWidgetCellModifier.java   
/**
 * 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();
}
项目:Hydrograph    文件:LookupCellModifier.java   
@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();

}
项目:team-explorer-everywhere    文件:CommonStructureControl.java   
@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());
    }
}
项目:team-explorer-everywhere    文件:PolicyConfigurationTable.java   
@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
    });
}
项目:team-explorer-everywhere    文件:RetentionPolicyTableControl.java   
@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);
    }
}
项目:subclipse    文件:ContainerCheckedTreeViewer.java   
/**
 * 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());
    }
}
项目:subclipse    文件:ContainerCheckedTreeViewer.java   
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();
}
项目:dsl-devkit    文件:ValidPreferenceCheckedTreeViewer.java   
/**
 * 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());
  }
}
项目:dsl-devkit    文件:ValidPreferenceCheckedTreeViewer.java   
/**
 * Updates the check / gray state of all parent items.
 *
 * @param item
 *          the item
 */
private void updateParentItems(final TreeItem item) {
  if (item != null) {
    final Item[] children = getChildren(item);
    boolean containsChecked = false;
    boolean containsUnchecked = false;
    for (final Item element : children) {
      final TreeItem curr = (TreeItem) element;
      containsChecked |= curr.getChecked();
      containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
    }
    item.setChecked(containsChecked);
    item.setGrayed(containsChecked && containsUnchecked);
    updateParentItems(item.getParentItem());
  }
}
项目:dsl-devkit    文件:ValidPreferenceCheckedTreeViewer.java   
/** {@inheritDoc} */
@Override
public Object[] getCheckedElements() {
  final Object[] checked = super.getCheckedElements();
  // add all items that are children of a checked node but not created yet
  final ArrayList<Object> result = new ArrayList<Object>();
  for (final Object curr : checked) {
    result.add(curr);
    final Widget item = findItem(curr);
    if (item != null) {
      final 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();
}
项目:NEXCORE-UML-Modeler    文件:TreeItemUtil.java   
/**
 * getExpandTreePaths
 *  
 * @param tree
 * @param selectedItem
 * @return TreePath[]
 */
public static TreePath[] getExpandTreePaths(Tree tree, TreeItem selectedItem) {
    ArrayList<Object> items = new ArrayList<Object>();
    internalCollectTreeItems(items, tree);
    ArrayList<Object> result = new ArrayList<Object>();

    for (Iterator<Object> it = items.iterator(); it.hasNext();) {
        Item item = (Item) it.next();
        // if (item == selectedItem) {
        TreePath treePath = getTreePathFromItem(item);
        if (treePath != null) {
            result.add(treePath);
        }
        // }
    }

    return (TreePath[]) result.toArray(new TreePath[items.size()]);
}
项目:NEXCORE-UML-Modeler    文件:TreeItemUtil.java   
/**
 * internalExpandTreeItems
 *  
 * @param result
 * @param o void
 */
private static void internalExpandTreeItems(List<Object> result, Widget o) {
    Item[] items = getChildren(o);
    for (int i = 0; i < items.length; i++) {
        Item item = items[i];
        if (item instanceof TreeItem) {
            if (((TreeItem) item).getExpanded()) {
                // Object obj = item.getData();
                // if (obj instanceof ITreeNode || obj instanceof IFolder) {
                // result.add(item);
                // }
                result.add(item);
                internalExpandTreeItems(result, item);
            }
        }
    }
}
项目:PDFReporter-Studio    文件:GalleryTreeViewer.java   
protected Item[] getSelection(Control control) {
    Item[] selection = ((Gallery) control).getSelection();
    if (selection == null) {
        return new GalleryItem[0];
    }

    List<Item> notDisposed = new ArrayList<Item>(selection.length);
    for (int i = 0; i < selection.length; i++) {
        if (!selection[i].isDisposed()) {
            notDisposed.add(selection[i]);
        } else {
            System.out.println("GalleryItem was disposed (ignoring)");
        }
    }
    selection = (GalleryItem[]) notDisposed.toArray(new GalleryItem[notDisposed.size()]);

    return selection;
}
项目:PDFReporter-Studio    文件:Gallery.java   
/**
 * Send SWT.PaintItem for one item.
 * 
 * @param item
 * @param index
 * @param gc
 * @param x
 * @param y
 */
protected void sendPaintItemEvent(Item item, int index, GC gc, int x,
        int y, int width, int height) {

    Event e = new Event();
    e.item = item;
    e.type = SWT.PaintItem;
    e.index = index;
    // TODO: Does clipping need to be set ?
    // gc.setClipping(x, y, width, height);
    e.gc = gc;
    e.x = x;
    e.y = y;
    e.width = width;
    e.height = height;
    this.notifyListeners(SWT.PaintItem, e);
}
项目:PDFReporter-Studio    文件:MultiPageToolbarEditorPart.java   
/**
 * Creates and adds a new page containing the given editor to this multi-page editor. The page is added at the given
 * index. This also hooks a property change listener on the nested editor.
 * 
 * @param index
 *          the index at which to add the page (0-based)
 * @param editor
 *          the nested editor
 * @param input
 *          the input for the nested editor
 * @exception PartInitException
 *              if a new page could not be created
 * 
 */
public void addPage(int index, IEditorPart editor, IEditorInput input) throws PartInitException {
    IEditorSite site = createSite(editor);
    // call init first so that if an exception is thrown, we have created no
    // new widgets
    editor.init(site, input);
    Composite parent2 = new Composite(getContainer(), getOrientation(editor));
    parent2.setLayout(new FillLayout());
    editor.createPartControl(parent2);
    editor.addPropertyListener(new IPropertyListener() {
        public void propertyChanged(Object source, int propertyId) {
            MultiPageToolbarEditorPart.this.handlePropertyChange(propertyId);
        }
    });
    // create item for page only after createPartControl has succeeded
    Item item = createItem(index, parent2);
    // remember the editor, as both data on the item, and in the list of
    // editors (see field comment)
    item.setData(editor);
    nestedEditors.add(editor);
}
项目:APICloud-Studio    文件:ContainerCheckedTreeViewer.java   
/**
 * 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());
    }
}
项目:APICloud-Studio    文件:ContainerCheckedTreeViewer.java   
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();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ResourceToItemsMapper.java   
/**
 * Removes an element from the map.
 * @param element The data element
 * @param item The table or tree item
 */
public void removeFromMap(Object element, Item item) {
    IResource resource= getCorrespondingResource(element);
    if (resource != null) {
        Object existingMapping= fResourceToItem.get(resource);
        if (existingMapping == null) {
            return;
        } else if (existingMapping instanceof Item) {
            fResourceToItem.remove(resource);
        } else { // List
            @SuppressWarnings("unchecked")
            List<Item> list= (List<Item>) existingMapping;
            list.remove(item);
            if (list.isEmpty()) {
                fResourceToItem.remove(list);
                releaseList(list);
            }
        }
    }
}
项目:gef-gwt    文件:TableTreeViewer.java   
protected Item newItem(Widget parent, int flags, int ix) {
    TableTreeItem item;
    if (ix >= 0) {
        if (parent instanceof TableTreeItem) {
            item = new TableTreeItem((TableTreeItem) parent, flags, ix);
        } else {
            item = new TableTreeItem((TableTree) parent, flags, ix);
        }
    } else {
        if (parent instanceof TableTreeItem) {
            item = new TableTreeItem((TableTreeItem) parent, flags);
        } else {
            item = new TableTreeItem((TableTree) parent, flags);
        }
    }
    return item;
}
项目:OpenSPIFe    文件:TreeTableViewer.java   
@Override
protected Item newItem(Widget parent, int flags, int ix) {
    TreeItem item;
    if (ix >= 0) {
        if (parent instanceof TreeItem) {
            item = new TreeItem((TreeItem) parent, flags, ix);
        } else {
            item = new TreeItem((Tree) parent, flags, ix);
        }
    } else {
        if (parent instanceof TreeItem) {
            item = new TreeItem((TreeItem) parent, flags);
        } else {
            item = new TreeItem((Tree) parent, flags);
        }
    }
    return item;
}
项目:OpenSPIFe    文件:TreeTableViewer.java   
@Override
protected void setExpanded(Item node, boolean expand) {
    TreeItem item = (TreeItem) node;
    boolean pre   = item.getExpanded();

    item.setExpanded(expand);

    /*
     * See Eclipse Bugzilla Bug 177378 and JIRA MER-176. In summary, the
     * collapseAll() and expandAll() methods filter through this
     * setExpanded() method. However, this path through the system does not
     * notify listeners of the expansion event. Therefore, we added code to
     * notify the listeners if the expansion state changes as a result of a
     * programmatic call (user clicks in the tree do notify the listeners
     * since those expansions take a different path).
     */

    // do not fire the event if the expansion state did not change
    if (pre == expand) return;
    TreeExpansionEvent e = new TreeExpansionEvent(this, node.getData());
    if (expand) fireTreeExpanded (e);
    else        fireTreeCollapsed(e);
}
项目:OpenSPIFe    文件:TreeTableViewer.java   
@Override
public void run() {
    synchronized (elementsBeingUpdated) {
        elementsBeingUpdated.removeAll(elementsNeedingUpdates);
    }
    Tree tree = getTree();
    if (tree.isDisposed()) return;
    List<TreeItem> selection = Arrays.asList(tree.getSelection());
    ViewerComparator comparator = getComparator();
    Item[] treeChildren = (comparator != null ? getChildren(tree) : null);
    for (O element : elementsNeedingUpdates) {
        boolean refreshCalled = handleObjectUpdated(element, selection, treeChildren);
        if (refreshCalled) {
            break;
        }
    }
}
项目:birt    文件:ReportItemParametersDialog.java   
/**
 * Sets text of Value column
 */
private void updateBindingData( )
{
    if ( DEUtil.getDataSetList( reportItemHandle ).size( ) == 0 )
        return;
    Iterator iterator = reportItemHandle.paramBindingsIterator( );
    while ( iterator != null && iterator.hasNext( ) )
    {
        ParamBindingHandle handle = (ParamBindingHandle) iterator.next( );
        String expression = handle.getExpression( );
        int rowIndex = this.bindingParametersList.indexOf( handle );
        if ( rowIndex != -1 && expression != null )
        {
            table.getItem( rowIndex ).setText( columnNames.length - 1,
                    expression );
            Item item = table.getItem( rowIndex );
            if ( item.getData( Binding ) == null )
                item.setData( Binding, handle );
        }
    }
}
项目:gef-gwt    文件:TreeViewer.java   
protected void handleTreeExpand(TreeEvent event) {
    // Fix for Bug 271744 because windows expanding doesn't fire a focus lost
    if( isCellEditorActive() ) {
        applyEditorValue();
    }

    if (contentProviderIsLazy) {
        if (event.item.getData() != null) {
            Item[] children = getChildren(event.item);
            if (children.length == 1 && children[0].getData()==null) {
                // we have a dummy child node, ask for an updated child
                // count
                virtualLazyUpdateChildCount(event.item, children.length);
            }
            fireTreeExpanded(new TreeExpansionEvent(this, event.item
                    .getData()));
        }
        return;
    }
    super.handleTreeExpand(event);
}
项目:gef-gwt    文件:TreeViewer.java   
/**
 * Update the child count
 * @param widget
 * @param currentChildCount
 */
private void virtualLazyUpdateChildCount(Widget widget, int currentChildCount) {
    boolean oldBusy = isBusy();
    setBusy(false);
    try {
        if (contentProviderIsTreeBased) {
            TreePath treePath;
            if (widget instanceof Item) {
                treePath = getTreePathFromItem((Item) widget);
            } else {
                treePath = TreePath.EMPTY;
            }
            ((ILazyTreePathContentProvider) getContentProvider())
            .updateChildCount(treePath, currentChildCount);
        } else {
            ((ILazyTreeContentProvider) getContentProvider()).updateChildCount(widget.getData(), currentChildCount);
        }
    } finally {
        setBusy(oldBusy);
    }
}
项目:gef-gwt    文件:TreeViewer.java   
/**
 * Update the item with the current child count.
 * @param item
 * @param currentChildCount
 */
private void virtualLazyUpdateHasChildren(Item item, int currentChildCount) {
    boolean oldBusy = isBusy();
    setBusy(false);
    try {
        if (contentProviderIsTreeBased) {
            TreePath treePath;
            treePath = getTreePathFromItem(item);
            if (currentChildCount == 0 || !((TreeItem)item).getExpanded()) {
                // item is not expanded (but may have a plus currently)
                ((ILazyTreePathContentProvider) getContentProvider())
                .updateHasChildren(treePath);
            } else {
                ((ILazyTreePathContentProvider) getContentProvider())
                .updateChildCount(treePath, currentChildCount);
            }
        } else {
            ((ILazyTreeContentProvider) getContentProvider()).updateChildCount(item.getData(), currentChildCount);
        }
    } finally {
        setBusy(oldBusy);
    }
}
项目:gef-gwt    文件:CheckboxTreeViewer.java   
/**
 * Sets the checked state of all items to correspond to the given set of checked elements.
 *
 * @param checkedElements the set (element type: <code>Object</code>) of elements which are checked
 * @param widget the widget
 */
private void internalSetChecked(CustomHashtable checkedElements,
        Widget widget) {
    Item[] items = getChildren(widget);
    for (int i = 0; i < items.length; i++) {
        TreeItem item = (TreeItem) items[i];
        Object data = item.getData();
        if (data != null) {
            boolean checked = checkedElements.containsKey(data);
            if (checked != item.getChecked()) {
                item.setChecked(checked);
            }
        }
        internalSetChecked(checkedElements, item);
    }
}
项目:gef-gwt    文件:AbstractTreeViewer.java   
/**
 * Recursively expands the subtree rooted at the given widget to the given
 * level.
 * <p>
 * </p>
 * Note that the default implementation of this method does not call
 * <code>setRedraw</code>.
 * 
 * @param widget
 *            the widget
 * @param level
 *            non-negative level, or <code>ALL_LEVELS</code> to collapse all
 *            levels of the tree
 */
protected void internalExpandToLevel(Widget widget, int level) {
    if (level == ALL_LEVELS || level > 0) {
        if (widget instanceof Item && widget.getData() != null
                && !isExpandable((Item) widget, null, widget.getData())) {
            return;
        }
        createChildren(widget, false);
        if (widget instanceof Item) {
            setExpanded((Item) widget, true);
        }
        if (level == ALL_LEVELS || level > 1) {
            Item[] children = getChildren(widget);
            if (children != null) {
                int newLevel = (level == ALL_LEVELS ? ALL_LEVELS
                        : level - 1);
                for (int i = 0; i < children.length; i++) {
                    internalExpandToLevel(children[i], newLevel);
                }
            }
        }
    }
}
项目:gef-gwt    文件:TableTreeViewer.java   
/**
 * Start editing the given element.
 * 
 * @param element
 * @param column
 */
public void editElement(Object element, int column) {
    if (cellEditor != null) {
        applyEditorValue();
    }

    setSelection(new StructuredSelection(element), true);
    Item[] selection = getSelection();
    if (selection.length != 1) {
        return;
    }

    tableItem = selection[0];

    // Make sure selection is visible
    showSelection();
    columnNumber = column;
    activateCellEditor();

}
项目:neoscada    文件:BaseFolderImplementation.java   
protected void updateItem ( final Item item, final CurrentStyle currentStyle )
{
    if ( currentStyle.image != null )
    {
        item.setImage ( currentStyle.image );
    }
    else
    {
        item.setImage ( getEmptyImage () );
    }
}
项目:convertigo-eclipse    文件:TableEditorLabelProvider.java   
public String getColumnText(Object element, int columnIndex) {

    if (element instanceof Item) {
        element = ((Item) element).getData();
    }

    TableEditorRow row = (TableEditorRow) element;
    Object object = row.getValue(columnIndex);
    return object.toString();
}
项目:convertigo-eclipse    文件:ArrayEditorLabelProvider.java   
public String getColumnText(Object element, int columnIndex) {

    if (element instanceof Item) {
        element = ((Item) element).getData();
    }

    ArrayEditorRow row = (ArrayEditorRow) element;
    Object object = row.getValue(columnIndex);
    String text = object.toString();
    return (style & SWT.PASSWORD) == 0 ? text:text.replaceAll(".", "*");
}
项目:convertigo-eclipse    文件:ArrayEditorCellModifier.java   
public void modify(Object element, String property, Object value) {
    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) {
        String text = ((ComboBoxCellEditor)cellEditor).getItems()[((Integer)value).intValue()];
        Class<?> objectClass = object.getClass();
        try {
            Constructor<?> constructor = objectClass.getConstructor(new Class[]{String.class});
            value = constructor.newInstance(new Object[]{text});
        } catch (Exception e) {
            value = new String(text);
        }
    }

    row.setValue(value, columnIndex);

    arrayEditorComposite.getRowList().rowChanged(row);
}