Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Customization of cell activation strategy
Customization of cell activation strategy [message #43530] Mon, 19 November 2007 16:17 Go to next message
Andrey Kononenko is currently offline Andrey KononenkoFriend
Messages: 11
Registered: July 2009
Junior Member
Dear colleagues

I’ve met some issue with the strategy with mouse event. It works by mouse
down event only. Perhaps, it covers most requests, but I need select
several cells by mouse dragging (e.g. because of single click editor
activation strategy). So I’ve customized the strategy by overriding
hookEditingSupport() method for handling mouse up/down and calculating
some flag . The flag allows make decision about starting of editor. But it
looks like a hack. So I’d like to ask you about some improvement of Grid.
Perhaps, it‘d be useful for other user of the library.

1. Could you modify the cell activation strategy for any event (not only
for mouse down event).
2. What do you think about some useful method like ColumnViewer#getCell
with default access? Have you considered asking developer of jface to
change its modifier?
3. What do you think about adding some “deactivation strategy” for
behavior customization?

Thank you in advance!

Regards
Andrey
Re: Customization of cell activation strategy [message #43562 is a reply to message #43530] Mon, 19 November 2007 16:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Dear colleagues
>
> I�ve met some issue with the strategy with mouse event. It works by
> mouse down event only. Perhaps, it covers most requests, but I need
> select several cells by mouse dragging (e.g. because of single click
> editor activation strategy). So I�ve customized the strategy by
> overriding hookEditingSupport() method for handling mouse up/down and

Is this really needed why are you not simply overloading

ColumnViewerEditorActivationStrategy#isEditorActivationEvent () like
shown in
http://wiki.eclipse.org/JFaceSnippets#Snippet026TreeViewerTa bEditing?

> calculating some flag . The flag allows make decision about starting of
> editor. But it looks like a hack. So I�d like to ask you about some
> improvement of Grid. Perhaps, it�d be useful for other user of the library.
>
> 1. Could you modify the cell activation strategy for any event (not only

Which event beside Mouse and Keyboard do you think is need for
Activation? You can always force activation by
ColumnViewer#editElement(Object,int).

> for mouse down event). 2. What do you think about some useful method
> like ColumnViewer#getCell with default access? Have you considered

Why do you need this method, log a bug against Platform/UI and prefix
your summary with [Viewers] and make sure you give us use-case without
one opening API is hard to push through :-)

> asking developer of jface to change its modifier? 3. What do you think
> about adding some �deactivation strategy� for behavior customization?

What do you want to customize? You can already register as a listener
and get notified when the editor is deactivated I'm not sure currently
whether you can veto it.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43593 is a reply to message #43562] Tue, 20 November 2007 10:59 Go to previous messageGo to next message
Andrey Kononenko is currently offline Andrey KononenkoFriend
Messages: 11
Registered: July 2009
Junior Member
Dear Tom

Thank you very much for your quick and well-grounded answer. Perhaps, I
did not give you accurate description of my needs. Moreover, my needs lay
in jFace classes and Nebula just use s it. So perhaps my question should
be addressed to jFace developer. But I believe my improvement would be
useful in Grid component.

I’ve changed the snippet for grid to describe my needs and suggestions.

1. We use single click editor activation, so first mouse DOWN click calls
isEditorActivationEvent (because of it is called from ColumnViewer#
handleMouseDown). An issue is how to start editor by mouse Up event
(which is not handled by default in isEditorActivationEvent), because if
mouseUp event performs in another cell, than editor should not start at
all. Could you share your vision of approach? Our idea is extend
GridTableViewer and add handleMouseUp method very similar to
handleMouseDown (so this method should calculate cell by getCell method,
which has default access).

2. Please use tabbing in my example. As you see, Tab changes a focus and
START editor for next cell. But selection stays in previous cell. This is
the first issue for tabbing. Would you mind to say your oppinion about
this

3. Second issue with tabbing is how change tabbing behavior for NOT
STARTING editoršin the most 'standart' way. My idea about `deactivation
strategy’ tries to resolve cases like this: describe standard cases which
CLOSE editor.

Thank you in advance

Regards
Andrey

/**
* A simple TreeViewer to demonstrate usage
*
* @author Tom Schindl <tom.schindl@bestsolution.at>
*
*/
public class Snippet026TreeViewerTabEditingForGrid {
public Snippet026TreeViewerTabEditingForGrid(final Shell shell) {
Button b = new Button(shell,SWT.PUSH);
b.setText("Remove column");
// Grid used instead jFace viewer
final GridTableViewer v = new GridTableViewer(shell, SWT.FULL_SELECTION);
v.getGrid().setLinesVisible(true);
v.getGrid().setHeaderVisible(true);
b.addSelectionListener(new SelectionListener() {

public void widgetDefaultSelected(SelectionEvent e) {

}

public void widgetSelected(SelectionEvent e) {
v.getGrid().getColumn(1).dispose();
}

});

// does not available for Grid
//TableViewerFocusCellManager focusCellManager = new
TableViewerFocusCellManager(v,new FocusCellOwnerDrawHighlighter(v));
ColumnViewerEditorActivationStrategy actSupport = new
ColumnViewerEditorActivationStrategy(v) {
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
System.out.println("event "+event.eventType);
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
//mouse click activation!!!
|| event.eventType ==
ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
&& event.keyCode == SWT.CR)
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};


GridViewerEditor.create(v, actSupport,
ColumnViewerEditor.TABBING_HORIZONTAL |
ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
| ColumnViewerEditor.TABBING_VERTICAL |
ColumnViewerEditor.KEYBOARD_ACTIVATION);
v.getGrid().setCellSelectionEnabled(true);

final TextCellEditor textCellEditor = new TextCellEditor(v.getGrid());

GridViewerColumn column = new GridViewerColumn(v, SWT.NONE);

//code from real snippet
Re: Customization of cell activation strategy [message #43625 is a reply to message #43593] Tue, 20 November 2007 11:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Dear Tom
>
> Thank you very much for your quick and well-grounded answer. Perhaps, I
> did not give you accurate description of my needs. Moreover, my needs
> lay in jFace classes and Nebula just use s it. So perhaps my question
> should be addressed to jFace developer. But I believe my improvement
> would be useful in Grid component.

Did you read my footer :-). I'm one of the persons to "blame" for the
new API you are using.

>
> I�ve changed the snippet for grid to describe my needs and suggestions.
> 1. We use single click editor activation, so first mouse DOWN click
> calls isEditorActivationEvent (because of it is called from
> ColumnViewer# handleMouseDown). An issue is how to start editor by
> mouse Up event (which is not handled by default in
> isEditorActivationEvent), because if mouseUp event performs in another
> cell, than editor should not start at all. Could you share your vision
> of approach? Our idea is extend GridTableViewer and add handleMouseUp
> method very similar to handleMouseDown (so this method should calculate
> cell by getCell method, which has default access).

Hm. Maybe we should move the code to register for mouseEvents from
ColumnViewer to ColumnViewerEditorActivationStrategy, need to think
about this a bit. I think one problem from SWT-point of View is that on
certain platforms you only receive one of the 2 events (but I not sure
any more).

>
> 2. Please use tabbing in my example. As you see, Tab changes a focus and
> START editor for next cell. But selection stays in previous cell. This
> is the first issue for tabbing. Would you mind to say your oppinion
> about this

I think I can remember that this is Grid special behaviour if you try
the SWT-Example it moves the focused cell. Could it be that the standard
behaviour of Grid is same behaviour than the one of Excel which Grid
tries to mimic?

> 3. Second issue with tabbing is how change tabbing behavior for NOT
> STARTING editoršin the most 'standart' way. My idea about `deactivation
> strategy� tries to resolve cases like this: describe standard cases
> which CLOSE editor.

Can you please rephrase this. I'm afraid I can't follow you here.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43655 is a reply to message #43625] Tue, 20 November 2007 12:02 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

>> 2. Please use tabbing in my example. As you see, Tab changes a focus
>> and START editor for next cell. But selection stays in previous cell.
>> This is the first issue for tabbing. Would you mind to say your
>> oppinion about this
>
> I think I can remember that this is Grid special behaviour if you try
> the SWT-Example it moves the focused cell. Could it be that the standard
> behaviour of Grid is same behaviour than the one of Excel which Grid
> tries to mimic?


And it is really. Take a look at the

GridViewerEditor#updateFocusCell(
ViewerCell,
ColumnViewerEditorActivationEvent
)

