org.eclipse.nebula.widgets.grid.IInternalWidget Java Examples

The following examples show how to use org.eclipse.nebula.widgets.grid.IInternalWidget. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultColumnGroupHeaderRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value)
{
    GridColumnGroup group = (GridColumnGroup)value;

    if ((group.getStyle() & SWT.TOGGLE) != 0)
    {
        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (getToggleBounds().contains(point))
            {
                group.setExpanded(!group.getExpanded());

                if (group.getExpanded())
                {
                    group.notifyListeners(SWT.Expand,new Event());
                }
                else
                {
                    group.notifyListeners(SWT.Collapse,new Event());
                }
                return true;
            }
        }
        else
        {
            if (getToggleBounds().contains(point))
            {
                setHoverDetail("toggle");
                return true;
            }
        }
    }

    return false;
}
 
Example #2
Source File: DefaultColumnGroupHeaderRenderer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value)
{
    GridColumnGroup group = (GridColumnGroup)value;

    if ((group.getStyle() & SWT.TOGGLE) != 0)
    {
        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (getToggleBounds().contains(point))
            {
                group.setExpanded(!group.getExpanded());

                if (group.getExpanded())
                {
                    group.notifyListeners(SWT.Expand,new Event());
                }
                else
                {
                    group.notifyListeners(SWT.Collapse,new Event());
                }
                return true;
            }
        }
        else
        {
            if (getToggleBounds().contains(point))
            {
                setHoverDetail("toggle");
                return true;
            }
        }
    }

    return false;
}
 
Example #3
Source File: DefaultColumnGroupHeaderRenderer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value)
{
    GridColumnGroup group = (GridColumnGroup)value;

    if ((group.getStyle() & SWT.TOGGLE) != 0)
    {
        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (getToggleBounds().contains(point))
            {
                group.setExpanded(!group.getExpanded());

                if (group.getExpanded())
                {
                    group.notifyListeners(SWT.Expand,new Event());
                }
                else
                {
                    group.notifyListeners(SWT.Collapse,new Event());
                }
                return true;
            }
        }
        else
        {
            if (getToggleBounds().contains(point))
            {
                setHoverDetail("toggle");
                return true;
            }
        }
    }

    return false;
}
 
Example #4
Source File: CellRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value) {

	GridItem item = (GridItem) value;

	if (isCheck()) {
		if (event == IInternalWidget.MouseMove) {
			if (overCheck(item, point)) {
				setHoverDetail("check");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overCheck(item, point)) {
				if (!item.getCheckable(getColumn())) {
					return false;
				}

				item.setChecked(getColumn(), !item.getChecked(getColumn()));
				item.getParent().redraw();

				item.fireCheckEvent(getColumn());

				return true;
			}
		}
	}

	if (isTree() && item.hasChildren()) {
		if (event == IInternalWidget.MouseMove) {
			if (overToggle(item, point)) {
				setHoverDetail("toggle");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overToggle(item, point)) {
				item.setExpanded(!item.isExpanded());
				item.getParent().redraw();

				if (item.isExpanded()) {
					item.fireEvent(SWT.Expand);
				} else {
					item.fireEvent(SWT.Collapse);
				}

				return true;
			}
		}
	}

	return false;
}
 
Example #5
Source File: TBSearchCellRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value) {

	GridItem item = (GridItem) value;

	if (isCheck()) {
		if (event == IInternalWidget.MouseMove) {
			if (overCheck(item, point)) {
				setHoverDetail("check");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overCheck(item, point)) {
				if (!item.getCheckable(getColumn())) {
					return false;
				}

				item.setChecked(getColumn(), !item.getChecked(getColumn()));
				item.getParent().redraw();

				item.fireCheckEvent(getColumn());

				return true;
			}
		}
	}

	if (isTree() && item.hasChildren()) {
		if (event == IInternalWidget.MouseMove) {
			if (overToggle(item, point)) {
				setHoverDetail("toggle");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overToggle(item, point)) {
				item.setExpanded(!item.isExpanded());
				item.getParent().redraw();

				if (item.isExpanded()) {
					item.fireEvent(SWT.Expand);
				} else {
					item.fireEvent(SWT.Collapse);
				}

				return true;
			}
		}
	}

	return false;
}
 
