[jboss-svn-commits] JBL Code SVN: r19031 - in labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms: client/decisiontable and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 17 02:54:35 EDT 2008
Author: michael.neale at jboss.com
Date: 2008-03-17 02:54:34 -0400 (Mon, 17 Mar 2008)
New Revision: 19031
Added:
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java
Removed:
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java
Modified:
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java
Log:
JBRULES-1494 Decision table - and removing old version that is not needed
Modified: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -105,27 +105,27 @@
GuidedDecisionTable dt = new GuidedDecisionTable();
- dt.data = new String[][] {
- new String[] {"1", "des1","", "a", "b", "c"},
- new String[] {"2", "des1","" , "d", "e", "f"},
- new String[] {"3", "des3", "groupA", "d", "q", "x"}
- };
- ConditionCol c1 = new ConditionCol();
- c1.header = "Driver 1 age";
+// dt.data = new String[][] {
+// new String[] {"1", "des1","", "a", "b", "c"},
+// new String[] {"2", "des1","" , "d", "e", "f"},
+// new String[] {"3", "des3", "groupA", "d", "q", "x"}
+// };
+// ConditionCol c1 = new ConditionCol();
+// c1.header = "Driver 1 age";
+//
+// dt.conditionCols.add(c1);
+// ConditionCol c2 = new ConditionCol();
+// c2.header = "Driver 2 age";
+// dt.conditionCols.add(c2);
+//
+// AttributeCol attr = new AttributeCol();
+// attr.attr = "rule-flow";
+// dt.attributeCols.add(attr);
+//
+// ActionCol a1 = new ActionSetFieldCol();
+// a1.header = "Do something !";
+// dt.actionCols.add(a1);
- dt.conditionCols.add(c1);
- ConditionCol c2 = new ConditionCol();
- c2.header = "Driver 2 age";
- dt.conditionCols.add(c2);
-
- AttributeCol attr = new AttributeCol();
- attr.attr = "rule-flow";
- dt.attributeCols.add(attr);
-
- ActionCol a1 = new ActionSetFieldCol();
- a1.header = "Do something !";
- dt.actionCols.add(a1);
-
SuggestionCompletionCache.getInstance().doAction("com.billasurf.manufacturing.plant", new Command() {
public void execute() {
System.err.println("loaded SCE");
Added: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java (rev 0)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -0,0 +1,186 @@
+package org.drools.brms.client.decisiontable;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.drools.brms.client.common.FormStylePopup;
+import org.drools.brms.client.common.ImageButton;
+import org.drools.brms.client.common.SmallLabel;
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.ConditionCol;
+import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public class ActionSetColumn extends FormStylePopup {
+
+ private ActionSetFieldCol editingCol;
+ private SmallLabel bindingLabel = new SmallLabel();
+ private SmallLabel fieldLabel = new SmallLabel();
+ private GuidedDecisionTable dt;
+ private SuggestionCompletionEngine sce;
+
+ public ActionSetColumn(SuggestionCompletionEngine sce, final GuidedDecisionTable dt, final Command refreshGrid, final ActionSetFieldCol col, final boolean isNew) {
+ this.editingCol = new ActionSetFieldCol();
+ this.dt = dt;
+ this.sce = sce;
+
+ editingCol.boundName = col.boundName;
+ editingCol.factField = col.factField;
+ editingCol.header = col.header;
+ editingCol.type = col.type;
+ super.setModal(false);
+ setTitle("Column configuration (set a field on a fact)");
+
+ final TextBox header = new TextBox();
+ header.setText(col.header);
+ header.addChangeListener(new ChangeListener() {
+ public void onChange(Widget w) {
+ editingCol.header = header.getText();
+ } });
+ addAttribute("Column header (description):", header);
+
+ HorizontalPanel pattern = new HorizontalPanel();
+ pattern.add(bindingLabel);
+ doBindingLabel();
+
+ Image changePattern = new ImageButton("images/edit.gif", "Choose a bound fact that this column pertains to", new ClickListener() {
+ public void onClick(Widget w) {
+ showChangeFact(w);
+ }
+ });
+ pattern.add(changePattern);
+ addAttribute("Fact:", pattern);
+
+
+ HorizontalPanel field = new HorizontalPanel();
+ field.add(fieldLabel);
+ Image editField = new ImageButton("images/edit.gif", "Edit the field that this column operates on", new ClickListener() {
+ public void onClick(Widget w) {
+ showFieldChange();
+ }
+ });
+ field.add(editField);
+ addAttribute("Field:", field);
+ doFieldLabel();
+
+ Button apply = new Button("Apply changes");
+ apply.addClickListener(new ClickListener() {
+ public void onClick(Widget w) {
+ if (isNew) {
+ dt.actionCols.add(editingCol);
+
+ } else {
+ col.boundName = editingCol.boundName;
+ col.factField = editingCol.factField;
+ col.header = editingCol.header;
+ col.type = editingCol.type;
+ }
+ refreshGrid.execute();
+ hide();
+
+ }
+ });
+ addAttribute("", apply);
+
+
+ }
+
+ private void showFieldChange() {
+ final FormStylePopup pop = new FormStylePopup();
+ pop.setModal(false);
+ final String factType = getFactType(this.editingCol.boundName);
+ String[] fields = this.sce.getFieldCompletions(factType);
+ final ListBox box = new ListBox();
+ for (int i = 0; i < fields.length; i++) {
+ box.addItem(fields[i]);
+ }
+ pop.addAttribute("Field:", box);
+ Button b = new Button("OK");
+ pop.addAttribute("", b);
+ b.addClickListener(new ClickListener() {
+ public void onClick(Widget w) {
+ editingCol.factField = box.getItemText(box.getSelectedIndex());
+ editingCol.type = sce.getFieldType(factType, editingCol.factField);
+ doFieldLabel();
+ pop.hide();
+ }
+ });
+ pop.show();
+
+ }
+
+ private void doFieldLabel() {
+ if (this.editingCol.factField != null) {
+ this.fieldLabel.setText(this.editingCol.factField);
+ } else {
+ this.fieldLabel.setText("(please choose a fact pattern first)");
+ }
+ }
+
+ private String getFactType(String boundName) {
+ for (Iterator iterator = dt.conditionCols.iterator(); iterator.hasNext();) {
+ ConditionCol col = (ConditionCol) iterator.next();
+ if (col.boundName.equals(boundName)) {
+ return col.factType;
+ }
+ }
+ return "";
+ }
+
+ private void showChangeFact(Widget w) {
+ final FormStylePopup pop = new FormStylePopup();
+
+ final ListBox pats = this.loadBoundFacts();
+ pop.addAttribute("Choose fact to set field of:", pats);
+ Button ok = new Button("OK");
+ pop.addAttribute("", ok);
+
+ ok.addClickListener(new ClickListener() {
+ public void onClick(Widget w) {
+ String val = pats.getValue(pats.getSelectedIndex());
+ editingCol.boundName = val;
+ doBindingLabel();
+ pop.hide();
+ }
+ });
+
+ pop.show();
+
+ }
+
+ private ListBox loadBoundFacts() {
+ Set facts = new HashSet();
+ for (int i = 0; i < this.dt.conditionCols.size(); i++) {
+ ConditionCol c = (ConditionCol) dt.conditionCols.get(i);
+ facts.add(c.boundName);
+ }
+
+ ListBox box = new ListBox();
+ for (Iterator iterator = facts.iterator(); iterator.hasNext();) {
+ String b = (String) iterator.next();
+ box.addItem(b);
+ }
+
+ return box;
+ }
+
+ private void doBindingLabel() {
+ if (this.editingCol.boundName != null) {
+ this.bindingLabel.setText("" + this.editingCol.boundName);
+ } else {
+ this.bindingLabel.setText("(please choose a bound fact for this column)");
+ }
+ }
+
+}
Property changes on: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,70 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for deleting a row.
- * @author Steven Williams
- */
-public class DeleteAction extends Composite {
-
- private HorizontalPanel panel = new HorizontalPanel();
- private Image delete;
- private int row;
-
-
-
-
- /**
- * Pass in the click listener delegate for when the respective action is clicked
- * @param clickListener
- * @param okClickListener
- */
- public DeleteAction(final int currentRow, final RowClickListener clickListener) {
- row = currentRow;
- delete = new Image("images/clear_item.gif");
- delete.setTitle( "Delete row " + row );
- delete.addClickListener( new ClickListener() {
- public void onClick(final Widget w) {
- clickListener.onClick(w, row);
- }
- });
-
- panel.add( delete);
-
- initWidget( panel );
- }
-
- public void setRow(final int row) {
- this.row = row;
- delete.setTitle("Delete row " + row);
- }
-
- public int getRow() {
- return row;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,101 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widgets for editing a row.
- * @author Michael Neale
- */
-public class EditActions extends Composite {
-
- private HorizontalPanel panel = new HorizontalPanel();
- private Image edit;
- private Image ok;
- private int row;
-
-
-
-
- /**
- * Pass in the click listener delegates for when the respective action is clicked
- * @param editClickListener
- * @param okClickListener
- */
- public EditActions(final int currentRow,
- final RowClickListener editClickListener,
- final RowClickListener okClickListener) {
- row = currentRow;
- edit = new Image("images/edit.gif");
- edit.setTitle( "Edit this row" );
- edit.addClickListener( new ClickListener() {
-
- public void onClick(Widget w) {
- makeEditable();
- editClickListener.onClick( w, row );
- }
-
- });
-
- ok = new Image("images/tick.gif");
- ok.setTitle( "Apply the edit changes to this row." );
- ok.addClickListener( new ClickListener() {
-
- public void onClick(Widget w) {
- makeReadOnly();
- okClickListener.onClick( w, row );
- }
-
- });
-
- panel.add( edit );
- panel.add( ok );
- ok.setVisible( false );
-
- initWidget( panel );
- }
-
- public void makeEditable() {
- edit.setVisible( false );
- ok.setVisible( true );
-
- }
-
- public void makeReadOnly() {
- edit.setVisible( true );
- ok.setVisible( false );
- }
-
- public int getRow() {
- return row;
- }
-
- public void setRow(int row) {
- this.row = row;
- }
-
-
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,470 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import java.util.Iterator;
-
-import org.drools.brms.client.decisiontable.model.Cell;
-import org.drools.brms.client.decisiontable.model.Column;
-import org.drools.brms.client.decisiontable.model.DecisionTable;
-import org.drools.brms.client.decisiontable.model.Row;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.SourcesTableEvents;
-import com.google.gwt.user.client.ui.TableListener;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-
-/**
- * The decision table viewer and editor.
- *
- * @author Michael Neale
- * @author Steven Williams
- *
- * TODO: add editors for header stuff, and ability to add rows/cols and shift
- * rows around This probably can be done from a seperate "editor" such that it
- * is re-rendered when you need to add/move a col or row.
- *
- * Should be able to add/shift stuff around by entering a row number to deal
- * with.
- *
- */
-public class EditableDTGrid extends Composite {
-
- private static final int START_DATA_ROW = 1;
-
- private DecisionTable dt;
-
- private FlexTable table = new FlexTable();
-
- private int currentRow;
-
- private int currentCol;
-
- private Cell currentCell;
-
- private FlexCellFormatter cellFormatter = table.getFlexCellFormatter();
-
- public EditableDTGrid(String dtName) {
- this(dtName, createDecisionTable());
- }
-
- private static DecisionTable createDecisionTable() {
- DecisionTable dt = new DecisionTable();
- Column[] columns = { dt.createColumn(), dt.createColumn(),
- dt.createColumn(), dt.createColumn(), dt.createColumn(),
- dt.createColumn() };
- createHeader(dt, columns);
- for (int i = 0; i < 15; i++) {
- Row row = dt.createRow();
- for (int j = 0; j < columns.length; j++) {
- Cell cell = dt.createCell(row, columns[j]);
- cell.setValue("boo " + i + ":" + j);
- }
- }
- return dt;
- }
-
- private static void createHeader(DecisionTable dt, Column[] columns) {
- Row row = dt.getHeaderRow();
- for (int i = 0; i < 6; i++) {
- Cell cell = dt.createCell(row, columns[i]);
- cell.setValue("some header " + i);
- }
- }
-
- public EditableDTGrid(final String dtName, final DecisionTable dt) {
- this.dt = dt;
- VerticalPanel vert = new VerticalPanel();
-
- Label title = new Label(dtName);
- title.setStyleName("dt-editor-Title");
-
- HorizontalPanel header = new HorizontalPanel();
- header.add(new Image("images/decision_table.gif"));
- header.add(title);
-
- Toolbar toolbar = new Toolbar(this);
-
- vert.add(header);
- vert.add(toolbar);
- vert.add(table);
-
- table.setStyleName("dt-editor-Grid");
- table.addTableListener(new TableListener() {
-
- public void onCellClicked(SourcesTableEvents ste, int row, int col) {
- setCurrentCell(row, col);
- }
- });
-
- // set up the header
- populateHeader();
-
- // and the data follows
- populateDataGrid();
-
- // needed for Composite
- initWidget(vert);
- }
-
- protected void setCurrentCell(int row, int column) {
- if (column > 0 && column <= numCols() && row >= START_DATA_ROW) {
- Cell selectedCell = dt.getRow(row - 1).getCell(column - 1);
- if (selectedCell != currentCell) {
- int col = selectedCell.getColumnIndex() + 1;
-
- if (currentRow >= START_DATA_ROW) {
- TextBox text = (TextBox) table.getWidget(currentRow,
- currentCol);
- newCell(currentRow, currentCol, text.getText());
- }
- if (currentCell == null || currentRow != row) {
- if (currentCell != null) {
- cellFormatter.setStyleName(currentRow, 0,
- "dt-editor-CountColumn");
- }
- cellFormatter.setStyleName(row, 0,
- "dt-editor-CountColumn-selected");
- }
- if (currentCell == null || (currentCell.getColumnIndex() + 1) != col) {
- if (currentCell != null) {
- cellFormatter.setStyleName(0, currentCell
- .getColumnIndex() + 1,
- "dt-editor-DescriptionCell");
- }
- cellFormatter.setStyleName(0, col,
- "dt-editor-DescriptionCell-selected");
- }
- cellFormatter.setStyleName(row, column,
- "dt-editor-Cell-selected");
- currentRow = row;
- currentCol = column;
- currentCell = selectedCell;
- editColumn(row, column);
- }
- }
- }
-
- private void populateHeader() {
- Row row = dt.getHeaderRow();
- // for the count column
- cellFormatter.setStyleName(0, 0, "dt-editor-DescriptionCell");
-
- table.setText(0, 0, "");
- cellFormatter.setStyleName(0, 0, "dt-editor-CountColumn");
-
- for (Iterator it = dt.getColumns().iterator(); it.hasNext();) {
- Column column = (Column) it.next();
- newHeaderCell(row.getCell(column));
- }
-
- }
-
- /**
- * This populates the "data" part of the decision table (not the header
- * bits). It starts at the row offset.
- *
- * @param cellFormatter
- * So it can set the style of each cell that is created.
- */
- private void populateDataGrid() {
- int i = 1;
- for (Iterator it = dt.getRows().iterator(); it.hasNext(); i++) {
- Row row = (Row) it.next();
- table.setText(i, 0, Integer.toString(i));
- cellFormatter.setStyleName(i, 0, "dt-editor-CountColumn");
- for (Iterator it2 = dt.getColumns().iterator(); it2.hasNext();) {
- Column column = (Column) it2.next();
- newCell(row.getCell(column));
- }
-
- }
- }
-
- private void newCell(Cell cell) {
- int rowIndex = cell.getRowIndex() + START_DATA_ROW;
- int columnIndex = cell.getColumnIndex() + 1;
- newCell(cell, rowIndex, columnIndex, "dt-editor-Cell");
- }
-
- private void newHeaderCell(Cell cell) {
- int columnIndex = cell.getColumnIndex() + 1;
- newCell(cell, 0, columnIndex, "dt-editor-DescriptionCell");
- }
-
- private void newCell(Cell cell, int rowIndex, int columnIndex, String style) {
- table.setText(rowIndex, columnIndex, cell.getValue());
- cellFormatter.setStyleName(rowIndex, columnIndex, style);
- cellFormatter.setColSpan(rowIndex, columnIndex, cell.getColspan());
- cellFormatter.setRowSpan(rowIndex, columnIndex, cell.getRowspan());
- }
-
- private void newCell(int row, int column, String text) {
- table.setText(row, column, text);
- cellFormatter.setStyleName(row, column, "dt-editor-Cell");
- }
-
- public void mergeCol() {
- if (currentCell != null) {
- dt.mergeCol(currentCell);
- // if (currentRow >= START_DATA_ROW && currentCol > 0) {
- int currentSpan = cellFormatter.getColSpan(currentRow, currentCol);
- if (currentCol + currentSpan <= numCols()) {
- int nextSpan = cellFormatter.getColSpan(currentRow,
- currentCol + 1);
- int currentRowSpan = cellFormatter.getRowSpan(currentRow,
- currentCol);
- int nextRowSpan = cellFormatter.getRowSpan(currentRow,
- currentCol + 1);
- while (nextRowSpan < currentRowSpan) {
- mergeRow(currentRow, currentCol + 1);
- nextRowSpan++;
- }
- table.removeCell(currentRow, currentCol + 1);
- cellFormatter.setColSpan(currentRow, currentCol, currentSpan
- + nextSpan);
- }
- }
- }
-
- public void mergeRow() {
- if (currentCell != null) {
- // if (currentRow >= START_DATA_ROW && currentCol > 0) {
- mergeRow(currentRow, currentCol);
- }
- }
-
- private void mergeRow(int row, int col) {
- dt.mergeRow(currentCell);
- int currentSpan = cellFormatter.getRowSpan(row, col);
- if (row + currentSpan <= numRows) {
- int nextSpan = cellFormatter.getRowSpan(row + currentSpan, col);
- table.removeCell(row + currentSpan, col);
- cellFormatter.setRowSpan(row, col, currentSpan + nextSpan);
- }
- }
-
- public void splitCol() {
- if (currentRow >= START_DATA_ROW && currentCol > 0) {
- int currentSpan = cellFormatter.getColSpan(currentRow, currentCol);
- if (currentSpan > 1) {
- cellFormatter.setColSpan(currentRow, currentCol,
- currentSpan - 1);
- int newCol = currentCol + 1;
- table.insertCell(currentRow, newCol);
- newCell(currentRow, newCol, "");
- cellFormatter
- .setStyleName(currentRow, newCol, "dt-editor-Cell");
- }
- }
- }
-
- public void splitRow() {
- if (currentRow >= START_DATA_ROW && currentCol > 0) {
- int currentSpan = cellFormatter.getRowSpan(currentRow, currentCol);
- if (currentSpan > 1) {
- cellFormatter.setRowSpan(currentRow, currentCol,
- currentSpan - 1);
- int newRow = currentRow + currentSpan - 1;
- table.insertCell(newRow, currentCol);
- newCell(newRow, currentCol, "");
- cellFormatter
- .setStyleName(newRow, currentCol, "dt-editor-Cell");
- }
- }
- }
-
- /**
- * Listener for click events that affect a whole row
- */
- interface RowClickListener {
- void onClick(Widget w, int row);
- }
-
- private int numRows = 14;
-
- /**
- * Shuffle the given row up one
- *
- * @param row
- */
- void moveUp() {
- if (currentRow > START_DATA_ROW) {
- // create a new row above the given row
- // remember that insertRow will insert above the given row
- // so this is two above the original row
- int newRow = addNewRow(currentRow - 1);
-
- copyRow(currentRow + 1, newRow);
-
- // remove the original row
- table.removeRow(currentRow + 1);
-
- renumberRow(currentRow);
- currentRow = -1;
- setCurrentCell(newRow, currentCol);
- }
-
- }
-
- /**
- * Copy the data from the source row to the target row
- *
- * @param sourceRow
- * @param targetRow
- */
- private void copyRow(int sourceRow, int targetRow) {
- int column = 1;
- int colIndex = 1;
- while (column <= numCols()) {
- if (column == currentCol) {
- TextBox box = (TextBox) table.getWidget(sourceRow, column);
- newCell(targetRow, colIndex, box.getText());
- } else {
- newCell(targetRow, colIndex, table.getText(sourceRow, colIndex));
- }
- int colSpan = cellFormatter.getColSpan(sourceRow, colIndex);
- column = column + colSpan;
- cellFormatter.setColSpan(targetRow, colIndex++, colSpan);
- }
- }
-
- /**
- * Add a new row and set the row number
- *
- * @param row
- * @return
- */
- private int addNewRow(int row) {
- int newRow = table.insertRow(row);
- table.setText(newRow, 0, Integer.toString(newRow));
- cellFormatter.setStyleName(newRow, 0, "dt-editor-CountColumn");
- return newRow;
- }
-
- /**
- * Shuffle the given row down one
- *
- * @param row
- */
- void moveDown() {
- if (currentRow < numRows) {
- // create a new row below the given row
- // remember that insertRow will insert above the given row
- // so this is two below the original row
- int newRow = addNewRow(currentRow + 2);
-
- copyRow(currentRow, newRow);
- // remove row before adding action widgets so that the row number
- // is correct (otherwise the shuffle down button may not be
- // displayed
- table.removeRow(currentRow);
- renumberRow(currentRow);
- renumberRow(currentRow + 1);
- currentRow = -1;
- setCurrentCell(newRow - 1, currentCol);
- }
- }
-
- /**
- * Delete the specified row
- */
- void deleteRow() {
- numRows--;
- table.removeRow(currentRow);
- reorderRows(currentRow);
- currentRow = -1;
- clearCurrentCell();
- }
-
- private void clearCurrentCell() {
- if (currentRow > 0) {
- cellFormatter
- .setStyleName(currentRow, currentCol, "dt-editor-Cell");
- currentRow = -1;
- }
- if (currentCol > 0) {
- cellFormatter.setStyleName(0, currentCol,
- "dt-editor-DescriptionCell");
- currentCol = -1;
- }
- }
-
- /**
- * Renumber the rows from the start row and change the row the actions will
- * act on
- *
- * @param startRow
- */
- private void reorderRows(final int startRow) {
- for (int r = startRow; r < table.getRowCount(); r++) {
- renumberRow(r);
- }
- }
-
- /**
- * Renumber the given row and change the row the actions will act on
- *
- * @param row
- */
- private void renumberRow(int row) {
- table.setText(row, 0, Integer.toString(row));
- }
-
- /**
- * Add a new row after the specified row
- */
- void insertRow() {
- if (currentRow >= START_DATA_ROW) {
- numRows++;
- int newRow = addNewRow(currentRow + 1);
- int column = 1;
- for (; column < numCols() + 1; column++) {
- newCell(newRow, column, "");
- }
- // addActions(column, newRow, true);
- reorderRows(newRow);
- setCurrentCell(newRow, 1);
- }
- }
-
- private void editColumn(int row, int column) {
- String text = table.getText(row, column);
- editColumn(row, column, text);
- }
-
- private void editColumn(int row, int column, String text) {
- TextBox box = new TextBox();
- box.setText(text);
- box.setStyleName("dt-field-TextBox");
- table.setWidget(row, column, box);
- box.setFocus(true);
- }
-
- private int numCols() {
- return 6;
- }
-
-}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -13,6 +13,7 @@
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
@@ -74,13 +75,6 @@
pattern.add(changePattern);
- Image newPattern = new ImageButton("images/new_item.gif", "Create a new pattern for this column", new ClickListener() {
- public void onClick(Widget w) {
- showNewPatternDialog();
- }
- });
-
- pattern.add(newPattern);
addAttribute("Pattern:", pattern);
//now a radio button with the type
@@ -169,7 +163,7 @@
}
});
- addRow(apply);
+ addAttribute("", apply);
@@ -208,7 +202,7 @@
}
pop.addAttribute("Operator:", box);
Button b = new Button("OK");
- pop.addRow(b);
+ pop.addAttribute("", b);
b.addClickListener(new ClickListener() {
public void onClick(Widget w) {
editingCol.operator = box.getValue(box.getSelectedIndex());
@@ -247,7 +241,7 @@
}
pop.addAttribute("Field:", box);
Button b = new Button("OK");
- pop.addRow(b);
+ pop.addAttribute("", b);
b.addClickListener(new ClickListener() {
public void onClick(Widget w) {
editingCol.factField = box.getItemText(box.getSelectedIndex());
@@ -269,13 +263,34 @@
}
protected void showChangePattern(Widget w) {
- final FormStylePopup pop = new FormStylePopup();
final ListBox pats = this.loadPatterns();
- pop.addAttribute("Choose existing pattern to add column to:", pats);
+ if (pats.getItemCount() == 0) {
+ showNewPatternDialog();
+ return;
+ }
+ final FormStylePopup pop = new FormStylePopup();
Button ok = new Button("OK");
- pop.addRow(ok);
+ HorizontalPanel hp = new HorizontalPanel();
+ hp.add(pats);
+ hp.add(ok);
+
+ pop.addAttribute("Choose existing pattern to add column to:", hp);
+ pop.addAttribute("", new HTML("<i><b>---OR---</i></b>"));
+
+ Button createPattern = new Button("Create new fact pattern");
+ createPattern.addClickListener(new ClickListener() {
+ public void onClick(Widget w) {
+ pop.hide();
+ showNewPatternDialog();
+ }
+ });
+ pop.addAttribute("", createPattern);
+
+
+
+
ok.addClickListener(new ClickListener() {
public void onClick(Widget w) {
String[] val = pats.getValue(pats.getSelectedIndex()).split("\\s");
@@ -309,7 +324,7 @@
pop.hide();
}
});
- pop.addRow(ok);
+ pop.addAttribute("", ok);
pop.show();
Modified: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -9,6 +9,7 @@
import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
import org.drools.brms.client.modeldriven.dt.ActionCol;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
import org.drools.brms.client.modeldriven.dt.AttributeCol;
import org.drools.brms.client.modeldriven.dt.ConditionCol;
import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
@@ -38,6 +39,7 @@
import com.gwtext.client.data.SortState;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
+import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.ToolbarMenuButton;
@@ -70,6 +72,7 @@
private VerticalPanel attributeConfigWidget;
private VerticalPanel conditionsConfigWidget;
private String packageName;
+ private VerticalPanel actionsConfigWidget;
public GuidedDecisionTableWidget(RuleAsset asset) {
@@ -88,7 +91,7 @@
config.setCollapsible(true);
- FieldSet attributes = new FieldSet("Attributes");
+ FieldSet attributes = new FieldSet("Attribute columns");
attributes.setCollapsible(true);
attributes.setFrame(true);
@@ -96,13 +99,18 @@
config.add(attributes);
- FieldSet conditions = new FieldSet("Conditions");
+ FieldSet conditions = new FieldSet("Condition columns");
conditions.setCollapsible(true);
conditions.add(getConditions());
+ config.add(conditions);
- config.add(conditions);
+ FieldSet actions = new FieldSet("Action columns");
+ actions.setCollapsible(true);
+ actions.add(getActions());
+ config.add(actions);
+
layout.add(config);
refreshGrid();
@@ -111,6 +119,106 @@
initWidget(layout);
}
+ private Widget getActions() {
+ actionsConfigWidget = new VerticalPanel();
+ refreshActionsWidget();
+ return actionsConfigWidget;
+ }
+
+ private void refreshActionsWidget() {
+ this.actionsConfigWidget.clear();
+ for (int i = 0; i < dt.actionCols.size(); i++) {
+ ActionCol c = (ActionCol) dt.actionCols.get(i);
+ HorizontalPanel hp = new HorizontalPanel();
+ hp.add(removeAction(c));
+ hp.add(editAction(c));
+ hp.add(new SmallLabel(c.header));
+ actionsConfigWidget.add(hp);
+ }
+ actionsConfigWidget.add(newAction());
+
+ }
+
+ private Widget editAction(ActionCol c) {
+ return new Image("images/edit.gif");
+ }
+
+ private Widget newAction() {
+ return new ImageButton( "images/new_item.gif", "Create a new action column", new ClickListener() {
+ public void onClick(Widget w) {
+ final FormStylePopup pop = new FormStylePopup();
+ pop.setModal(false);
+
+ final ListBox choice = new ListBox();
+ choice.addItem("Set the value of a field", "set");
+ choice.addItem("Set the value of a field on a new fact", "insert");
+ choice.addItem("Retract an existing fact", "retract");
+ Button ok = new Button("OK");
+ ok.addClickListener(new ClickListener() {
+ public void onClick(Widget w) {
+ String s = choice.getValue(choice.getSelectedIndex());
+ if (s.equals("set")) {
+ showSet();
+ } else if (s.equals("insert")) {
+ showInsert();
+ } else if (s.equals("retract")) {
+ showRetract();
+ }
+ pop.hide();
+ }
+
+ private void showRetract() {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void showInsert() {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void showSet() {
+ ActionSetColumn set = new ActionSetColumn(getSCE(), dt, new Command() {
+ public void execute() {
+ //want to add in a blank row into the data
+ scrapeData(dt.attributeCols.size() + dt.conditionCols.size() + dt.actionCols.size() + 1);
+ refreshGrid();
+ refreshActionsWidget();
+ }
+ }, new ActionSetFieldCol(), true);
+ set.show();
+ }
+ });
+
+ pop.addAttribute("Type of action column:", choice);
+
+ pop.addAttribute("", ok);
+
+ pop.show();
+
+ }
+
+ });
+
+
+ }
+
+ private Widget removeAction(final ActionCol c) {
+ Image del = new ImageButton("images/delete_item_small.gif", "Remove this action column", new ClickListener() {
+ public void onClick(Widget w) {
+ if (com.google.gwt.user.client.Window.confirm("Are you sure you want to delete the column for " + c.header + " - all data in that column will be removed?")) {
+ dt.actionCols.remove(c);
+ removeField(c.header);
+ scrapeData(-1);
+ refreshGrid();
+ refreshActionsWidget();
+ }
+ }
+ });
+
+ return del;
+ }
+
private Widget getConditions() {
conditionsConfigWidget = new VerticalPanel();
refreshConditionsWidget();
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,71 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for inserting a row.
- * @author Steven Williams
- */
-public class InsertAction extends Composite {
-
- private HorizontalPanel panel = new HorizontalPanel();
- private Image insert;
- private int row;
-
-
-
-
- /**
- * Pass in the click listener delegate for when the respective action is clicked
- * @param clickListener
- * @param okClickListener
- */
- public InsertAction(final int currentRow, final RowClickListener clickListener) {
- row = currentRow;
- insert = new Image("images/new_item.gif");
- insert.setTitle( "Insert row after row " + row );
- insert.addClickListener( new ClickListener() {
- public void onClick(final Widget w) {
- clickListener.onClick(w, row);
- }
- });
-
- panel.add( insert);
-
- initWidget( panel );
- }
-
- public void setRow(final int row) {
- this.row = row;
- insert.setTitle( "Insert row after row " + row );
-
- }
-
- public int getRow() {
- return row;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,69 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for merging cells in a row.
- * @author Steven Williams
- */
-public class MergeAction extends Composite {
-
- private HorizontalPanel panel = new HorizontalPanel();
- private Image merge;
- private int row;
-
-
-
-
- /**
- * Pass in the click listener delegate for when the respective action is clicked
- * @param clickListener
- * @param okClickListener
- */
- public MergeAction(final int currentRow, final RowClickListener clickListener) {
- row = currentRow;
- merge = new Image("images/refresh.gif");
- merge.setTitle( "Merge cells in this row" );
- merge.addClickListener( new ClickListener() {
- public void onClick(final Widget w) {
- clickListener.onClick(w, row);
- }
- });
-
- panel.add( merge);
-
- initWidget( panel );
- }
-
- public void setRow(final int row) {
- this.row = row;
- }
-
- public int getRow() {
- return row;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,75 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for moving a row up or down.
- * @author Steven Williams
- */
-public class ShuffleAction extends Composite {
-
- private HorizontalPanel panel = new HorizontalPanel();
- private Image shuffle;
- private int row;
-
- public final static ShuffleAction EMPTY1 = new ShuffleAction() {
-
- };
-
- public ShuffleAction() {
- initWidget(panel);
- }
- /**
- * Pass in the click listener delegate for when the respective action is clicked and the
- * direction to move the row
- * @param currentRow
- * @param clickListener
- * @param direction
- */
- public ShuffleAction(final int currentRow, final RowClickListener clickListener, final String direction) {
- row = currentRow;
- shuffle = new Image("images/shuffle_" + direction + ".gif");
- shuffle.setTitle( "Move this row " + direction );
- shuffle.addClickListener( new ClickListener() {
- public void onClick(final Widget w) {
- clickListener.onClick(w, row);
- }
- });
-
- panel.add( shuffle);
-
- initWidget( panel );
- }
-
- public void setRow(final int row) {
- this.row = row;
- }
-
- public int getRow() {
- return row;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,37 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-/**
- * This shows the widget for moving a row down.
- * @author Steven Williams
- */
-public class ShuffleDownAction extends ShuffleAction {
-
- /**
- * Pass in the click listener delegate for when the respective action is clicked
- * @param clickListener
- * @param okClickListener
- */
- public ShuffleDownAction(final int currentRow, final RowClickListener clickListener) {
- super(currentRow, clickListener, "down");
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,37 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-/**
- * This shows the widget for moving a row up.
- * @author Steven Williams
- */
-public class ShuffleUpAction extends ShuffleAction {
-
- /**
- * Pass in the click listener delegate for when the respective action is clicked
- * @param clickListener
- * @param okClickListener
- */
- public ShuffleUpAction(final int currentRow, final RowClickListener clickListener) {
- super(currentRow, clickListener, "up");
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,143 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for moving a row up or down.
- * @author Steven Williams
- */
-public class Toolbar extends Composite {
-
- private HorizontalPanel toolbar = new HorizontalPanel();
- private int row;
-
- public Toolbar() {
- initWidget(toolbar);
- }
- /**
- * Pass in the click listener delegate for when the respective action is clicked and the
- * direction to move the row
- * @param currentRow
- * @param clickListener
- * @param direction
- */
- public Toolbar(final EditableDTGrid grid) {
- toolbar.add(createInsertRow(grid));
- toolbar.add(createDeleteRow(grid));
- toolbar.add(createMoveUp(grid));
- toolbar.add(createMoveDown(grid));
- toolbar.add(createMergeCol(grid));
- toolbar.add(createSplitCol(grid));
- toolbar.add(createMergeRow(grid));
- toolbar.add(createSplitRow(grid));
- toolbar.setStyleName("dt-editor-Toolbar");
-
- initWidget( toolbar );
- }
- private Image createSplitRow(final EditableDTGrid grid) {
- Image split = new Image("images/split_row.gif");
- split.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.splitRow();
- }});
- return split;
- }
- private Image createMergeRow(final EditableDTGrid grid) {
- Image merge = new Image("images/merge_row.gif");
- merge.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.mergeRow();
- }});
- return merge;
- }
- private Image createSplitCol(final EditableDTGrid grid) {
- Image split = new Image("images/split_col.gif");
- split.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.splitCol();
- }});
- return split;
- }
- private Image createMergeCol(final EditableDTGrid grid) {
- Image merge = new Image("images/merge_col.gif");
- merge.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.mergeCol();
- }});
- return merge;
- }
- private Image createMoveDown(final EditableDTGrid grid) {
- Image moveDown = new Image("images/shuffle_down.gif");
- moveDown.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.moveDown();
- }});
- return moveDown;
- }
- private Image createMoveUp(final EditableDTGrid grid) {
- Image moveUp = new Image("images/shuffle_up.gif");
- moveUp.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.moveUp();
- }
- });
- return moveUp;
- }
- private Image createDeleteRow(final EditableDTGrid grid) {
- Image delete = new Image("images/clear_item.gif");
- delete.setTitle( "Delete row" );
- delete.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.deleteRow();
- }
- });
- return delete;
- }
- private Image createInsertRow(final EditableDTGrid grid) {
- Image insert = new Image("images/new_item.gif");
- insert.addClickListener(new ClickListener() {
-
- public void onClick(Widget w) {
- grid.insertRow();
- }
- });
- return insert;
- }
-
- public void setRow(final int row) {
- this.row = row;
- }
-
- public int getRow() {
- return row;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,75 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 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.
- */
-
-
-
-public
-class Cell {
- private int rowspan;
- private int colspan;
- private String value;
- private Row row;
- private Column column;
-
- Cell(Row row, Column col) {
- this(row, col, 1, 1);
- }
- Cell(final Row r, final Column c, final int colspan, final int rowspan) {
- this.row = r;
- this.column = c;
- this.colspan = colspan;
- this.rowspan = rowspan;
- }
- public void setValue(final String value) {
- this.value = value;
- }
- public int getRowIndex() {
- return row.getIndex();
- }
- public int getColumnIndex() {
- return column.getIndex();
- }
- public Row getRow() {
- return row;
- }
- public void setRow(Row row) {
- this.row = row;
- }
- public int getRowspan() {
- return rowspan;
- }
- public void setRowspan(int rowspan) {
- this.rowspan = rowspan;
- }
- public int getColspan() {
- return colspan;
- }
- public Column getColumn() {
- return column;
- }
- public String getValue() {
- return value;
- }
- public String toString() {
- return "Cell[" + getRowIndex() + ", " + getColumnIndex() + ", " + getValue() + "]";
- }
- public void setColspan(int colspan) {
- this.colspan = colspan;
- }
-
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,40 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Column {
- private List cells = new ArrayList();
- private DecisionTable parent;
-
- Column(DecisionTable dt) {
- this.parent = dt;
- }
- void addCell(final Cell cell) {
- cells.add(cell);
- }
-
- public int getIndex() {
- return parent.getColumnIndex(this);
- }
- public void removeCell(Cell cell) {
- cells.remove(cell);
- }
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,98 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class DecisionTable {
- private Row headerRow = new HeaderRow(this);
- private List rows = new ArrayList();
- private List columns = new ArrayList();
-
- void addRow() {
-
- }
-
- void addColumn(final Column column) {
- columns.add(column);
- }
-
- public Row createRow() {
- Row row = new Row(this);
- rows.add(row);
- return row;
- }
-
- public Column createColumn() {
- Column column = new Column(this);
- columns.add(column);
- return column;
- }
-
- public Cell createCell(Row row, Column column) {
- Cell cell = new Cell(row, column);
- row.addCell(cell);
- column.addCell(cell);
- return cell;
- }
-
- public Row getHeaderRow() {
- return headerRow;
- }
-
- public List getColumns() {
- return columns;
- }
-
- public List getRows() {
- return rows;
- }
- public Row getRow(int index) {
- return (Row) rows.get(index);
- }
-
- public int getRowIndex(Row row) {
- return rows.indexOf(row);
- }
- public int getColumnIndex(Column column) {
- return columns.indexOf(column);
- }
-
- public void mergeCol(Cell currentCell) {
- Row row = currentCell.getRow();
- int currentColspan = currentCell.getColspan();
- int nextCellColumnIndex = currentCell.getColumnIndex() + currentColspan;
- Column nextColumn = (Column) columns.get(nextCellColumnIndex);
- Cell nextCell = row.getCell(nextColumn);
- currentCell.setColspan(currentColspan + nextCell.getColspan());
- row.removeColumn(nextColumn);
- nextColumn.removeCell(nextCell);
- }
-
- public void mergeRow(Cell currentCell) {
- Column column = currentCell.getColumn();
- int currentRowspan = currentCell.getRowspan();
- int nextCellRowIndex = currentCell.getRowIndex() + currentRowspan;
- Row nextRow = (Row) rows.get(nextCellRowIndex);
- Cell nextCell = nextRow.getCell(column);
- currentCell.setRowspan(currentRowspan + nextCell.getRowspan());
- nextRow.removeColumn(column);
- column.removeCell(nextCell);
- }
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,32 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 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.
- */
-
-
-
-public class HeaderRow extends Row {
-
- HeaderRow(DecisionTable dt) {
- super(dt);
- }
-
- int getIndex() {
- return -1;
- }
-
-
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -1,56 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 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.
- */
-
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class Row {
- private Map cells = new HashMap();
- private DecisionTable parent;
-
- Row(DecisionTable dt) {
- this.parent = dt;
- }
- void addCell(final Cell cell) {
- cells.put(cell.getColumn(), cell);
- }
- int getIndex() {
- return parent.getRowIndex(this);
- }
- public Cell getCell(Column column) {
- return (Cell) cells.get(column);
- }
- public Cell getCell(int col) {
- Iterator columns = parent.getColumns().iterator();
- int i = 0;
- Column column = null;
- while (i <= col) {
- column = (Column) columns.next();
- Cell cell = (Cell) cells.get(column);
- if (cell != null) {
- i++;
- }
- }
- return getCell(column);
- }
- public void removeColumn(Column nextColumn) {
- cells.remove(nextColumn);
- }
-}
Modified: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java 2008-03-16 23:37:24 UTC (rev 19030)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java 2008-03-17 06:54:34 UTC (rev 19031)
@@ -76,7 +76,8 @@
} else {
HashSet<String> disabled = new HashSet<String>();
//disabled.add("QA");
- return new UserSecurityContext(null, new HashSet());//new UserSecurityContext("SINGLE USER MODE (DEBUG) USE ONLY", disabled);
+ //return new UserSecurityContext(null, new HashSet());
+ return new UserSecurityContext("SINGLE USER MODE (DEBUG) USE ONLY", disabled);
}
}
More information about the jboss-svn-commits
mailing list