and compare it with the one from e.g. TableViewerEditor the grid is
responsible for this itself. So this is not JFace problem the
JFace-Support for this is already there. Maybe GridViewerEditor could
make this configurable.

If you subclass and overload with:

> protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) {
> if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
> || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
> Grid grid = ((Grid)getViewer().getControl());
> grid.deselectAllCells();
> grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
> }
> }

It a kind of works, a kind of because there seems to be a bug in the
Grid-implementation when one sets the selection like this, the new cell
is hightlighted but the focus border is not moved. I'm not an expert on
Grid's implementation so maybe I have to do some thing different.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43684 is a reply to message #43655] Tue, 20 November 2007 12:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

> It a kind of works, a kind of because there seems to be a bug in the
> Grid-implementation when one sets the selection like this, the new cell
> is hightlighted but the focus border is not moved. I'm not an expert on
> Grid's implementation so maybe I have to do some thing different.
>

It's not a bug my implementation was wrong:

> protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) {
> if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
> || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
> Grid grid = ((Grid)getViewer().getControl());
> grid.deselectAllCells();
> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
> grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
> }
> }


> Tom
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43715 is a reply to message #43684] Tue, 20 November 2007 15:53 Go to previous messageGo to next message
Andrey Kononenko is currently offline Andrey KononenkoFriend
Messages: 11
Registered: July 2009
Junior Member
Tom

Thank you once more for your very useful solutions and your attention.

>> It a kind of works, a kind of because there seems to be a bug in the
>> Grid-implementation when one sets the selection like this, the new
>> cell is hightlighted but the focus border is not moved. I'm not an
>> expert on Grid's implementation so maybe I have to do some thing
>> different.
> It's not a bug my implementation was wrong:
>
>> protected void updateFocusCell(ViewerCell focusCell,
>> ColumnViewerEditorActivationEvent event) {
>> if (event.eventType ==
>> ColumnViewerEditorActivationEvent.PROGRAMMATIC
>> || event.eventType ==
>> ColumnViewerEditorActivationEvent.TRAVERSAL) {
>> Grid grid = ((Grid)getViewer().getControl());
>> grid.deselectAllCells();
>>
>> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
>> grid.setCellSelection(new
>>
Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));

>>
>> }
>> }

I've considered a similar solution to yours, but I met some issues:

1. GridViewerEditor has constructor with default access, so it is not
easy to extend it. Could you describe reasons for this access type? or
could you change it to protected?

2. As I understand standard behavior for tabbing for Grid and SWT
STARTS(!) editor for next cell. Nevertheless it seems as not common
solution, e.g. Excel does not start editor by tabbing. So traversal
event works only if editor is activated, but I don't want start editor
in this case. Could your share your ideas about this 'loop'?

Please find answers for your question from other items below:

>> Second issue with tabbing is how change tabbing behavior for NOT
>> STARTING editoršin the most 'standard' way. My idea about
>>'deactivation strategy' tries to resolve cases like this: describe
>> standard cases which CLOSE editor.

>Can you please rephrase this. I'm afraid I can't follow you here.
New GridViewerEditor has parameter ColumnViewerEditorActivationStrategy
which allows describe a strategy to make decision about start editing.
It is very useful for extending Grid without deriving. I've suggested
add a similar strategy for deactivation. It could cover cases with
starting editor, canceling/applying value from editor by some events
etc. Because now a lot of functionality hidden inside code and listeners
do not guarantied for good solution (at least clear and maintainable
solution).

4.>> What do you think about some useful method like
>>ColumnViewer#getCell with default access? Have you considered

> Why do you need this method, log a bug against Platform/UI and prefix
> your summary with [Viewers] and make sure you give us use-case
without > one opening API is hard to push through :-)
I need the method for handle mouse up event at least. But my reason for
asking was behind my needs. Method ColumnViewer#getViewerRow(Point) has
a protected access, but a similar method ColumnViewer#getCell(Point) has
default access. What is the difference between the methods? In my case I
have to copy code from getCell() without any explicit reasons. Perhaps
methods like getCell() could be have protected modifier?

Sorry for disturb you with my issues. Thank you once more for your
efforts. I really appreciate you!

Regards
Andrey