Example #6
Source File: DefaultCellRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value)
{

    GridItem item = (GridItem)value;

    if (isCheck())
    {
        if (event == IInternalWidget.MouseMove)
        {
            if (overCheck(item, point))
            {
                setHoverDetail("check");
                return true;
            }
        }

        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (overCheck(item, point))
            {
                if (!item.getCheckable(getColumn()))
                {
                    return false;
                }

                item.setChecked(getColumn(), !item.getChecked(getColumn()));
                item.getParent().redraw();

                item.fireCheckEvent(getColumn());

                return true;
            }
        }
    }

    if (isTree() && item.hasChildren())
    {
        if (event == IInternalWidget.MouseMove)
        {
            if (overToggle(item, point))
            {
                setHoverDetail("toggle");
                return true;
            }
        }

        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (overToggle(item, point))
            {
                item.setExpanded(!item.isExpanded());
                item.getParent().redraw();

                if (item.isExpanded())
                {
                    item.fireEvent(SWT.Expand);
                }
                else
                {
                    item.fireEvent(SWT.Collapse);
                }

                return true;
            }
        }
    }

    return false;
}
 
Example #7
Source File: CellRenderer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value) {

	GridItem item = (GridItem) value;

	if (isCheck()) {
		if (event == IInternalWidget.MouseMove) {
			if (overCheck(item, point)) {
				setHoverDetail("check");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overCheck(item, point)) {
				if (!item.getCheckable(getColumn())) {
					return false;
				}

				item.setChecked(getColumn(), !item.getChecked(getColumn()));
				item.getParent().redraw();

				item.fireCheckEvent(getColumn());

				return true;
			}
		}
	}

	if (isTree() && item.hasChildren()) {
		if (event == IInternalWidget.MouseMove) {
			if (overToggle(item, point)) {
				setHoverDetail("toggle");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overToggle(item, point)) {
				item.setExpanded(!item.isExpanded());
				item.getParent().redraw();

				if (item.isExpanded()) {
					item.fireEvent(SWT.Expand);
				} else {
					item.fireEvent(SWT.Collapse);
				}

				return true;
			}
		}
	}

	return false;
}
 
Example #8
Source File: TBSearchCellRenderer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value) {

	GridItem item = (GridItem) value;

	if (isCheck()) {
		if (event == IInternalWidget.MouseMove) {
			if (overCheck(item, point)) {
				setHoverDetail("check");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overCheck(item, point)) {
				if (!item.getCheckable(getColumn())) {
					return false;
				}

				item.setChecked(getColumn(), !item.getChecked(getColumn()));
				item.getParent().redraw();

				item.fireCheckEvent(getColumn());

				return true;
			}
		}
	}

	if (isTree() && item.hasChildren()) {
		if (event == IInternalWidget.MouseMove) {
			if (overToggle(item, point)) {
				setHoverDetail("toggle");
				return true;
			}
		}

		if (event == IInternalWidget.LeftMouseButtonDown) {
			if (overToggle(item, point)) {
				item.setExpanded(!item.isExpanded());
				item.getParent().redraw();

				if (item.isExpanded()) {
					item.fireEvent(SWT.Expand);
				} else {
					item.fireEvent(SWT.Collapse);
				}

				return true;
			}
		}
	}

	return false;
}
 
Example #9
Source File: DefaultCellRenderer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean notify(int event, Point point, Object value)
{

    GridItem item = (GridItem)value;

    if (isCheck())
    {
        if (event == IInternalWidget.MouseMove)
        {
            if (overCheck(item, point))
            {
                setHoverDetail("check");
                return true;
            }
        }

        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (overCheck(item, point))
            {
                if (!item.getCheckable(getColumn()))
                {
                    return false;
                }

                item.setChecked(getColumn(), !item.getChecked(getColumn()));
                item.getParent().redraw();

                item.fireCheckEvent(getColumn());

                return true;
            }
        }
    }

    if (isTree() && item.hasChildren())
    {
        if (event == IInternalWidget.MouseMove)
        {
            if (overToggle(item, point))
            {
                setHoverDetail("toggle");
                return true;
            }
        }

        if (event == IInternalWidget.LeftMouseButtonDown)
        {
            if (overToggle(item, point))
            {
                item.setExpanded(!item.isExpanded());
                item.getParent().redraw();

                if (item.isExpanded())
                {
                    item.fireEvent(SWT.Expand);
                }
                else
                {
                    item.fireEvent(SWT.Collapse);
                }

                return true;
            }
        }
    }

    return false;
}