|
@@ -1,48 +1,48 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.taskbar.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.commands.*; |
5 |
|
- |
import org.litesoft.GWT.client.widgets.*; |
6 |
|
- |
import org.litesoft.core.simpletypes.*; |
7 |
|
- |
|
8 |
|
- |
import com.google.gwt.user.client.*; |
9 |
|
- |
import com.google.gwt.user.client.ui.*; |
10 |
|
- |
|
11 |
|
- |
public class AbstractGridIconCommandContextPopup extends AbstractContextPopup { |
12 |
|
- |
private PointToCommandMap mCommands = new PointToCommandMap(); |
13 |
|
- |
protected Grid mGrid; |
14 |
|
- |
|
15 |
|
- |
public AbstractGridIconCommandContextPopup( boolean pAutoHide, int pRows, int pColumns ) { |
16 |
|
- |
super( pAutoHide ); |
17 |
|
- |
|
18 |
|
- |
mGrid = new TightGrid( pRows, pColumns ); |
19 |
|
- |
|
20 |
|
- |
mGrid.addTableListener( new TableListener() { |
21 |
|
- |
public void onCellClicked( SourcesTableEvents sender, int row, int cell ) { |
22 |
|
- |
Command zCommand = mCommands.get( new PointXY( cell, row ) ); |
23 |
|
- |
if ( zCommand != null ) { |
24 |
|
- |
DeferredCommand.addCommand( zCommand ); |
25 |
|
- |
hide(); |
26 |
|
- |
} |
27 |
|
- |
} |
28 |
|
- |
} ); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
protected Widget createPopupWidget() { |
32 |
|
- |
return mGrid; |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
protected void addIconCommand( int pRow, int pColumn, CssBackgroundCommand pCommand ) { |
36 |
|
- |
|
37 |
|
- |
BGImageButton zButton = null; // todo: translate: new BGImageButton( pCommand.getCssBaseClassname(), pCommand.getTooltip() ); |
38 |
|
- |
if ( pCommand.isEnabled() ) { |
39 |
|
- |
mCommands.put( new PointXY( pColumn, pRow ), pCommand ); |
40 |
|
- |
} else { |
41 |
|
- |
zButton.setEnabled( false ); |
42 |
|
- |
} |
43 |
|
- |
|
44 |
|
- |
mGrid.setWidget( pRow, pColumn, zButton ); |
45 |
|
- |
|
46 |
|
- |
mGrid.getCellFormatter().setHorizontalAlignment( pRow, pColumn, HasHorizontalAlignment.ALIGN_CENTER ); |
47 |
|
- |
} |
48 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.taskbar.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.commands.*; |
|
5 |
+ |
import org.litesoft.GWT.client.widgets.*; |
|
6 |
+ |
import org.litesoft.core.simpletypes.*; |
|
7 |
+ |
|
|
8 |
+ |
import com.google.gwt.user.client.*; |
|
9 |
+ |
import com.google.gwt.user.client.ui.*; |
|
10 |
+ |
|
|
11 |
+ |
public class AbstractGridIconCommandContextPopup extends AbstractContextPopup { |
|
12 |
+ |
private PointToCommandMap mCommands = new PointToCommandMap(); |
|
13 |
+ |
protected Grid mGrid; |
|
14 |
+ |
|
|
15 |
+ |
public AbstractGridIconCommandContextPopup( boolean pAutoHide, int pRows, int pColumns ) { |
|
16 |
+ |
super( pAutoHide ); |
|
17 |
+ |
|
|
18 |
+ |
mGrid = new TightGrid( pRows, pColumns ); |
|
19 |
+ |
|
|
20 |
+ |
mGrid.addTableListener( new TableListener() { |
|
21 |
+ |
public void onCellClicked( SourcesTableEvents sender, int row, int cell ) { |
|
22 |
+ |
Command zCommand = mCommands.get( new PointXY( cell, row ) ); |
|
23 |
+ |
if ( zCommand != null ) { |
|
24 |
+ |
DeferredCommand.addCommand( zCommand ); |
|
25 |
+ |
hide(); |
|
26 |
+ |
} |
|
27 |
+ |
} |
|
28 |
+ |
} ); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
protected Widget createPopupWidget() { |
|
32 |
+ |
return mGrid; |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
protected void addIconCommand( int pRow, int pColumn, CssBackgroundCommand pCommand ) { |
|
36 |
+ |
|
|
37 |
+ |
BGImageButton zButton = null; // todo: translate: new BGImageButton( pCommand.getCssBaseClassname(), pCommand.getTooltip() ); |
|
38 |
+ |
if ( pCommand.isEnabled() ) { |
|
39 |
+ |
mCommands.put( new PointXY( pColumn, pRow ), pCommand ); |
|
40 |
+ |
} else { |
|
41 |
+ |
zButton.setEnabled( false ); |
|
42 |
+ |
} |
|
43 |
+ |
|
|
44 |
+ |
mGrid.setWidget( pRow, pColumn, zButton ); |
|
45 |
+ |
|
|
46 |
+ |
mGrid.getCellFormatter().setHorizontalAlignment( pRow, pColumn, HasHorizontalAlignment.ALIGN_CENTER ); |
|
47 |
+ |
} |
|
48 |
+ |
} |