> [...]
>
>> It a kind of works, a kind of because there seems to be a bug in the
>> Grid-implementation when one sets the selection like this, the new
>> cell is hightlighted but the focus border is not moved. I'm not an
>> expert on Grid's implementation so maybe I have to do some thing
>> different.
>>
>
> It's not a bug my implementation was wrong:
>
>> protected void updateFocusCell(ViewerCell focusCell,
>> ColumnViewerEditorActivationEvent event) {
>> if (event.eventType ==
>> ColumnViewerEditorActivationEvent.PROGRAMMATIC
>> || event.eventType ==
>> ColumnViewerEditorActivationEvent.TRAVERSAL) {
>> Grid grid = ((Grid)getViewer().getControl());
>> grid.deselectAllCells();
>>
>> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
>> grid.setCellSelection(new
>> Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
>>
>> }
>> }
>
>
>> Tom
>>
>
>
Re: Customization of cell activation strategy [message #43747 is a reply to message #43715] Tue, 20 November 2007 16:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Tom
>
> Thank you once more for your very useful solutions and your attention.
>
> >> It a kind of works, a kind of because there seems to be a bug in the
> >> Grid-implementation when one sets the selection like this, the new
> >> cell is hightlighted but the focus border is not moved. I'm not an
> >> expert on Grid's implementation so maybe I have to do some thing
> >> different.
> > It's not a bug my implementation was wrong:
> >
> >> protected void updateFocusCell(ViewerCell focusCell,
> >> ColumnViewerEditorActivationEvent event) {
> >> if (event.eventType ==
> >> ColumnViewerEditorActivationEvent.PROGRAMMATIC
> >> || event.eventType ==
> >> ColumnViewerEditorActivationEvent.TRAVERSAL) {
> >> Grid grid = ((Grid)getViewer().getControl());
> >> grid.deselectAllCells();
> >>
> >> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
> >> grid.setCellSelection(new
> >>
> Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
>
> >>
> >> }
> >> }
>
> I've considered a similar solution to yours, but I met some issues:
>
> 1. GridViewerEditor has constructor with default access, so it is not
> easy to extend it. Could you describe reasons for this access type? or
> could you change it to protected?

Please log a bug against Nebula and we'll discuss implementing this in
the GridViewerEditor there. The reason why we expose as few API as
possible is that we have to support everything which is protected/public
forever (see http://wiki.eclipse.org/Evolving_Java-based_APIs and
http://wiki.eclipse.org/Evolving_Java-based_APIs_2)

>
> 2. As I understand standard behavior for tabbing for Grid and SWT
> STARTS(!) editor for next cell. Nevertheless it seems as not common
> solution, e.g. Excel does not start editor by tabbing. So traversal
> event works only if editor is activated, but I don't want start editor
> in this case. Could your share your ideas about this 'loop'?
>

What should happen if you hit the Tab-Key? Should the focus simply move
the the next cell?

If this is true does implementing the strategy like this:

> ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v) {
> protected boolean isEditorActivationEvent(
> ColumnViewerEditorActivationEvent event) {
> return /*event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
> ||*/ event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTI ON
> || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
> || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
> }
> };

does give you this behaviour?


> Please find answers for your question from other items below:
>
> >> Second issue with tabbing is how change tabbing behavior for NOT
> >> STARTING editoršin the most 'standard' way. My idea about
> >>'deactivation strategy' tries to resolve cases like this: describe
> >> standard cases which CLOSE editor.
>
> >Can you please rephrase this. I'm afraid I can't follow you here.
> New GridViewerEditor has parameter ColumnViewerEditorActivationStrategy
> which allows describe a strategy to make decision about start editing.
> It is very useful for extending Grid without deriving. I've suggested
> add a similar strategy for deactivation. It could cover cases with
> starting editor, canceling/applying value from editor by some events
> etc. Because now a lot of functionality hidden inside code and listeners
> do not guarantied for good solution (at least clear and maintainable
> solution).

Please give me an example what such an event could be? Currently the
CellEditor is responsible to define when it wants to apply the value and
it is the right place IMHO.

You can already cancle/apply the editor value programmatically using
ColumnViewer#cancelEditing and ColumnViewer#applyEditorValue() where
applyEditorValue is protected and you should request opening-up for you
in JFace 3.4 (log a bug against Platform/UI) and/or convince Chris that
it is a good idea to provide it as an API-Method in Nebface.

>
> 4.>> What do you think about some useful method like
> >>ColumnViewer#getCell with default access? Have you considered
>
> > Why do you need this method, log a bug against Platform/UI and prefix
> > your summary with [Viewers] and make sure you give us use-case
> without > one opening API is hard to push through :-)
> I need the method for handle mouse up event at least. But my reason for
> asking was behind my needs. Method ColumnViewer#getViewerRow(Point) has
> a protected access, but a similar method ColumnViewer#getCell(Point) has
> default access. What is the difference between the methods? In my case I
> have to copy code from getCell() without any explicit reasons. Perhaps
> methods like getCell() could be have protected modifier?

For reasons see above. I can't remember why we made
ColumnViewer#getViewerRow(Point) and it looks like a bug that we made it
protected but we can't reduce visibility any more this would be an
API-breaking change.

You are right it might be a good use case to open the API, the problem I
see with the cell that is returned from this call has special behaviour
because the underlying ViewerRow might change without notification so it
might make more sense for external customers to that the public method
returns a clone here.

Please log a bug against Platform/UI describing your use case.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43868 is a reply to message #43747] Sat, 24 November 2007 13:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I've logged bug 210833 to track navigation customization. There are some
problems with Grid currently make this not look right but maybe I'm
simply using the wrong API

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43967 is a reply to message #43715] Tue, 27 November 2007 08:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey,

It seems you have yourself not attached to the bug I filed [1]. I wanted
to inform you that the relevant changes have been made in CVS to allow
customization of focus behaviour. With introduced a new constant
(GridViewerEditor#FOCUS_FOLLOWS_EDITOR) you can use to modify the focus
behaviour.

You *haven't filed any bugs* so I assume with the change from above your
use case can be supported using JFace/Nebface without subclassing or any
other hacks (I think about the opening of the
ColumnViewer#applyEditorValue() here).

Tom

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=210833

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #43996 is a reply to message #43967] Wed, 28 November 2007 12:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: akn.ciklum.net

Tom,

Thank you very much! It's the great job!

Sorry for delay, I've been on vacation. Now I've create issue (bug) for
access modifier of GridViewerEditor's constructor. It is not critical
issue for now, but I believe its fixing would be simplify extending of
the GridViewerEditor. Thank you in advance.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=211088

Regards
Andrey

> Andrey,
>
> It seems you have yourself not attached to the bug I filed [1]. I wanted
> to inform you that the relevant changes have been made in CVS to allow
> customization of focus behaviour. With introduced a new constant
> (GridViewerEditor#FOCUS_FOLLOWS_EDITOR) you can use to modify the focus
> behaviour.
>
> You *haven't filed any bugs* so I assume with the change from above your
> use case can be supported using JFace/Nebface without subclassing or any
> other hacks (I think about the opening of the
> ColumnViewer#applyEditorValue() here).
>
> Tom
>
> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=210833
>
Re: Customization of cell activation strategy [message #44025 is a reply to message #43562] Wed, 28 November 2007 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: akn.ciklum.net

Tom

I'd like to detail my question about cell editor activation and multi
cell selection. Is it possible in Grid to use mouseUp event for calling
a cell editor activation strategy in method sEditorActivationEvent(...)?

Details:

handleEditorActivationEvent(...) method is called only during MouseDown
event (in method handleMouseDown(...)). Thus if MOUSE_CLICK_SELECTION
uses for cell editor activation, than it is considered only for
mouseDown event and starts editor by first mouseDown event. If user
wants select several cells by mouse dragging, then first selected cell
will be with started editor.

It is possible override method hookEditingSupport(...) and add
handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
handleMouseDown(...) uses some package access methods (e.g.
getCell(...)), so we need copy this method in our class. This code
doubling is not good in my opinion.

Would you mind to add a customization for this case to chose mouseDown
and MouseUp event? Perhaps, it would be useful for multi cell selection.
What do you think about it?

Thank you in advance.

Regards
Andrey

> Andrey schrieb:
>> Dear colleagues
>>
>> I�ve met some issue with the strategy with mouse event. It works by
>> mouse down event only. Perhaps, it covers most requests, but I need
>> select several cells by mouse dragging (e.g. because of single click
>> editor activation strategy). So I�ve customized the strategy by
>> overriding hookEditingSupport() method for handling mouse up/down and
>
> Is this really needed why are you not simply overloading
>
> ColumnViewerEditorActivationStrategy#isEditorActivationEvent () like
> shown in
> http://wiki.eclipse.org/JFaceSnippets#Snippet026TreeViewerTa bEditing?
>
>> calculating some flag . The flag allows make decision about starting
>> of editor. But it looks like a hack. So I�d like to ask you about some
>> improvement of Grid. Perhaps, it�d be useful for other user of the
>> library.
>>
>> 1. Could you modify the cell activation strategy for any event (not only
>
> Which event beside Mouse and Keyboard do you think is need for
> Activation? You can always force activation by
> ColumnViewer#editElement(Object,int).
>
>> for mouse down event). 2. What do you think about some useful method
>> like ColumnViewer#getCell with default access? Have you considered
>
> Why do you need this method, log a bug against Platform/UI and prefix
> your summary with [Viewers] and make sure you give us use-case without
> one opening API is hard to push through :-)
>
>> asking developer of jface to change its modifier? 3. What do you think
>> about adding some �deactivation strategy� for behavior customization?
>
> What do you want to customize? You can already register as a listener
> and get notified when the editor is deactivated I'm not sure currently
> whether you can veto it.
>
> Tom
>
Re: Customization of cell activation strategy [message #44055 is a reply to message #44025] Wed, 28 November 2007 13:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
1. Dumb question
----------------
Doesn't selecting multiple cells always involves pressing SHIFT or CTRL
so this could be the indicator for you to cancle the editor activation
event.

2. Access to internal methods
-----------------------------
a) File a bug!!!!!!! I'm not the only decision maker there are others
who have more to say than me and without getting them involved by
filing bugs against Platform/UI nothing will get done!

b) Use reflection to access them in the meanwhile

3. Subclassing classes that are not intended to be subclassed
------------------------------------------------------------ -
Is nothing we can stop you from doing but don't blame us if your code
suddenly breaks in future. We support what we defined as API but after
that you are on your own

More details below.

Andrey schrieb:
> Tom
>
> I'd like to detail my question about cell editor activation and multi
> cell selection. Is it possible in Grid to use mouseUp event for calling
> a cell editor activation strategy in method sEditorActivationEvent(...)?

No.

>
> Details:
>
> handleEditorActivationEvent(...) method is called only during MouseDown
> event (in method handleMouseDown(...)). Thus if MOUSE_CLICK_SELECTION
> uses for cell editor activation, than it is considered only for
> mouseDown event and starts editor by first mouseDown event. If user
> wants select several cells by mouse dragging, then first selected cell
> will be with started editor.
>

Looks like a valid use case.

> It is possible override method hookEditingSupport(...) and add
> handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
> handleMouseDown(...) uses some package access methods (e.g.
> getCell(...)), so we need copy this method in our class. This code
> doubling is not good in my opinion.

See 2 and 3

>
> Would you mind to add a customization for this case to chose mouseDown
> and MouseUp event? Perhaps, it would be useful for multi cell selection.
> What do you think about it?

See 2b

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #44085 is a reply to message #44055] Wed, 28 November 2007 16:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: akn.ciklum.net

This is a multi-part message in MIME format.
--------------060005070407070701010903
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Tom

Thank you for your patience and complete answers. I appreciate you for
all suggestions, explanations and great job!

I use newsgroup before filing a bug (as warned in bugzilla) to
understand your reason and opinion for some features and behavior. I'd
like to create some issues only after it.

So I'd like to give you a use-case.

> 1. Dumb question
> ----------------
> Doesn't selecting multiple cells always involves pressing SHIFT or CTRL
> so this could be the indicator for you to cancel the editor activation
> event.
What about mouse dragging? Moreover, please see an attached file and try
to use following use-case for check box.

1. Mouse down on check box.
2. Drag mouse to other column (e.g. on 1st column)
3. Mouse up on other cell.

Expected result: several cells are selected (from the mouseDown to the
mouseUp cells).

Actual result: no selection, check box change its state.

What is your opinion about the use-case? Is it worth to create an
enhancement?

Regards
Andrey

> 2. Access to internal methods
> -----------------------------
> a) File a bug!!!!!!! I'm not the only decision maker there are others
> who have more to say than me and without getting them involved by
> filing bugs against Platform/UI nothing will get done!
>
> b) Use reflection to access them in the meanwhile
>
> 3. Subclassing classes that are not intended to be subclassed
> ------------------------------------------------------------ -
> Is nothing we can stop you from doing but don't blame us if your code
> suddenly breaks in future. We support what we defined as API but after
> that you are on your own
>
> More details below.
>
> Andrey schrieb:
>> Tom
>>
>> I'd like to detail my question about cell editor activation and multi
>> cell selection. Is it possible in Grid to use mouseUp event for
>> calling a cell editor activation strategy in method
>> sEditorActivationEvent(...)?
>
> No.
>
>>
>> Details:
>>
>> handleEditorActivationEvent(...) method is called only during
>> MouseDown event (in method handleMouseDown(...)). Thus if
>> MOUSE_CLICK_SELECTION uses for cell editor activation, than it is
>> considered only for mouseDown event and starts editor by first
>> mouseDown event. If user wants select several cells by mouse dragging,
>> then first selected cell will be with started editor.
>>
>
> Looks like a valid use case.
>
>> It is possible override method hookEditingSupport(...) and add
>> handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
>> handleMouseDown(...) uses some package access methods (e.g.
>> getCell(...)), so we need copy this method in our class. This code
>> doubling is not good in my opinion.
>
> See 2 and 3
>
>>
>> Would you mind to add a customization for this case to chose mouseDown
>> and MouseUp event? Perhaps, it would be useful for multi cell
>> selection. What do you think about it?
>
> See 2b
>
> Tom
>


--------------060005070407070701010903
Content-Type: text/plain;
name="Snippet026TreeViewerTabEditingForGrid.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="Snippet026TreeViewerTabEditingForGrid.java"

cGFja2FnZSBvcmcuZWNsaXBzZS5zd3QubmVidWxhLnNuaXBwZXRzLmdyaWQ7 DQoNCmltcG9y
dCBqYXZhLnV0aWwuQXJyYXlMaXN0Ow0KDQppbXBvcnQgb3JnLmVjbGlwc2Uu amZhY2Uudmll
d2Vycy5DZWxsRWRpdG9yOw0KaW1wb3J0IG9yZy5lY2xpcHNlLmpmYWNlLnZp ZXdlcnMuQ29s
dW1uTGFiZWxQcm92aWRlcjsNCmltcG9ydCBvcmcuZWNsaXBzZS5qZmFjZS52 aWV3ZXJzLkNv
bHVtblZpZXdlckVkaXRvcjsNCmltcG9ydCBvcmcuZWNsaXBzZS5qZmFjZS52 aWV3ZXJzLkNv
bHVtblZpZXdlckVkaXRvckFjdGl2YXRpb25TdHJhdGVneTsNCmltcG9ydCBv cmcuZWNsaXBz
ZS5qZmFjZS52aWV3ZXJzLkVkaXRpbmdTdXBwb3J0Ow0KaW1wb3J0IG9yZy5l Y2xpcHNlLmpm
YWNlLnZpZXdlcnMuQ29sdW1uVmlld2VyRWRpdG9yQWN0aXZhdGlvbkV2ZW50 Ow0KaW1wb3J0
IG9yZy5lY2xpcHNlLmpmYWNlLnZpZXdlcnMuSVRyZWVDb250ZW50UHJvdmlk ZXI7DQppbXBv
cnQgb3JnLmVjbGlwc2UuamZhY2Uudmlld2Vycy5UZXh0Q2VsbEVkaXRvcjsN Cg0KaW1wb3J0
IG9yZy5lY2xpcHNlLmpmYWNlLnZpZXdlcnMuVmlld2VyOw0KaW1wb3J0IG9y Zy5lY2xpcHNl
Lm5lYnVsYS5qZmFjZS5ncmlkdmlld2VyLkdyaWRUYWJsZVZpZXdlcjsNCmlt cG9ydCBvcmcu
ZWNsaXBzZS5uZWJ1bGEuamZhY2UuZ3JpZHZpZXdlci5HcmlkVmlld2VyQ29s dW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NCg0KCQkJcnYgKz0gY291bnRl cjsNCg0KCQkJ
cmV0dXJuIHJ2Ow0KCQl9DQoJfQ0KDQp9DQoNCg==
--------------060005070407070701010903--
Re: Customization of cell activation strategy [message #44115 is a reply to message #44085] Wed, 28 November 2007 17:13 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Tom
>
> Thank you for your patience and complete answers. I appreciate you for
> all suggestions, explanations and great job!
>
> I use newsgroup before filing a bug (as warned in bugzilla) to
> understand your reason and opinion for some features and behavior. I'd
> like to create some issues only after it.
>

As said looks like a valid use case. I understand but the newsgroup has
the draw back to only Chris and me are following it but others like the
guys from Platform/UI are not. So to explain them later on where we are
coming from takes time that could have been invested better.

It's the right point to go to bugzilla now!

> So I'd like to give you a use-case.
>
>> 1. Dumb question
>> ----------------
>> Doesn't selecting multiple cells always involves pressing SHIFT or
>> CTRL so this could be the indicator for you to cancel the editor
>> activation event.
> What about mouse dragging? Moreover, please see an attached file and try
> to use following use-case for check box.
>
> 1. Mouse down on check box.
> 2. Drag mouse to other column (e.g. on 1st column)
> 3. Mouse up on other cell.
>
> Expected result: several cells are selected (from the mouseDown to the
> mouseUp cells).
>
> Actual result: no selection, check box change its state.
>
> What is your opinion about the use-case? Is it worth to create an
> enhancement?
>

Sure file a bug against Platform/UI and include the snippet, the sooner
the better because the API freeze is not far away and all decision
makers are as always swapped with a lot of work :-)

I'm currently not sure who has to handle this (Nebface/JFace) but we'll
find it out.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586482 is a reply to message #43530] Mon, 19 November 2007 16:28 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Dear colleagues
>
> I�ve met some issue with the strategy with mouse event. It works by
> mouse down event only. Perhaps, it covers most requests, but I need
> select several cells by mouse dragging (e.g. because of single click
> editor activation strategy). So I�ve customized the strategy by
> overriding hookEditingSupport() method for handling mouse up/down and

Is this really needed why are you not simply overloading

ColumnViewerEditorActivationStrategy#isEditorActivationEvent () like
shown in
http://wiki.eclipse.org/JFaceSnippets#Snippet026TreeViewerTa bEditing?

> calculating some flag . The flag allows make decision about starting of
> editor. But it looks like a hack. So I�d like to ask you about some
> improvement of Grid. Perhaps, it�d be useful for other user of the library.
>
> 1. Could you modify the cell activation strategy for any event (not only

Which event beside Mouse and Keyboard do you think is need for
Activation? You can always force activation by
ColumnViewer#editElement(Object,int).

> for mouse down event). 2. What do you think about some useful method
> like ColumnViewer#getCell with default access? Have you considered

Why do you need this method, log a bug against Platform/UI and prefix
your summary with [Viewers] and make sure you give us use-case without
one opening API is hard to push through :-)

> asking developer of jface to change its modifier? 3. What do you think
> about adding some �deactivation strategy� for behavior customization?

What do you want to customize? You can already register as a listener
and get notified when the editor is deactivated I'm not sure currently
whether you can veto it.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586494 is a reply to message #43562] Tue, 20 November 2007 10:59 Go to previous message
Andrey Kononenko is currently offline Andrey KononenkoFriend
Messages: 11
Registered: July 2009
Junior Member
Dear Tom

Thank you very much for your quick and well-grounded answer. Perhaps, I
did not give you accurate description of my needs. Moreover, my needs lay
in jFace classes and Nebula just use s it. So perhaps my question should
be addressed to jFace developer. But I believe my improvement would be
useful in Grid component.

I’ve changed the snippet for grid to describe my needs and suggestions.

1. We use single click editor activation, so first mouse DOWN click calls
isEditorActivationEvent (because of it is called from ColumnViewer#
handleMouseDown). An issue is how to start editor by mouse Up event
(which is not handled by default in isEditorActivationEvent), because if
mouseUp event performs in another cell, than editor should not start at
all. Could you share your vision of approach? Our idea is extend
GridTableViewer and add handleMouseUp method very similar to
handleMouseDown (so this method should calculate cell by getCell method,
which has default access).

2. Please use tabbing in my example. As you see, Tab changes a focus and
START editor for next cell. But selection stays in previous cell. This is
the first issue for tabbing. Would you mind to say your oppinion about
this

3. Second issue with tabbing is how change tabbing behavior for NOT
STARTING editoršin the most 'standart' way. My idea about `deactivation
strategy’ tries to resolve cases like this: describe standard cases which
CLOSE editor.

Thank you in advance

Regards
Andrey

/**
* A simple TreeViewer to demonstrate usage
*
* @author Tom Schindl <tom.schindl@bestsolution.at>
*
*/
public class Snippet026TreeViewerTabEditingForGrid {
public Snippet026TreeViewerTabEditingForGrid(final Shell shell) {
Button b = new Button(shell,SWT.PUSH);
b.setText("Remove column");
// Grid used instead jFace viewer
final GridTableViewer v = new GridTableViewer(shell, SWT.FULL_SELECTION);
v.getGrid().setLinesVisible(true);
v.getGrid().setHeaderVisible(true);
b.addSelectionListener(new SelectionListener() {

public void widgetDefaultSelected(SelectionEvent e) {

}

public void widgetSelected(SelectionEvent e) {
v.getGrid().getColumn(1).dispose();
}

});

// does not available for Grid
//TableViewerFocusCellManager focusCellManager = new
TableViewerFocusCellManager(v,new FocusCellOwnerDrawHighlighter(v));
ColumnViewerEditorActivationStrategy actSupport = new
ColumnViewerEditorActivationStrategy(v) {
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
System.out.println("event "+event.eventType);
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
//mouse click activation!!!
|| event.eventType ==
ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
&& event.keyCode == SWT.CR)
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};


GridViewerEditor.create(v, actSupport,
ColumnViewerEditor.TABBING_HORIZONTAL |
ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
| ColumnViewerEditor.TABBING_VERTICAL |
ColumnViewerEditor.KEYBOARD_ACTIVATION);
v.getGrid().setCellSelectionEnabled(true);

final TextCellEditor textCellEditor = new TextCellEditor(v.getGrid());

GridViewerColumn column = new GridViewerColumn(v, SWT.NONE);

//code from real snippet
Re: Customization of cell activation strategy [message #586498 is a reply to message #43593] Tue, 20 November 2007 11:24 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Dear Tom
>
> Thank you very much for your quick and well-grounded answer. Perhaps, I
> did not give you accurate description of my needs. Moreover, my needs
> lay in jFace classes and Nebula just use s it. So perhaps my question
> should be addressed to jFace developer. But I believe my improvement
> would be useful in Grid component.

Did you read my footer :-). I'm one of the persons to "blame" for the
new API you are using.

>
> I�ve changed the snippet for grid to describe my needs and suggestions.
> 1. We use single click editor activation, so first mouse DOWN click
> calls isEditorActivationEvent (because of it is called from
> ColumnViewer# handleMouseDown). An issue is how to start editor by
> mouse Up event (which is not handled by default in
> isEditorActivationEvent), because if mouseUp event performs in another
> cell, than editor should not start at all. Could you share your vision
> of approach? Our idea is extend GridTableViewer and add handleMouseUp
> method very similar to handleMouseDown (so this method should calculate
> cell by getCell method, which has default access).

Hm. Maybe we should move the code to register for mouseEvents from
ColumnViewer to ColumnViewerEditorActivationStrategy, need to think
about this a bit. I think one problem from SWT-point of View is that on
certain platforms you only receive one of the 2 events (but I not sure
any more).

>
> 2. Please use tabbing in my example. As you see, Tab changes a focus and
> START editor for next cell. But selection stays in previous cell. This
> is the first issue for tabbing. Would you mind to say your oppinion
> about this

I think I can remember that this is Grid special behaviour if you try
the SWT-Example it moves the focused cell. Could it be that the standard
behaviour of Grid is same behaviour than the one of Excel which Grid
tries to mimic?

> 3. Second issue with tabbing is how change tabbing behavior for NOT
> STARTING editoršin the most 'standart' way. My idea about `deactivation
> strategy� tries to resolve cases like this: describe standard cases
> which CLOSE editor.

Can you please rephrase this. I'm afraid I can't follow you here.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586511 is a reply to message #43625] Tue, 20 November 2007 12:02 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

>> 2. Please use tabbing in my example. As you see, Tab changes a focus
>> and START editor for next cell. But selection stays in previous cell.
>> This is the first issue for tabbing. Would you mind to say your
>> oppinion about this
>
> I think I can remember that this is Grid special behaviour if you try
> the SWT-Example it moves the focused cell. Could it be that the standard
> behaviour of Grid is same behaviour than the one of Excel which Grid
> tries to mimic?


And it is really. Take a look at the

GridViewerEditor#updateFocusCell(
ViewerCell,
ColumnViewerEditorActivationEvent
)

and compare it with the one from e.g. TableViewerEditor the grid is
responsible for this itself. So this is not JFace problem the
JFace-Support for this is already there. Maybe GridViewerEditor could
make this configurable.

If you subclass and overload with:

> protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) {
> if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
> || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
> Grid grid = ((Grid)getViewer().getControl());
> grid.deselectAllCells();
> grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
> }
> }

