[jboss-svn-commits] JBL Code SVN: r35978 - labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Nov 15 08:30:56 EST 2010
Author: Rikkola
Date: 2010-11-15 08:30:55 -0500 (Mon, 15 Nov 2010)
New Revision: 35978
Added:
labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GroupingsPanel.java
Modified:
labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java
Log:
BRMS-389 : Web decision table: 'Group by column' select box content doesn't update as columns are added/removed
Added: labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GroupingsPanel.java
===================================================================
--- labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GroupingsPanel.java (rev 0)
+++ labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GroupingsPanel.java 2010-11-15 13:30:55 UTC (rev 35978)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.client.decisiontable;
+
+import org.drools.guvnor.client.common.SmallLabel;
+import org.drools.guvnor.client.messages.Constants;
+import org.drools.ide.common.client.modeldriven.dt.ActionCol;
+import org.drools.ide.common.client.modeldriven.dt.AttributeCol;
+import org.drools.ide.common.client.modeldriven.dt.ConditionCol;
+import org.drools.ide.common.client.modeldriven.dt.GuidedDecisionTable;
+import org.drools.ide.common.client.modeldriven.dt.MetadataCol;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ListBox;
+
+/**
+ *
+ * @author rikkola
+ *
+ */
+public class GroupingsPanel extends HorizontalPanel {
+
+ private Constants constants = ((Constants) GWT.create( Constants.class ));
+
+ private final ListBox columnsListBox = new ListBox();
+ private final GuidedDecisionTable guidedDecisionTable;
+ private final Command refreshCommand;
+
+ public GroupingsPanel(final GuidedDecisionTable guidedDecisionTable,
+ final Command refreshCommand) {
+ this.guidedDecisionTable = guidedDecisionTable;
+ this.refreshCommand = refreshCommand;
+
+ initColumnsListBox();
+
+ add( new SmallLabel( constants.GroupByColumn() ) );
+ add( columnsListBox );
+
+ add( getOkButton() );
+ }
+
+ private void initColumnsListBox() {
+ columnsListBox.addItem( constants.Description(),
+ "desc" ); //NON-NLS
+
+ addListItems();
+
+ }
+
+ private Button getOkButton() {
+ Button ok = new Button( constants.Apply() );
+ ok.addClickHandler( new ClickHandler() {
+ public void onClick(ClickEvent w) {
+ guidedDecisionTable.groupField = columnsListBox.getValue( columnsListBox.getSelectedIndex() );
+ refreshCommand.execute();
+ }
+ } );
+ return ok;
+ }
+
+ private void addListItems() {
+ addNone();
+ addMetaDataColumns();
+ addAttributeColumns();
+ addConditionColumns();
+ addActionColumns();
+ }
+
+ private void addNone() {
+ columnsListBox.addItem( constants.none(),
+ "" );
+ columnsListBox.setSelectedIndex( 0 );
+
+ }
+
+ private void addActionColumns() {
+ for ( ActionCol c : guidedDecisionTable.actionCols ) {
+ columnsListBox.addItem( c.header,
+ c.header );
+ if ( c.header.equals( guidedDecisionTable.groupField ) ) {
+ columnsListBox.setSelectedIndex( columnsListBox.getItemCount() - 1 );
+ }
+ }
+ }
+
+ private void addConditionColumns() {
+ for ( ConditionCol c : guidedDecisionTable.conditionCols ) {
+ columnsListBox.addItem( c.header,
+ c.header );
+ if ( c.header.equals( guidedDecisionTable.groupField ) ) {
+ columnsListBox.setSelectedIndex( columnsListBox.getItemCount() - 1 );
+ }
+ }
+ }
+
+ private void addAttributeColumns() {
+ for ( AttributeCol c : guidedDecisionTable.attributeCols ) {
+ columnsListBox.addItem( c.attr,
+ c.attr );
+ if ( c.attr.equals( guidedDecisionTable.groupField ) ) {
+ columnsListBox.setSelectedIndex( columnsListBox.getItemCount() - 1 );
+ }
+ }
+ }
+
+ private void addMetaDataColumns() {
+ for ( MetadataCol c : guidedDecisionTable.getMetadataCols() ) {
+ columnsListBox.addItem( c.attr,
+ c.attr );
+ if ( c.attr.equals( guidedDecisionTable.groupField ) ) {
+ columnsListBox.setSelectedIndex( columnsListBox.getItemCount() - 1 );
+ }
+ }
+ }
+
+ public void refresh() {
+ columnsListBox.clear();
+ addListItems();
+ }
+}
Modified: labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java
===================================================================
--- labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java 2010-11-14 22:53:00 UTC (rev 35977)
+++ labs/jbossrules/soa_branches/BRMS-5.1.x/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java 2010-11-15 13:30:55 UTC (rev 35978)
@@ -112,19 +112,20 @@
implements
SaveEventListener {
- private GuidedDecisionTable dt;
- private VerticalPanel layout;
- private GridPanel grid;
- private FieldDef[] fds;
- private VerticalPanel attributeConfigWidget;
- private VerticalPanel conditionsConfigWidget;
- private String packageName;
- private VerticalPanel actionsConfigWidget;
+ private GuidedDecisionTable dt;
+ private VerticalPanel layout;
+ private GridPanel grid;
+ private FieldDef[] fds;
+ private VerticalPanel attributeConfigWidget;
+ private VerticalPanel conditionsConfigWidget;
+ private String packageName;
+ private VerticalPanel actionsConfigWidget;
private Map<String, DTColumnConfig> colMap;
- private SuggestionCompletionEngine sce;
- private GroupingStore store;
- private Constants constants = ((Constants) GWT.create( Constants.class ));
- RecordDef recordDef;
+ private SuggestionCompletionEngine sce;
+ private GroupingStore store;
+ private Constants constants = ((Constants) GWT.create( Constants.class ));
+ RecordDef recordDef;
+ private GroupingsPanel groupingsPanel = null;
public GuidedDecisionTableWidget(RuleAsset asset,
RuleViewer viewer) {
@@ -145,9 +146,7 @@
config.setBodyBorder( false );
config.setCollapsed( true );
config.setCollapsible( true );
-
-
FieldSet conditions = new FieldSet( constants.ConditionColumns() );
conditions.setCollapsible( true );
conditions.add( getConditions() );
@@ -165,70 +164,25 @@
grouping.add( getAttributes() );
config.add( grouping );
layout.add( config );
-
- VerticalPanel buttonPanel = new VerticalPanel();
- buttonPanel.add(getToolbarMenuButton());
- layout.add( buttonPanel);
-
+
+ VerticalPanel buttonPanel = new VerticalPanel();
+ buttonPanel.add( getToolbarMenuButton() );
+ layout.add( buttonPanel );
+
refreshGrid();
initWidget( layout );
}
private Widget getGrouping() {
- final ListBox list = new ListBox();
-
- list.addItem( constants.Description(),
- "desc" ); //NON-NLS
- if (dt.getMetadataCols() == null) {
- dt.setMetadataCols(new ArrayList<MetadataCol>());
- }
- for (MetadataCol c : dt.getMetadataCols()) {
- list.addItem(c.attr, c.attr);
- if (c.attr.equals(dt.groupField)) {
- list.setSelectedIndex(list.getItemCount() - 1);
- }
- }
- for (AttributeCol c : dt.attributeCols) {
- list.addItem(c.attr, c.attr);
- if (c.attr.equals(dt.groupField)) {
- list.setSelectedIndex(list.getItemCount() - 1);
- }
- }
- for (ConditionCol c : dt.conditionCols) {
- list.addItem(c.header, c.header);
- if (c.header.equals(dt.groupField)) {
- list.setSelectedIndex(list.getItemCount() - 1);
- }
- }
- for (ActionCol c : dt.actionCols) {
- list.addItem(c.header, c.header);
- if (c.header.equals(dt.groupField)) {
- list.setSelectedIndex(list.getItemCount() - 1);
- }
- }
-
- list.addItem(constants.none(), "");
- if ( dt.groupField == null ) {
- list.setSelectedIndex( list.getItemCount() - 1 );
- }
-
- HorizontalPanel h = new HorizontalPanel();
- h.add( new SmallLabel( constants.GroupByColumn() ) );
- h.add( list );
-
- Button ok = new Button( constants.Apply() );
- ok.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- dt.groupField = list.getValue( list.getSelectedIndex() );
- scrapeData( -1 );
- refreshGrid();
- }
- } );
-
- h.add( ok );
-
- return h;
+ this.groupingsPanel = new GroupingsPanel( dt,
+ new Command() {
+ public void execute() {
+ scrapeData( -1 );
+ refreshGrid();
+ }
+ } );
+ return groupingsPanel;
}
private Widget getActions() {
@@ -238,8 +192,10 @@
}
private void refreshActionsWidget() {
+
+
this.actionsConfigWidget.clear();
- for (ActionCol c : dt.actionCols) {
+ for ( ActionCol c : dt.actionCols ) {
HorizontalPanel hp = new HorizontalPanel();
hp.add( removeAction( c ) );
hp.add( editAction( c ) );
@@ -263,6 +219,7 @@
scrapeData( -1 );
refreshGrid();
refreshActionsWidget();
+ refreshGroupingsPanel();
}
},
asf,
@@ -277,6 +234,7 @@
scrapeData( -1 );
refreshGrid();
refreshActionsWidget();
+ refreshGroupingsPanel();
}
},
asf,
@@ -367,11 +325,17 @@
String cm = Format.format( constants.DeleteActionColumnWarning(),
c.header );
if ( com.google.gwt.user.client.Window.confirm( cm ) ) {
+ if ( dt.groupField != null && dt.groupField.equals( c.header ) ) {
+ dt.groupField = null;
+ }
+
dt.actionCols.remove( c );
removeField( c.header );
scrapeData( -1 );
refreshGrid();
refreshActionsWidget();
+
+ refreshGroupingsPanel();
}
}
} );
@@ -414,6 +378,7 @@
scrapeData( dt.getMetadataCols().size() + dt.attributeCols.size() + dt.conditionCols.size() + 1 );
refreshGrid();
refreshConditionsWidget();
+ refreshGroupingsPanel();
}
},
newCol,
@@ -459,10 +424,21 @@
String cm = Format.format( constants.DeleteConditionColumnWarning(),
c.header );
if ( com.google.gwt.user.client.Window.confirm( cm ) ) {
+ if ( dt.groupField != null && dt.groupField.equals( c.header ) ) {
+
+ dt.groupField = null;
+ }
+
+
dt.conditionCols.remove( c );
+
removeField( c.header );
scrapeData( -1 );
+
+
refreshGrid();
+
+
refreshConditionsWidget();
}
}
@@ -486,7 +462,7 @@
hp.add( new SmallLabel( constants.Metadata() ) );
attributeConfigWidget.add( hp );
}
- for (MetadataCol at : dt.getMetadataCols()) {
+ for ( MetadataCol at : dt.getMetadataCols() ) {
HorizontalPanel hp = new HorizontalPanel();
hp.add( new HTML( " " ) ); //NON-NLS
hp.add( removeMeta( at ) );
@@ -500,8 +476,8 @@
attributeConfigWidget.add( hp );
}
- for (AttributeCol atc : dt.attributeCols) {
- final AttributeCol at = atc;
+ for ( AttributeCol atc : dt.attributeCols ) {
+ final AttributeCol at = atc;
HorizontalPanel hp = new HorizontalPanel();
hp.add( new SmallLabel( at.attr ) );
@@ -515,28 +491,28 @@
}
} );
// GUVNOR-605
- if(at.attr.equals(RuleAttributeWidget.SALIENCE_ATTR)) {
- hp.add( new HTML( " " ) );
- final CheckBox useRowNumber = new CheckBox();
- useRowNumber.setChecked(at.useRowNumber);
- useRowNumber.addClickListener( new ClickListener() {
+ if ( at.attr.equals( RuleAttributeWidget.SALIENCE_ATTR ) ) {
+ hp.add( new HTML( " " ) );
+ final CheckBox useRowNumber = new CheckBox();
+ useRowNumber.setChecked( at.useRowNumber );
+ useRowNumber.addClickListener( new ClickListener() {
public void onClick(Widget sender) {
at.useRowNumber = useRowNumber.isChecked();
}
} );
hp.add( useRowNumber );
- hp.add( new SmallLabel( constants.UseRowNumber() ) );
- hp.add( new SmallLabel( "(" ) );
- final CheckBox reverseOrder = new CheckBox();
- reverseOrder.setChecked(at.reverseOrder);
- reverseOrder.addClickListener( new ClickListener() {
+ hp.add( new SmallLabel( constants.UseRowNumber() ) );
+ hp.add( new SmallLabel( "(" ) );
+ final CheckBox reverseOrder = new CheckBox();
+ reverseOrder.setChecked( at.reverseOrder );
+ reverseOrder.addClickListener( new ClickListener() {
public void onClick(Widget sender) {
at.reverseOrder = reverseOrder.isChecked();
}
} );
- hp.add(reverseOrder);
- hp.add( new SmallLabel( constants.ReverseOrder() ) );
- hp.add( new SmallLabel( ")" ) );
+ hp.add( reverseOrder );
+ hp.add( new SmallLabel( constants.ReverseOrder() ) );
+ hp.add( new SmallLabel( ")" ) );
}
hp.add( new HTML( " " ) ); //NON-NLS
hp.add( new SmallLabel( constants.DefaultValue() ) );
@@ -641,11 +617,16 @@
String ms = Format.format( constants.DeleteActionColumnWarning(),
at.attr );
if ( com.google.gwt.user.client.Window.confirm( ms ) ) {
+ if ( dt.groupField != null && dt.groupField.equals( at.attr ) ) {
+ dt.groupField = null;
+ }
+
dt.attributeCols.remove( at );
removeField( at.attr );
scrapeData( -1 );
refreshGrid();
refreshAttributeWidget();
+ refreshGroupingsPanel();
}
}
} );
@@ -660,12 +641,17 @@
public void onClick(Widget w) {
String ms = Format.format( constants.DeleteActionColumnWarning(),
md.attr );
- if ( com.google.gwt.user.client.Window.confirm( ms ) ) {
+ if ( com.google.gwt.user.client.Window.confirm( ms ) ) { if ( dt.groupField != null && dt.groupField.equals( md.attr ) ) {
+
+ dt.groupField = null;
+ }
+
dt.getMetadataCols().remove( md );
removeField( md.attr );
scrapeData( -1 );
refreshGrid();
refreshAttributeWidget();
+ refreshGroupingsPanel();
}
}
} );
@@ -723,13 +709,20 @@
}
this.fds = fds_;
+ refreshGroupingsPanel();
+
}
private void refreshGrid() {
+
if ( layout.getWidgetCount() > 2 ) {
layout.remove( 2 );
}
+
+
if ( dt.actionCols.size() == 0 && dt.conditionCols.size() == 0 && dt.actionCols.size() == 0 ) {
+
+
VerticalPanel vp = new VerticalPanel();
vp.setWidth( "100%" );
PrettyFormLayout pfl = new PrettyFormLayout();
@@ -743,6 +736,8 @@
layout.add( vp );
} else {
+
+
grid = doGrid();
layout.add( grid );
}
@@ -809,7 +804,8 @@
}
};
- colMap.put( attr.attr, attr );
+ colMap.put( attr.attr,
+ attr );
colCount++;
}
@@ -864,28 +860,28 @@
//the split thing
//The separator column causes confusion, see GUVNOR-498. Remove this column for now until
//we find a better way to represent a column for the purpose of separator.
-/* cols[colCount] = new ColumnConfig() {
- {
- setDataIndex( "x" );
- setHeader( "x" );
- //setFixed(true);
- setSortable( false );
- setResizable( false );
- //setWidth(60);
- setRenderer( new Renderer() {
- public String render(Object value,
- CellMetadata cellMetadata,
- Record record,
- int rowIndex,
- int colNum,
- Store store) {
- return "<image src='images/production.gif'/>"; //NON-NLS
+ /* cols[colCount] = new ColumnConfig() {
+ {
+ setDataIndex( "x" );
+ setHeader( "x" );
+ //setFixed(true);
+ setSortable( false );
+ setResizable( false );
+ //setWidth(60);
+ setRenderer( new Renderer() {
+ public String render(Object value,
+ CellMetadata cellMetadata,
+ Record record,
+ int rowIndex,
+ int colNum,
+ Store store) {
+ return "<image src='images/production.gif'/>"; //NON-NLS
+ }
+ } );
+ setWidth( 20 );
}
- } );
- setWidth( 20 );
- }
- };
- colCount++;*/
+ };
+ colCount++;*/
for ( int i = 0; i < dt.actionCols.size(); i++ ) {
//here we could also deal with numeric type?
@@ -922,19 +918,21 @@
store.setDataProxy( proxy );
store.setSortInfo( new SortState( "num",
SortDir.ASC ) ); //NON-NLS
+
if ( this.dt.groupField != null ) {
store.setGroupField( dt.groupField );
}
- cm.addListener(new ColumnModelListenerAdapter(){
- public void onHiddenChange(ColumnModel cm, int colIndex,
- boolean hidden) {
- final String dta = cm.getDataIndex(colIndex);
- if (colMap.containsKey(dta)) {
- DTColumnConfig col = colMap.get(dta);
- col.hideColumn = hidden;
- }
- }
- });
+ cm.addListener( new ColumnModelListenerAdapter() {
+ public void onHiddenChange(ColumnModel cm,
+ int colIndex,
+ boolean hidden) {
+ final String dta = cm.getDataIndex( colIndex );
+ if ( colMap.containsKey( dta ) ) {
+ DTColumnConfig col = colMap.get( dta );
+ col.hideColumn = hidden;
+ }
+ }
+ } );
store.load();
@@ -1052,9 +1050,9 @@
r.set( "num",
store.getRecords().length + 1 ); //NON-NLS
- store.add( r );
+ store.add( r );
// GUVNOR-605
- renumberSalience(store.getRecords());
+ renumberSalience( store.getRecords() );
}
} ) );
@@ -1086,14 +1084,14 @@
num + 1 ); //NON-NLS
}
}
- // GUVNOR-605
- renumberSalience(store.getRecords());
+ // GUVNOR-605
+ renumberSalience( store.getRecords() );
} else {
ErrorPopup.showMessage( constants.PleaseSelectARow() );
}
}
} ) );
-
+
menu.addItem( new Item( constants.RemoveSelectedRowS(),
new BaseItemListenerAdapter() {
public void onClick(BaseItem item,
@@ -1105,7 +1103,7 @@
}
renumber( store.getRecords() );
// GUVNOR-605
- renumberSalience(store.getRecords());
+ renumberSalience( store.getRecords() );
}
}
} ) );
@@ -1125,7 +1123,7 @@
}
renumber( store.getRecords() );
// GUVNOR-605
- renumberSalience(store.getRecords());
+ renumberSalience( store.getRecords() );
}
} ) );
@@ -1189,11 +1187,12 @@
// menu.addItem( new com.gwtext.client.widgets.menu.MenuItem( "Move",
// subMenu ) );
- ToolbarMenuButton tbb = new ToolbarMenuButton(constants.Modify(), menu);
+ ToolbarMenuButton tbb = new ToolbarMenuButton( constants.Modify(),
+ menu );
- return tbb;
+ return tbb;
}
-
+
/**
* Show a drop down editor, obviously.
*/
@@ -1267,26 +1266,28 @@
"" + (i + 1) ); //NON-NLS
}
}
-
+
// GUVNOR-605
private void renumberSalience(Record[] rs) {
- List<AttributeCol> attcols = dt.attributeCols;
- for(AttributeCol ac : attcols) {
- if(ac.useRowNumber) {
- for(int i=0; i<rs.length;i++) {
- Record nextrecord = rs[i];
- List<String> allFields = Arrays.asList(nextrecord.getFields());
- if(allFields.contains("salience")) {
- if(ac.reverseOrder) {
- rs[i].set( "salience", "" + (rs.length - i) ); //NON-NLS
- } else {
- rs[i].set( "salience", "" + (i + 1) ); //NON-NLS
- }
- }
- }
- }
- break;
- }
+ List<AttributeCol> attcols = dt.attributeCols;
+ for ( AttributeCol ac : attcols ) {
+ if ( ac.useRowNumber ) {
+ for ( int i = 0; i < rs.length; i++ ) {
+ Record nextrecord = rs[i];
+ List<String> allFields = Arrays.asList( nextrecord.getFields() );
+ if ( allFields.contains( "salience" ) ) {
+ if ( ac.reverseOrder ) {
+ rs[i].set( "salience",
+ "" + (rs.length - i) ); //NON-NLS
+ } else {
+ rs[i].set( "salience",
+ "" + (i + 1) ); //NON-NLS
+ }
+ }
+ }
+ }
+ break;
+ }
}
/**
@@ -1303,75 +1304,82 @@
w.setPlain( true );
w.setBodyBorder( false );
w.setTitle( dta );
-
- String typeDescription = dt.getType(colConf, getSCE());
+
+ String typeDescription = dt.getType( colConf,
+ getSCE() );
Panel p = new Panel();
- if (typeDescription != null
- && typeDescription.equals(SuggestionCompletionEngine.TYPE_DATE)) {
- final DatePickerTextBox datePicker = new DatePickerTextBox(val);
- String m = Format.format(((Constants) GWT.create(Constants.class))
- .ValueFor0(), dta);
- datePicker.setTitle(m);
- datePicker.addValueChanged(new ValueChanged() {
- public void valueChanged(String newValue) {
- r.set(dta, newValue);
- }
- });
+ if ( typeDescription != null && typeDescription.equals( SuggestionCompletionEngine.TYPE_DATE ) ) {
+ final DatePickerTextBox datePicker = new DatePickerTextBox( val );
+ String m = Format.format( ((Constants) GWT.create( Constants.class )).ValueFor0(),
+ dta );
+ datePicker.setTitle( m );
+ datePicker.addValueChanged( new ValueChanged() {
+ public void valueChanged(String newValue) {
+ r.set( dta,
+ newValue );
+ }
+ } );
- p.add(datePicker);
- p.add(new InfoPopup(constants.CategoryParentRules(), Format.format(
- constants.FillInColumnWithValue(), typeDescription)));
+ p.add( datePicker );
+ p.add( new InfoPopup( constants.CategoryParentRules(),
+ Format.format( constants.FillInColumnWithValue(),
+ typeDescription ) ) );
- w.add(p);
- w.setBorder(false);
+ w.add( p );
+ w.setBorder( false );
- Button ok = new Button(constants.OK());
- ok.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent arg0) {
- r.set(dta, datePicker.getDateString());
- w.destroy();
- }
- });
+ Button ok = new Button( constants.OK() );
+ ok.addClickHandler( new ClickHandler() {
+ public void onClick(ClickEvent arg0) {
+ r.set( dta,
+ datePicker.getDateString() );
+ w.destroy();
+ }
+ } );
- p.add(ok);
-
- } else {
- final TextBox box = new TextBox();
- box.setText(val);
- box.addKeyboardListener(new KeyboardListenerAdapter() {
- public void onKeyUp(Widget sender, char keyCode, int modifiers) {
- if (keyCode == KeyboardListener.KEY_ENTER) {
- r.set(dta, box.getText());
- w.destroy();
- }
- }
- });
+ p.add( ok );
- if (dt.isNumeric(colConf, getSCE())) {
- box.addKeyboardListener(ActionValueEditor
- .getNumericFilter(box));
- }
+ } else {
+ final TextBox box = new TextBox();
+ box.setText( val );
+ box.addKeyboardListener( new KeyboardListenerAdapter() {
+ public void onKeyUp(Widget sender,
+ char keyCode,
+ int modifiers) {
+ if ( keyCode == KeyboardListener.KEY_ENTER ) {
+ r.set( dta,
+ box.getText() );
+ w.destroy();
+ }
+ }
+ } );
- p.add(box);
- if (typeDescription != null) {
- p.add(new InfoPopup(constants.CategoryParentRules(), Format
- .format(constants.FillInColumnWithValue(),
- typeDescription)));
- }
- w.add(p);
- w.setBorder(false);
+ if ( dt.isNumeric( colConf,
+ getSCE() ) ) {
+ box.addKeyboardListener( ActionValueEditor.getNumericFilter( box ) );
+ }
- Button ok = new Button(constants.OK());
- ok.addClickListener(new ClickListener() {
- public void onClick(Widget wg) {
- r.set(dta, box.getText());
- w.destroy();
- }
- });
- p.add(ok);
- }
+ p.add( box );
+ if ( typeDescription != null ) {
+ p.add( new InfoPopup( constants.CategoryParentRules(),
+ Format.format( constants.FillInColumnWithValue(),
+ typeDescription ) ) );
+ }
+ w.add( p );
+ w.setBorder( false );
+ Button ok = new Button( constants.OK() );
+ ok.addClickListener( new ClickListener() {
+ public void onClick(Widget wg) {
+ r.set( dta,
+ box.getText() );
+ w.destroy();
+ }
+ } );
+ p.add( ok );
+ }
+
w.setPosition( e.getPageX(),
e.getPageY() );
w.show();
@@ -1393,15 +1401,24 @@
}
- private void changeRowPositions(Record from, Record to) {
- int fromNum = from.getAsInteger("num");
- int toNum = to.getAsInteger("num");
- from.set("num", toNum);
- to.set("num", fromNum);
+ private void refreshGroupingsPanel() {
+ if ( groupingsPanel != null ) {
+ groupingsPanel.refresh();
+ }
+ }
- scrapeData(-1);
+ private void changeRowPositions(Record from,
+ Record to) {
+ int fromNum = from.getAsInteger( "num" );
+ int toNum = to.getAsInteger( "num" );
+ from.set( "num",
+ toNum );
+ to.set( "num",
+ fromNum );
- refreshGrid();
- }
+ scrapeData( -1 );
+ refreshGrid();
+ }
+
}
More information about the jboss-svn-commits
mailing list