It a kind of works, a kind of because there seems to be a bug in the
Grid-implementation when one sets the selection like this, the new cell
is hightlighted but the focus border is not moved. I'm not an expert on
Grid's implementation so maybe I have to do some thing different.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586523 is a reply to message #43655] Tue, 20 November 2007 12:05 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

> It a kind of works, a kind of because there seems to be a bug in the
> Grid-implementation when one sets the selection like this, the new cell
> is hightlighted but the focus border is not moved. I'm not an expert on
> Grid's implementation so maybe I have to do some thing different.
>

It's not a bug my implementation was wrong:

> protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) {
> if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
> || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
> Grid grid = ((Grid)getViewer().getControl());
> grid.deselectAllCells();
> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
> grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
> }
> }


> Tom
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586532 is a reply to message #43684] Tue, 20 November 2007 15:53 Go to previous message
Andrey Kononenko is currently offline Andrey KononenkoFriend
Messages: 11
Registered: July 2009
Junior Member
Tom

Thank you once more for your very useful solutions and your attention.

>> It a kind of works, a kind of because there seems to be a bug in the
>> Grid-implementation when one sets the selection like this, the new
>> cell is hightlighted but the focus border is not moved. I'm not an
>> expert on Grid's implementation so maybe I have to do some thing
>> different.
> It's not a bug my implementation was wrong:
>
>> protected void updateFocusCell(ViewerCell focusCell,
>> ColumnViewerEditorActivationEvent event) {
>> if (event.eventType ==
>> ColumnViewerEditorActivationEvent.PROGRAMMATIC
>> || event.eventType ==
>> ColumnViewerEditorActivationEvent.TRAVERSAL) {
>> Grid grid = ((Grid)getViewer().getControl());
>> grid.deselectAllCells();
>>
>> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
>> grid.setCellSelection(new
>>
Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));

>>
>> }
>> }

I've considered a similar solution to yours, but I met some issues:

1. GridViewerEditor has constructor with default access, so it is not
easy to extend it. Could you describe reasons for this access type? or
could you change it to protected?

2. As I understand standard behavior for tabbing for Grid and SWT
STARTS(!) editor for next cell. Nevertheless it seems as not common
solution, e.g. Excel does not start editor by tabbing. So traversal
event works only if editor is activated, but I don't want start editor
in this case. Could your share your ideas about this 'loop'?

Please find answers for your question from other items below:

>> Second issue with tabbing is how change tabbing behavior for NOT
>> STARTING editoršin the most 'standard' way. My idea about
>>'deactivation strategy' tries to resolve cases like this: describe
>> standard cases which CLOSE editor.

>Can you please rephrase this. I'm afraid I can't follow you here.
New GridViewerEditor has parameter ColumnViewerEditorActivationStrategy
which allows describe a strategy to make decision about start editing.
It is very useful for extending Grid without deriving. I've suggested
add a similar strategy for deactivation. It could cover cases with
starting editor, canceling/applying value from editor by some events
etc. Because now a lot of functionality hidden inside code and listeners
do not guarantied for good solution (at least clear and maintainable
solution).

4.>> What do you think about some useful method like
>>ColumnViewer#getCell with default access? Have you considered

> Why do you need this method, log a bug against Platform/UI and prefix
> your summary with [Viewers] and make sure you give us use-case
without > one opening API is hard to push through :-)
I need the method for handle mouse up event at least. But my reason for
asking was behind my needs. Method ColumnViewer#getViewerRow(Point) has
a protected access, but a similar method ColumnViewer#getCell(Point) has
default access. What is the difference between the methods? In my case I
have to copy code from getCell() without any explicit reasons. Perhaps
methods like getCell() could be have protected modifier?

Sorry for disturb you with my issues. Thank you once more for your
efforts. I really appreciate you!

Regards
Andrey


> [...]
>
>> It a kind of works, a kind of because there seems to be a bug in the
>> Grid-implementation when one sets the selection like this, the new
>> cell is hightlighted but the focus border is not moved. I'm not an
>> expert on Grid's implementation so maybe I have to do some thing
>> different.
>>
>
> It's not a bug my implementation was wrong:
>
>> protected void updateFocusCell(ViewerCell focusCell,
>> ColumnViewerEditorActivationEvent event) {
>> if (event.eventType ==
>> ColumnViewerEditorActivationEvent.PROGRAMMATIC
>> || event.eventType ==
>> ColumnViewerEditorActivationEvent.TRAVERSAL) {
>> Grid grid = ((Grid)getViewer().getControl());
>> grid.deselectAllCells();
>>
>> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
>> grid.setCellSelection(new
>> Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
>>
>> }
>> }
>
>
>> Tom
>>
>
>
Re: Customization of cell activation strategy [message #586543 is a reply to message #43715] Tue, 20 November 2007 16:42 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Tom
>
> Thank you once more for your very useful solutions and your attention.
>
> >> It a kind of works, a kind of because there seems to be a bug in the
> >> Grid-implementation when one sets the selection like this, the new
> >> cell is hightlighted but the focus border is not moved. I'm not an
> >> expert on Grid's implementation so maybe I have to do some thing
> >> different.
> > It's not a bug my implementation was wrong:
> >
> >> protected void updateFocusCell(ViewerCell focusCell,
> >> ColumnViewerEditorActivationEvent event) {
> >> if (event.eventType ==
> >> ColumnViewerEditorActivationEvent.PROGRAMMATIC
> >> || event.eventType ==
> >> ColumnViewerEditorActivationEvent.TRAVERSAL) {
> >> Grid grid = ((Grid)getViewer().getControl());
> >> grid.deselectAllCells();
> >>
> >> grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex( )));
> >> grid.setCellSelection(new
> >>
> Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focu sCell.getItem())));
>
> >>
> >> }
> >> }
>
> I've considered a similar solution to yours, but I met some issues:
>
> 1. GridViewerEditor has constructor with default access, so it is not
> easy to extend it. Could you describe reasons for this access type? or
> could you change it to protected?

Please log a bug against Nebula and we'll discuss implementing this in
the GridViewerEditor there. The reason why we expose as few API as
possible is that we have to support everything which is protected/public
forever (see http://wiki.eclipse.org/Evolving_Java-based_APIs and
http://wiki.eclipse.org/Evolving_Java-based_APIs_2)

>
> 2. As I understand standard behavior for tabbing for Grid and SWT
> STARTS(!) editor for next cell. Nevertheless it seems as not common
> solution, e.g. Excel does not start editor by tabbing. So traversal
> event works only if editor is activated, but I don't want start editor
> in this case. Could your share your ideas about this 'loop'?
>

What should happen if you hit the Tab-Key? Should the focus simply move
the the next cell?

If this is true does implementing the strategy like this:

> ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v) {
> protected boolean isEditorActivationEvent(
> ColumnViewerEditorActivationEvent event) {
> return /*event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
> ||*/ event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTI ON
> || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
> || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
> }
> };

does give you this behaviour?


> Please find answers for your question from other items below:
>
> >> Second issue with tabbing is how change tabbing behavior for NOT
> >> STARTING editoršin the most 'standard' way. My idea about
> >>'deactivation strategy' tries to resolve cases like this: describe
> >> standard cases which CLOSE editor.
>
> >Can you please rephrase this. I'm afraid I can't follow you here.
> New GridViewerEditor has parameter ColumnViewerEditorActivationStrategy
> which allows describe a strategy to make decision about start editing.
> It is very useful for extending Grid without deriving. I've suggested
> add a similar strategy for deactivation. It could cover cases with
> starting editor, canceling/applying value from editor by some events
> etc. Because now a lot of functionality hidden inside code and listeners
> do not guarantied for good solution (at least clear and maintainable
> solution).

Please give me an example what such an event could be? Currently the
CellEditor is responsible to define when it wants to apply the value and
it is the right place IMHO.

You can already cancle/apply the editor value programmatically using
ColumnViewer#cancelEditing and ColumnViewer#applyEditorValue() where
applyEditorValue is protected and you should request opening-up for you
in JFace 3.4 (log a bug against Platform/UI) and/or convince Chris that
it is a good idea to provide it as an API-Method in Nebface.

>
> 4.>> What do you think about some useful method like
> >>ColumnViewer#getCell with default access? Have you considered
>
> > Why do you need this method, log a bug against Platform/UI and prefix
> > your summary with [Viewers] and make sure you give us use-case
> without > one opening API is hard to push through :-)
> I need the method for handle mouse up event at least. But my reason for
> asking was behind my needs. Method ColumnViewer#getViewerRow(Point) has
> a protected access, but a similar method ColumnViewer#getCell(Point) has
> default access. What is the difference between the methods? In my case I
> have to copy code from getCell() without any explicit reasons. Perhaps
> methods like getCell() could be have protected modifier?

For reasons see above. I can't remember why we made
ColumnViewer#getViewerRow(Point) and it looks like a bug that we made it
protected but we can't reduce visibility any more this would be an
API-breaking change.

You are right it might be a good use case to open the API, the problem I
see with the cell that is returned from this call has special behaviour
because the underlying ViewerRow might change without notification so it
might make more sense for external customers to that the public method
returns a clone here.

Please log a bug against Platform/UI describing your use case.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586600 is a reply to message #43747] Sat, 24 November 2007 13:20 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I've logged bug 210833 to track navigation customization. There are some
problems with Grid currently make this not look right but maybe I'm
simply using the wrong API

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586644 is a reply to message #43715] Tue, 27 November 2007 08:47 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey,

It seems you have yourself not attached to the bug I filed [1]. I wanted
to inform you that the relevant changes have been made in CVS to allow
customization of focus behaviour. With introduced a new constant
(GridViewerEditor#FOCUS_FOLLOWS_EDITOR) you can use to modify the focus
behaviour.

You *haven't filed any bugs* so I assume with the change from above your
use case can be supported using JFace/Nebface without subclassing or any
other hacks (I think about the opening of the
ColumnViewer#applyEditorValue() here).

Tom

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=210833

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586657 is a reply to message #43967] Wed, 28 November 2007 12:24 Go to previous message
Andrey is currently offline AndreyFriend
Messages: 8
Registered: July 2009
Junior Member
Tom,

Thank you very much! It's the great job!

Sorry for delay, I've been on vacation. Now I've create issue (bug) for
access modifier of GridViewerEditor's constructor. It is not critical
issue for now, but I believe its fixing would be simplify extending of
the GridViewerEditor. Thank you in advance.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=211088

Regards
Andrey

> Andrey,
>
> It seems you have yourself not attached to the bug I filed [1]. I wanted
> to inform you that the relevant changes have been made in CVS to allow
> customization of focus behaviour. With introduced a new constant
> (GridViewerEditor#FOCUS_FOLLOWS_EDITOR) you can use to modify the focus
> behaviour.
>
> You *haven't filed any bugs* so I assume with the change from above your
> use case can be supported using JFace/Nebface without subclassing or any
> other hacks (I think about the opening of the
> ColumnViewer#applyEditorValue() here).
>
> Tom
>
> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=210833
>
Re: Customization of cell activation strategy [message #586666 is a reply to message #43562] Wed, 28 November 2007 13:21 Go to previous message
Andrey is currently offline AndreyFriend
Messages: 8
Registered: July 2009
Junior Member
Tom

I'd like to detail my question about cell editor activation and multi
cell selection. Is it possible in Grid to use mouseUp event for calling
a cell editor activation strategy in method sEditorActivationEvent(...)?

Details:

handleEditorActivationEvent(...) method is called only during MouseDown
event (in method handleMouseDown(...)). Thus if MOUSE_CLICK_SELECTION
uses for cell editor activation, than it is considered only for
mouseDown event and starts editor by first mouseDown event. If user
wants select several cells by mouse dragging, then first selected cell
will be with started editor.

It is possible override method hookEditingSupport(...) and add
handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
handleMouseDown(...) uses some package access methods (e.g.
getCell(...)), so we need copy this method in our class. This code
doubling is not good in my opinion.

Would you mind to add a customization for this case to chose mouseDown
and MouseUp event? Perhaps, it would be useful for multi cell selection.
What do you think about it?

Thank you in advance.

Regards
Andrey

> Andrey schrieb:
>> Dear colleagues
>>
>> I�ve met some issue with the strategy with mouse event. It works by
>> mouse down event only. Perhaps, it covers most requests, but I need
>> select several cells by mouse dragging (e.g. because of single click
>> editor activation strategy). So I�ve customized the strategy by
>> overriding hookEditingSupport() method for handling mouse up/down and
>
> Is this really needed why are you not simply overloading
>
> ColumnViewerEditorActivationStrategy#isEditorActivationEvent () like
> shown in
> http://wiki.eclipse.org/JFaceSnippets#Snippet026TreeViewerTa bEditing?
>
>> calculating some flag . The flag allows make decision about starting
>> of editor. But it looks like a hack. So I�d like to ask you about some
>> improvement of Grid. Perhaps, it�d be useful for other user of the
>> library.
>>
>> 1. Could you modify the cell activation strategy for any event (not only
>
> Which event beside Mouse and Keyboard do you think is need for
> Activation? You can always force activation by
> ColumnViewer#editElement(Object,int).
>
>> for mouse down event). 2. What do you think about some useful method
>> like ColumnViewer#getCell with default access? Have you considered
>
> Why do you need this method, log a bug against Platform/UI and prefix
> your summary with [Viewers] and make sure you give us use-case without
> one opening API is hard to push through :-)
>
>> asking developer of jface to change its modifier? 3. What do you think
>> about adding some �deactivation strategy� for behavior customization?
>
> What do you want to customize? You can already register as a listener
> and get notified when the editor is deactivated I'm not sure currently
> whether you can veto it.
>
> Tom
>
Re: Customization of cell activation strategy [message #586679 is a reply to message #44025] Wed, 28 November 2007 13:44 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
1. Dumb question
----------------
Doesn't selecting multiple cells always involves pressing SHIFT or CTRL
so this could be the indicator for you to cancle the editor activation
event.

2. Access to internal methods
-----------------------------
a) File a bug!!!!!!! I'm not the only decision maker there are others
who have more to say than me and without getting them involved by
filing bugs against Platform/UI nothing will get done!

b) Use reflection to access them in the meanwhile

3. Subclassing classes that are not intended to be subclassed
------------------------------------------------------------ -
Is nothing we can stop you from doing but don't blame us if your code
suddenly breaks in future. We support what we defined as API but after
that you are on your own

More details below.

Andrey schrieb:
> Tom
>
> I'd like to detail my question about cell editor activation and multi
> cell selection. Is it possible in Grid to use mouseUp event for calling
> a cell editor activation strategy in method sEditorActivationEvent(...)?

No.

>
> Details:
>
> handleEditorActivationEvent(...) method is called only during MouseDown
> event (in method handleMouseDown(...)). Thus if MOUSE_CLICK_SELECTION
> uses for cell editor activation, than it is considered only for
> mouseDown event and starts editor by first mouseDown event. If user
> wants select several cells by mouse dragging, then first selected cell
> will be with started editor.
>

Looks like a valid use case.

> It is possible override method hookEditingSupport(...) and add
> handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
> handleMouseDown(...) uses some package access methods (e.g.
> getCell(...)), so we need copy this method in our class. This code
> doubling is not good in my opinion.

See 2 and 3

>
> Would you mind to add a customization for this case to chose mouseDown
> and MouseUp event? Perhaps, it would be useful for multi cell selection.
> What do you think about it?

See 2b

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Customization of cell activation strategy [message #586694 is a reply to message #44055] Wed, 28 November 2007 16:53 Go to previous message
Andrey is currently offline AndreyFriend
Messages: 8
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------060005070407070701010903
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Tom

Thank you for your patience and complete answers. I appreciate you for
all suggestions, explanations and great job!

I use newsgroup before filing a bug (as warned in bugzilla) to
understand your reason and opinion for some features and behavior. I'd
like to create some issues only after it.

So I'd like to give you a use-case.

> 1. Dumb question
> ----------------
> Doesn't selecting multiple cells always involves pressing SHIFT or CTRL
> so this could be the indicator for you to cancel the editor activation
> event.
What about mouse dragging? Moreover, please see an attached file and try
to use following use-case for check box.

1. Mouse down on check box.
2. Drag mouse to other column (e.g. on 1st column)
3. Mouse up on other cell.

Expected result: several cells are selected (from the mouseDown to the
mouseUp cells).

Actual result: no selection, check box change its state.

What is your opinion about the use-case? Is it worth to create an
enhancement?

Regards
Andrey

> 2. Access to internal methods
> -----------------------------
> a) File a bug!!!!!!! I'm not the only decision maker there are others
> who have more to say than me and without getting them involved by
> filing bugs against Platform/UI nothing will get done!
>
> b) Use reflection to access them in the meanwhile
>
> 3. Subclassing classes that are not intended to be subclassed
> ------------------------------------------------------------ -
> Is nothing we can stop you from doing but don't blame us if your code
> suddenly breaks in future. We support what we defined as API but after
> that you are on your own
>
> More details below.
>
> Andrey schrieb:
>> Tom
>>
>> I'd like to detail my question about cell editor activation and multi
>> cell selection. Is it possible in Grid to use mouseUp event for
>> calling a cell editor activation strategy in method
>> sEditorActivationEvent(...)?
>
> No.
>
>>
>> Details:
>>
>> handleEditorActivationEvent(...) method is called only during
>> MouseDown event (in method handleMouseDown(...)). Thus if
>> MOUSE_CLICK_SELECTION uses for cell editor activation, than it is
>> considered only for mouseDown event and starts editor by first
>> mouseDown event. If user wants select several cells by mouse dragging,
>> then first selected cell will be with started editor.
>>
>
> Looks like a valid use case.
>
>> It is possible override method hookEditingSupport(...) and add
>> handleMouseUp(...) method (similar to handleMouseDown). Nevertheless
>> handleMouseDown(...) uses some package access methods (e.g.
>> getCell(...)), so we need copy this method in our class. This code
>> doubling is not good in my opinion.
>
> See 2 and 3
>
>>
>> Would you mind to add a customization for this case to chose mouseDown
>> and MouseUp event? Perhaps, it would be useful for multi cell
>> selection. What do you think about it?
>
> See 2b
>
> Tom
>


--------------060005070407070701010903
Content-Type: text/plain;
name="Snippet026TreeViewerTabEditingForGrid.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="Snippet026TreeViewerTabEditingForGrid.java"

cGFja2FnZSBvcmcuZWNsaXBzZS5zd3QubmVidWxhLnNuaXBwZXRzLmdyaWQ7 DQoNCmltcG9y
dCBqYXZhLnV0aWwuQXJyYXlMaXN0Ow0KDQppbXBvcnQgb3JnLmVjbGlwc2Uu amZhY2Uudmll
d2Vycy5DZWxsRWRpdG9yOw0KaW1wb3J0IG9yZy5lY2xpcHNlLmpmYWNlLnZp ZXdlcnMuQ29s
dW1uTGFiZWxQcm92aWRlcjsNCmltcG9ydCBvcmcuZWNsaXBzZS5qZmFjZS52 aWV3ZXJzLkNv
bHVtblZpZXdlckVkaXRvcjsNCmltcG9ydCBvcmcuZWNsaXBzZS5qZmFjZS52 aWV3ZXJzLkNv
bHVtblZpZXdlckVkaXRvckFjdGl2YXRpb25TdHJhdGVneTsNCmltcG9ydCBv cmcuZWNsaXBz
ZS5qZmFjZS52aWV3ZXJzLkVkaXRpbmdTdXBwb3J0Ow0KaW1wb3J0IG9yZy5l Y2xpcHNlLmpm
YWNlLnZpZXdlcnMuQ29sdW1uVmlld2VyRWRpdG9yQWN0aXZhdGlvbkV2ZW50 Ow0KaW1wb3J0
IG9yZy5lY2xpcHNlLmpmYWNlLnZpZXd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bnQg
Y291bnRlcjsNCg0KCQlwdWJsaWMgTXlNb2RlbChpbnQgY291bnRlciwgTXlN b2RlbCBwYXJl
bnQpIHsNCgkJCXRoaXMucGFyZW50ID0gcGFyZW50Ow0KCQkJdGhpcy5jb3Vu dGVyID0gY291
bnRlcjsNCgkJfQ0KDQoJCXB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7DQoJ CQlTdHJpbmcg
cnYgPSAiSXRlbSAiOw0KCQkJaWYgKHBhcmVudCAhPSBudWxsKSB7DQoJCQkJ cnYgPSBwYXJl
bnQudG9TdHJpbmcoKSArICIuIjsNCgkJCX0NCg0KCQkJcnYgKz0gY291bnRl cjsNCg0KCQkJ
cmV0dXJuIHJ2Ow0KCQl9DQoJfQ0KDQp9DQoNCg==
--------------060005070407070701010903--
Re: Customization of cell activation strategy [message #586710 is a reply to message #44085] Wed, 28 November 2007 17:13 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Andrey schrieb:
> Tom
>
> Thank you for your patience and complete answers. I appreciate you for
> all suggestions, explanations and great job!
>
> I use newsgroup before filing a bug (as warned in bugzilla) to
> understand your reason and opinion for some features and behavior. I'd
> like to create some issues only after it.
>

As said looks like a valid use case. I understand but the newsgroup has
the draw back to only Chris and me are following it but others like the
guys from Platform/UI are not. So to explain them later on where we are
coming from takes time that could have been invested better.

It's the right point to go to bugzilla now!

> So I'd like to give you a use-case.
>
>> 1. Dumb question
>> ----------------
>> Doesn't selecting multiple cells always involves pressing SHIFT or
>> CTRL so this could be the indicator for you to cancel the editor
>> activation event.
> What about mouse dragging? Moreover, please see an attached file and try
> to use following use-case for check box.
>
> 1. Mouse down on check box.
> 2. Drag mouse to other column (e.g. on 1st column)
> 3. Mouse up on other cell.
>
> Expected result: several cells are selected (from the mouseDown to the
> mouseUp cells).
>
> Actual result: no selection, check box change its state.
>
> What is your opinion about the use-case? Is it worth to create an
> enhancement?
>

Sure file a bug against Platform/UI and include the snippet, the sooner
the better because the API freeze is not far away and all decision
makers are as always swapped with a lot of work :-)

I'm currently not sure who has to handle this (Nebface/JFace) but we'll
find it out.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Previous Topic:SWT Ribbon any alpha release ?
Next Topic:GridViewer and SWT.VIRTUAL
Goto Forum:
  


Current Time: Thu Apr 18 15:43:39 GMT 2024

Powered by FUDForum. Page generated in 0.04396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top