[jboss-svn-commits] JBL Code SVN: r25041 - in labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor: client/messages and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Feb 2 00:27:16 EST 2009
Author: michael.neale at jboss.com
Date: 2009-02-02 00:27:15 -0500 (Mon, 02 Feb 2009)
New Revision: 25041
Removed:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidgetPlay.txt
Modified:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionInsertColumn.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionSetColumn.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Messages.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/messages.properties
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionCallMethodWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/ActionToolbar.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QuickFindWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/version.txt
Log:
GUVNOR-119 i18n - so much fun !
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionInsertColumn.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionInsertColumn.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionInsertColumn.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -60,12 +60,11 @@
pattern.add(patternLabel );
doPatternLabel();
- //NON-NLS
Image changePattern = new ImageButton("images/edit.gif", constants.ChooseAPatternThatThisColumnAddsDataTo(), new ClickListener() {
public void onClick(Widget w) {
showChangePattern(w);
}
- });
+ }); //NON-NLS
pattern.add(changePattern);
addAttribute(constants.Pattern(), pattern);
@@ -75,7 +74,7 @@
public void onClick(Widget w) {
showFieldChange();
}
- });
+ }); //NON-NLS
field.add(editField);
addAttribute(constants.Field(), field);
doFieldLabel();
@@ -228,7 +227,7 @@
ok.addClickListener(new ClickListener() {
public void onClick(Widget w) {
- String[] val = pats.getValue(pats.getSelectedIndex()).split("\\s");
+ String[] val = pats.getValue(pats.getSelectedIndex()).split("\\s"); //NON-NLS
editingCol.factType = val[0];
editingCol.boundName = val[1];
doPatternLabel();
@@ -250,7 +249,7 @@
final TextBox binding = new TextBox();
pop.addAttribute(constants.name(), binding);
- Button ok = new Button("OK");
+ Button ok = new Button(constants.OK());
ok.addClickListener(new ClickListener() {
public void onClick(Widget w) {
editingCol.boundName = binding.getText();
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionSetColumn.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionSetColumn.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/ActionSetColumn.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -13,6 +13,7 @@
import org.drools.guvnor.client.modeldriven.dt.ConditionCol;
import org.drools.guvnor.client.modeldriven.dt.GuidedDecisionTable;
import org.drools.guvnor.client.modeldriven.dt.ActionCol;
+import org.drools.guvnor.client.messages.Messages;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
@@ -25,6 +26,7 @@
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
public class ActionSetColumn extends FormStylePopup {
@@ -33,8 +35,9 @@
private TextBox fieldLabel = getFieldLabel();
private GuidedDecisionTable dt;
private SuggestionCompletionEngine sce;
+ private Messages constants = GWT.create(Messages.class);
- public ActionSetColumn(SuggestionCompletionEngine sce, final GuidedDecisionTable dt, final Command refreshGrid, final ActionSetFieldCol col, final boolean isNew) {
+ 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;
@@ -47,7 +50,7 @@
editingCol.update = col.update;
super.setModal(false);
- setTitle("Column configuration (set a field on a fact)");
+ setTitle(constants.ColumnConfigurationSetAFieldOnAFact());
@@ -55,7 +58,7 @@
pattern.add(bindingLabel);
doBindingLabel();
- Image changePattern = new ImageButton("images/edit.gif", "Choose a bound fact that this column pertains to", new ClickListener() {
+ Image changePattern = new ImageButton("images/edit.gif", constants.ChooseABoundFactThatThisColumnPertainsTo(), new ClickListener() {
public void onClick(Widget w) {
showChangeFact(w);
}
@@ -66,7 +69,7 @@
HorizontalPanel field = new HorizontalPanel();
field.add(fieldLabel);
- Image editField = new ImageButton("images/edit.gif", "Edit the field that this column operates on", new ClickListener() {
+ Image editField = new ImageButton("images/edit.gif", constants.EditTheFieldThatThisColumnOperatesOn(), new ClickListener() {
public void onClick(Widget w) {
showFieldChange();
}
@@ -84,8 +87,8 @@
});
HorizontalPanel vl = new HorizontalPanel();
vl.add(valueList);
- vl.add(new InfoPopup("Value list", "Value lists are an optional comma separated list of values to show as a drop down."));
- addAttribute("(optional) value list:", vl);
+ vl.add(new InfoPopup(constants.ValueList(), constants.ValueListsExplanation()));
+ addAttribute(constants.optionalValueList(), vl);
final TextBox header = new TextBox();
header.setText(col.header);
@@ -93,21 +96,21 @@
public void onChange(Widget w) {
editingCol.header = header.getText();
} });
- addAttribute("Column header (description):", header);
+ addAttribute(constants.ColumnHeaderDescription(), header);
- addAttribute("Update engine with changes:", doUpdate());
+ addAttribute(constants.UpdateEngineWithChanges(), doUpdate());
- Button apply = new Button("Apply changes");
+ Button apply = new Button(constants.ApplyChanges());
apply.addClickListener(new ClickListener() {
public void onClick(Widget w) {
if (null == editingCol.header || "".equals(editingCol.header)) {
- Window.alert("You must enter a column header value (description)");
+ Window.alert(constants.YouMustEnterAColumnHeaderValueDescription());
return;
}
if (isNew) {
if (!unique(editingCol.header)) {
- Window.alert("That column name is already in use - please pick another");
+ Window.alert(constants.ThatColumnNameIsAlreadyInUsePleasePickAnother());
return;
}
dt.actionCols.add(editingCol);
@@ -115,7 +118,7 @@
} else {
if (!col.header.equals(editingCol.header)) {
if (!unique(editingCol.header)) {
- Window.alert("That column name is already in use - please pick another");
+ Window.alert(constants.ThatColumnNameIsAlreadyInUsePleasePickAnother());
return;
}
}
@@ -156,8 +159,7 @@
}
});
hp.add(cb);
- hp.add(new InfoPopup("Update fact", "Checking this will tell the engine that the value has changed." +
- " This will cause the rules that depend on it to be re-evaulated. Use with care !"));
+ hp.add(new InfoPopup(constants.UpdateFact(), constants.UpdateDescription()));
return hp;
}
@@ -180,8 +182,8 @@
for (int i = 0; i < fields.length; i++) {
box.addItem(fields[i]);
}
- pop.addAttribute("Field:", box);
- Button b = new Button("OK");
+ pop.addAttribute(constants.Field(), box);
+ Button b = new Button(constants.OK());
pop.addAttribute("", b);
b.addClickListener(new ClickListener() {
public void onClick(Widget w) {
@@ -199,7 +201,7 @@
if (this.editingCol.factField != null) {
this.fieldLabel.setText(this.editingCol.factField);
} else {
- this.fieldLabel.setText("(please choose a fact pattern first)");
+ this.fieldLabel.setText(constants.pleaseChooseAFactPatternFirst());
}
}
@@ -217,8 +219,8 @@
final FormStylePopup pop = new FormStylePopup();
final ListBox pats = this.loadBoundFacts();
- pop.addAttribute("Choose fact:", pats);
- Button ok = new Button("OK");
+ pop.addAttribute(constants.ChooseFact(), pats);
+ Button ok = new Button(constants.OK());
pop.addAttribute("", ok);
ok.addClickListener(new ClickListener() {
@@ -259,7 +261,7 @@
if (this.editingCol.boundName != null) {
this.bindingLabel.setText("" + this.editingCol.boundName);
} else {
- this.bindingLabel.setText("(please choose a bound fact for this column)");
+ this.bindingLabel.setText(constants.pleaseChooseABoundFactForThisColumn());
}
}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Messages.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Messages.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/Messages.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -6,7 +6,7 @@
* This is used by GWT to provide localised strings at compile time.
* @author Michael Neale
*/
-public interface Messages extends Constants {
+public interface Messages extends com.google.gwt.i18n.client.Messages {
String ActionColumnConfigurationInsertingANewFact();
String ChooseAPatternThatThisColumnAddsDataTo();
@@ -64,4 +64,62 @@
String name();
String AddAField();
+
+ String ColumnConfigurationSetAFieldOnAFact();
+
+ String ChooseABoundFactThatThisColumnPertainsTo();
+
+ String UpdateEngineWithChanges();
+
+ String UpdateFact();
+
+ String UpdateDescription();
+
+ String pleaseChooseAFactPatternFirst();
+
+ String ChooseFact();
+
+ String pleaseChooseABoundFactForThisColumn();
+
+ String setterLabel(String displayName, String variable);
+
+ String statusIs(String statusName);
+
+ String SaveChanges();
+
+ String CommitAnyChangesForThisAsset();
+
+ String Copy();
+
+ String CopyThisAsset();
+
+ String Archive();
+
+ String ArchiveThisAssetThisWillNotPermanentlyDeleteIt();
+
+ String AreYouSureYouWantToArchiveThisItem();
+
+ String ArchivedItemOn();
+
+ String Delete();
+
+ String DeleteAssetTooltip();
+
+ String DeleteAreYouSure();
+
+ String ChangeStatus();
+
+ String ChangeStatusTip();
+
+ String CopyThisItem();
+
+ String NewName();
+
+ String CreateCopy();
+
+ String AssetNameMustNotBeEmpty();
+
+ String CreatedANewItemSuccess(String name, String packageName);
+
+ String CheckInChanges();
}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/messages.properties
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/messages.properties 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/messages/messages.properties 2009-02-02 05:27:15 UTC (rev 25041)
@@ -26,4 +26,33 @@
NewFactSelectTheType=New fact - select the type
FactType=Fact type:
name=name:
-AddAField=Add a field
\ No newline at end of file
+AddAField=Add a field
+ColumnConfigurationSetAFieldOnAFact=Column configuration (set a field on a fact)
+ChooseABoundFactThatThisColumnPertainsTo=Choose a bound fact that this column pertains to
+UpdateEngineWithChanges=Update engine with changes:
+UpdateFact=Update fact
+UpdateDescription=Checking this will tell the engine that the value has changed. This will cause the rules that depend on it to be re-evaulated. Use with care !
+pleaseChooseAFactPatternFirst=(please choose a fact pattern first)
+ChooseFact=Choose fact:
+pleaseChooseABoundFactForThisColumn=(please choose a bound fact for this column)
+setterLabel={0} value of <b>{1}</b>
+statusIs=<i>Status: [{0}]</i>
+SaveChanges=Save changes
+CommitAnyChangesForThisAsset=Commit any changes for this asset.
+Copy=Copy
+CopyThisAsset=Copy this asset.
+Archive=Archive
+ArchiveThisAssetThisWillNotPermanentlyDeleteIt=Archive this asset. This will not permanently delete it.
+AreYouSureYouWantToArchiveThisItem=Are you sure you want to archive this item?
+ArchivedItemOn=Archived Item on :
+Delete=Delete
+DeleteAssetTooltip=Permanently delete this asset. This will only be shown before the asset is checked in.
+DeleteAreYouSure=Are you sure you want to permanently delete this (unversioned) item?
+ChangeStatus=Change status
+ChangeStatusTip=Change the status of this asset.
+CopyThisItem=Copy this item
+NewName=New name:
+CreateCopy=Create copy
+AssetNameMustNotBeEmpty=Asset name must not be empty.
+CreatedANewItemSuccess=Created a new item called [{0}] in package: [{1}] successfully.
+CheckInChanges=Check in changes.
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionCallMethodWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionCallMethodWidget.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionCallMethodWidget.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -112,14 +112,14 @@
showAddFieldPopup(w);
}
} );
- horiz.add( new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.variable + "]") );
+ horiz.add( new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.variable + "]") ); //NON-NLS
horiz.add( edit );
return horiz;
}
protected void showAddFieldPopup(Widget w) {
- final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", constants.ChooseAMethodToInvoke());
+ final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", constants.ChooseAMethodToInvoke()); //NON-NLS
final ListBox box = new ListBox();
box.addItem( "..." );
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidget.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidget.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -25,6 +25,7 @@
import org.drools.guvnor.client.modeldriven.brl.ActionSetField;
import org.drools.guvnor.client.modeldriven.brl.ActionUpdateField;
import org.drools.guvnor.client.modeldriven.brl.FactPattern;
+import org.drools.guvnor.client.messages.Messages;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.ChangeListener;
@@ -33,6 +34,7 @@
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
/**
* This widget is for setting fields on a bound fact or global variable.
@@ -49,6 +51,7 @@
final private String[] fieldCompletions;
final private RuleModeller modeller;
final private String variableClass;
+ private Messages constants = GWT.create(Messages.class);
public ActionSetFieldWidget(RuleModeller mod, ActionSetField set, SuggestionCompletionEngine com) {
@@ -86,10 +89,10 @@
inner.setWidget( i, 0, fieldSelector(val) );
inner.setWidget( i, 1, valueEditor(val) );
final int idx = i;
- Image remove = new ImageButton("images/delete_item_small.gif");
+ Image remove = new ImageButton("images/delete_item_small.gif"); //NON-NLS
remove.addClickListener( new ClickListener() {
public void onClick(Widget w) {
- if (Window.confirm("Remove this item?")) {
+ if (Window.confirm(constants.RemoveThisItem())) {
model.removeField( idx );
modeller.refreshWidget();
}
@@ -110,7 +113,7 @@
Image edit = new ImageButton("images/edit_tiny.gif");
- edit.setTitle( "Add another field to this so you can set its value." );
+ edit.setTitle(constants.AddAnotherFieldToThisSoYouCanSetItsValue());
ClickListener clk = new ClickListener() {
public void onClick(Widget w) {
showAddFieldPopup(w);
@@ -122,7 +125,7 @@
modifyType = "modify";
}
- ClickableLabel lbl = new ClickableLabel(HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk);
+ ClickableLabel lbl = new ClickableLabel(constants.setterLabel(HumanReadable.getActionDisplayName(modifyType), model.variable), clk);//HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk);
horiz.add( lbl) ;
horiz.add( edit );
@@ -131,7 +134,7 @@
protected void showAddFieldPopup(Widget w) {
- final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", "Add a field");
+ final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", constants.AddAField());
final ListBox box = new ListBox();
box.addItem( "..." );
@@ -142,7 +145,7 @@
box.setSelectedIndex( 0 );
- popup.addAttribute( "Add field", box );
+ popup.addAttribute(constants.AddField(), box );
box.addChangeListener( new ChangeListener() {
public void onChange(Widget w) {
String fieldName = box.getItemText( box.getSelectedIndex() );
Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidgetPlay.txt
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidgetPlay.txt 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/ActionSetFieldWidgetPlay.txt 2009-02-02 05:27:15 UTC (rev 25041)
@@ -1,357 +0,0 @@
-package org.drools.guvnor.client.modeldriven.ui;
-/*
- * 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.guvnor.client.common.DirtyableComposite;
-import org.drools.guvnor.client.common.DirtyableFlexTable;
-import org.drools.guvnor.client.common.FieldEditListener;
-import org.drools.guvnor.client.common.FormStylePopup;
-import org.drools.guvnor.client.common.ImageButton;
-import org.drools.guvnor.client.common.InfoPopup;
-import org.drools.guvnor.client.common.Lbl;
-import org.drools.guvnor.client.common.YesNoDialog;
-import org.drools.guvnor.client.modeldriven.HumanReadable;
-import org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine;
-import org.drools.guvnor.client.modeldriven.brl.ActionFieldValue;
-import org.drools.guvnor.client.modeldriven.brl.ActionSetField;
-import org.drools.guvnor.client.modeldriven.brl.ActionUpdateField;
-import org.drools.guvnor.client.modeldriven.brl.FactPattern;
-import org.drools.guvnor.client.modeldriven.brl.RuleModel;
-import org.drools.guvnor.client.modeldriven.brl.SingleFieldConstraint;
-
-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.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.KeyboardListener;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This widget is for setting fields on a bound fact or global variable.
- *
- * @author Michael Neale
- */
-public class ActionSetFieldWidget extends DirtyableComposite {
-
- final private ActionSetField model;
- final private SuggestionCompletionEngine completions;
- final private DirtyableFlexTable layout;
- private boolean isBoundFact = false;
-
- final private String[] fieldCompletions;
- final private RuleModeller modeller;
- final private String variableClass;
-
-
- public ActionSetFieldWidget(RuleModeller mod, ActionSetField set, SuggestionCompletionEngine com) {
- this.model = set;
- this.completions = com;
- this.layout = new DirtyableFlexTable();
- this.modeller = mod;
-
- layout.setStyleName( "model-builderInner-Background" );
- if (completions.isGlobalVariable( set.variable )) {
- this.fieldCompletions = completions.getFieldCompletionsForGlobalVariable( set.variable );
- this.variableClass = (String) completions.globalTypes.get( set.variable );
- } else {
- FactPattern pattern = mod.getModel().getBoundFact( set.variable );
- this.fieldCompletions = completions.getFieldCompletions( pattern.factType );
- this.variableClass = pattern.factType;
- this.isBoundFact = true;
- }
-
- doLayout();
-
- initWidget( this.layout );
- }
-
-
- private void doLayout() {
- layout.clear();
- layout.setWidget( 0, 0, getSetterLabel() );
-
- DirtyableFlexTable inner = new DirtyableFlexTable();
-
- for ( int i = 0; i < model.fieldValues.length; i++ ) {
- ActionFieldValue val = model.fieldValues[i];
-
- inner.setWidget( i, 0, fieldSelector(val) );
- inner.setWidget( i, 1, valueEditor(val) );
- final int idx = i;
- Image remove = new ImageButton("images/delete_item_small.gif");
- remove.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- YesNoDialog diag = new YesNoDialog("Remove this item?", new Command() {
- public void execute() {
- model.removeField( idx );
- modeller.refreshWidget();
- }
- });
- diag.setPopupPosition( w.getAbsoluteLeft(), w.getAbsoluteTop() );
- diag.show();
- }
- });
- inner.setWidget( i, 2, remove );
- }
-
- layout.setWidget( 0, 1, inner );
-
-
- }
-
-
- private Widget getSetterLabel() {
-
- HorizontalPanel horiz = new HorizontalPanel();
-
-
- Image edit = new ImageButton("images/add_field_to_fact.gif");
- edit.setTitle( "Add another field to this so you can set its value." );
- edit.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- showAddFieldPopup(w);
- }
- } );
- String modifyType = "set";
- if (this.model instanceof ActionUpdateField) {
- modifyType = "modify";
- }
- horiz.add( new Lbl(HumanReadable.getActionDisplayName(modifyType) + " [" + model.variable + "]", "modeller-action-Label") );
- horiz.add( edit );
-
- return horiz;
- }
-
-
- protected void showAddFieldPopup(Widget w) {
- final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", "Add a field");
- popup.setStyleName( "ks-popups-Popup" );
- final ListBox box = new ListBox();
- box.addItem( "..." );
-
- for ( int i = 0; i < fieldCompletions.length; i++ ) {
- box.addItem( fieldCompletions[i] );
- }
-
- box.setSelectedIndex( 0 );
-
- popup.addAttribute( "Add field", box );
- box.addChangeListener( new ChangeListener() {
- public void onChange(Widget w) {
- String fieldName = box.getItemText( box.getSelectedIndex() );
-
- String fieldType = completions.getFieldType( variableClass, fieldName );
- model.addFieldValue( new ActionFieldValue( fieldName, "", fieldType ) );
- modeller.refreshWidget();
- popup.hide();
- }
- });
-
-
-
- popup.setPopupPosition( w.getAbsoluteLeft(), w.getAbsoluteTop() );
- popup.show();
-
- }
-
-
- private Widget valueEditor(final ActionFieldValue val) {
-
- String enumKey = this.variableClass + "." + val.field;
- if (this.completions.dataEnumLists.containsKey( enumKey )) {
- return ConstraintValueEditor.enumDropDown( val.value, new ConstraintValueEditor.ValueChanged() {
- public void valueChanged(String newValue) {
- val.value = newValue;
- }
- }, (String[]) this.completions.dataEnumLists.get( enumKey ) );
- } else {
-
- SimplePanel panel = new SimplePanel();
-
- if (val.value == null || val.value.equals( "" )) {
- //have to show a choice
- Image clickme = new ImageButton( "images/edit.gif", "Click to choose if it is a literal value or a formula" );
- clickme.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- showTypeChoice( w, val );
- }
- } );
- panel.add( clickme );
- } else {
-
- if (val.value.startsWith( "=" )) {
- HorizontalPanel horiz = new HorizontalPanel();
-
- final TextBox box = new TextBox();
- box.setText( val.value.substring( 1 ) );
- if (val.value.length() != 0) {
- box.setVisibleLength( val.value.length() );
- }
-
- box.addChangeListener( new ChangeListener() {
-
- public void onChange(Widget w) {
- val.value = "=" + box.getText();
- }
-
- });
-
- box.addKeyboardListener( new FieldEditListener(new Command() {
- public void execute() {
- box.setVisibleLength( box.getText().length() );
- }
- }));
-
- String msg = "This is a formula expression which will evaluate to a value.";
-
- Image img = new Image("images/function_assets.gif");
- img.setTitle( msg );
- box.setTitle( msg );
- horiz.add( img );
- horiz.add( box );
-
- panel.add( horiz );
- }else {
-
- final TextBox box = new TextBox();
- box.setText( val.value );
- if (val.value.length() != 0) {
- box.setVisibleLength( val.value.length() );
- }
-
-
- if (val.type.equals( SuggestionCompletionEngine.TYPE_NUMERIC )) {
- box.addKeyboardListener( getNumericFilter( box ));
- }
-
- box.addChangeListener( new ChangeListener() {
- public void onChange(Widget w) {
- val.value = box.getText();
- }
- });
-
- box.addKeyboardListener( new FieldEditListener(new Command() {
- public void execute() {
- box.setVisibleLength( box.getText().length() );
- }
- }));
- panel.add( box );
- }
- }
- return panel;
- }
- }
-
-
- protected void showTypeChoice(Widget w,
- final ActionFieldValue val) {
- final FormStylePopup form = new FormStylePopup( "images/newex_wiz.gif",
- "Field value" );
-
- Button lit = new Button( "Literal value" );
- lit.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- val.value = " ";
- doLayout();
- form.hide();
- }
-
- } );
-
- HorizontalPanel horiz = new HorizontalPanel();
- horiz.add( lit );
- horiz.add( new InfoPopup( "Literal",
- "A literal value means the " + "constraint is directly against the value that you type (ie. what you see on screen)." ) );
- form.addAttribute( "Literal value:", horiz);
-
- Button formula = new Button( "New formula" );
- lit.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- val.value = "=";
- doLayout();
- form.hide();
- }
-
- } );
-
-
- horiz = new HorizontalPanel();
- horiz.add( formula );
- horiz.add( new InfoPopup( "A formula",
- "A formula is an expression that calculates and returns a value (that value will be used to set the field value)." ) );
-
- form.addAttribute( "A formula:", horiz);
- form.setPopupPosition( w.getAbsoluteLeft(), w.getAbsoluteTop() );
- form.show();
-
-
-
- }
-
-
- /**
- * This will return a keyboard listener for field setters, which
- * will obey numeric conventions - it will also allow formulas
- * (a formula is when the first value is a "=" which means
- * it is meant to be taken as the user typed)
- */
- public static KeyboardListener getNumericFilter(final TextBox box) {
- return new KeyboardListener() {
-
- public void onKeyDown(Widget arg0, char arg1, int arg2) {
-
- }
-
- public void onKeyPress(Widget w, char c, int i) {
- if (Character.isLetter( c ) && c != '='
- && !(box.getText().startsWith( "=" ))) {
- ((TextBox) w).cancelKey();
- }
- }
-
- public void onKeyUp(Widget arg0, char arg1, int arg2) {
- }
-
- };
- }
-
-
- private Widget fieldSelector(final ActionFieldValue val) {
- return new Label(val.field);
- }
-
- /**
- * This returns true if the values being set are on a fact.
- */
- public boolean isBoundFact() {
- return isBoundFact;
- }
-
- public boolean isDirty() {
- return layout.hasDirty();
- }
-
-}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/ActionToolbar.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/ActionToolbar.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/ActionToolbar.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -23,6 +23,7 @@
import org.drools.guvnor.client.common.StatusChangePopup;
import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.client.messages.Messages;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
@@ -31,6 +32,7 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.QuickTipsConfig;
import com.gwtext.client.widgets.Toolbar;
@@ -38,6 +40,8 @@
import com.gwtext.client.widgets.ToolbarTextItem;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import javax.net.ssl.SSLEngineResult;
+
/**
* This contains the widgets used to action a rule asset
* (ie checkin, change state, close window)
@@ -52,6 +56,7 @@
private ToolbarTextItem state;
final private RuleAsset asset;
private Command afterCheckinEvent;
+ private Messages constants = GWT.create(Messages.class);
public ActionToolbar(final RuleAsset asset,
final CheckinAction checkin,
@@ -63,7 +68,7 @@
this.deleteAction = delete;
this.asset = asset;
- this.state = new ToolbarTextItem("Status: ");
+ this.state = new ToolbarTextItem(constants.Status() + " ");
;
toolbar = new Toolbar();
@@ -87,14 +92,14 @@
* Sets the visible status display.
*/
private void setState(String status) {
- state.setText("<i>Status: [" + status + "]</i>");
+ state.setText(constants.statusIs(status));
}
private void controls() {
ToolbarButton save = new ToolbarButton();
- save.setText("Save changes");
- save.setTooltip(getTip("Commit any changes for this asset."));
+ save.setText(constants.SaveChanges());
+ save.setTooltip(getTip(constants.CommitAnyChangesForThisAsset()));
save.addListener(new ButtonListenerAdapter() {
public void onClick(
com.gwtext.client.widgets.Button button,
@@ -108,8 +113,8 @@
toolbar.addSeparator();
ToolbarButton copy = new ToolbarButton();
- copy.setText("Copy");
- copy.setTooltip("Copy this asset.");
+ copy.setText(constants.Copy());
+ copy.setTooltip(constants.CopyThisAsset());
copy.addListener(new ButtonListenerAdapter() {
public void onClick(
com.gwtext.client.widgets.Button button,
@@ -121,14 +126,14 @@
ToolbarButton archive = new ToolbarButton();
- archive.setText("Archive");
- archive.setTooltip(getTip("Archive this asset. This will not permanently delete it."));
+ archive.setText(constants.Archive());
+ archive.setTooltip(getTip(constants.ArchiveThisAssetThisWillNotPermanentlyDeleteIt()));
archive.addListener(new ButtonListenerAdapter() {
public void onClick(
com.gwtext.client.widgets.Button button,
EventObject e) {
- if (Window.confirm( "Are you sure you want to archive this item?" )) {
- archiveAction.doCheckin("Archived Item on " + new java.util.Date().toString());
+ if (Window.confirm(constants.AreYouSureYouWantToArchiveThisItem())) {
+ archiveAction.doCheckin(constants.ArchivedItemOn() + new java.util.Date().toString());
}
}
});
@@ -140,13 +145,13 @@
if (notCheckedInYet()) {
final ToolbarButton delete = new ToolbarButton();
- delete.setText("Delete");
- delete.setTooltip(getTip("Permanently delete this asset. This will only be shown before the asset is checked in."));
+ delete.setText(constants.Delete());
+ delete.setTooltip(getTip(constants.DeleteAssetTooltip()));
delete.addListener(new ButtonListenerAdapter() {
public void onClick(
com.gwtext.client.widgets.Button button,
EventObject e) {
- if (Window.confirm( "Are you sure you want to permanently delete this (unversioned) item?" ) ) {
+ if (Window.confirm(constants.DeleteAreYouSure()) ) {
deleteAction.execute();
}
}
@@ -168,8 +173,8 @@
ToolbarButton stateChange = new ToolbarButton();
- stateChange.setText("Change status");
- stateChange.setTooltip(getTip("Change the status of this asset."));
+ stateChange.setText(constants.ChangeStatus());
+ stateChange.setTooltip(getTip(constants.ChangeStatusTip()));
stateChange.addListener(new ButtonListenerAdapter() {
public void onClick(
com.gwtext.client.widgets.Button button,
@@ -197,15 +202,15 @@
protected void doCopyDialog(Widget w) {
- final FormStylePopup form = new FormStylePopup("images/rule_asset.gif", "Copy this item");
+ final FormStylePopup form = new FormStylePopup("images/rule_asset.gif", constants.CopyThisItem());
final TextBox newName = new TextBox();
- form.addAttribute( "New name:", newName );
+ form.addAttribute(constants.NewName(), newName );
- Button ok = new Button("Create copy");
+ Button ok = new Button(constants.CreateCopy());
ok.addClickListener( new ClickListener() {
public void onClick(Widget w) {
if (newName.getText() == null || newName.getText().equals("")) {
- Window.alert("Asset name must not be empty.");
+ Window.alert(constants.AssetNameMustNotBeEmpty());
return;
}
RepositoryServiceFactory.getService().copyAsset( asset.uuid, asset.metaData.packageName, newName.getText(),
@@ -227,7 +232,7 @@
}
private void completedCopying(String name, String pkg) {
- Window.alert( "Created a new item called [" + name + "] in package: [" + pkg + "] successfully." );
+ Window.alert( constants.CreatedANewItemSuccess(name, pkg) );
}
@@ -235,7 +240,7 @@
* Called when user wants to checkin.
*/
protected void doCheckinConfirm(Widget w) {
- final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft(), w.getAbsoluteTop(), "Check in changes.");
+ final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft(), w.getAbsoluteTop(), constants.CheckInChanges());
pop.setCommand( new Command() {
public void execute() {
checkinAction.doCheckin(pop.getCheckinComment());
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QuickFindWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QuickFindWidget.java 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QuickFindWidget.java 2009-02-02 05:27:15 UTC (rev 25041)
@@ -27,6 +27,7 @@
import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
import org.drools.guvnor.client.rpc.TableDataResult;
import org.drools.guvnor.client.rpc.TableDataRow;
+import org.drools.guvnor.client.messages.Messages;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
@@ -41,6 +42,8 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.SuggestOracle.Callback;
import com.google.gwt.user.client.ui.SuggestOracle.Request;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.core.client.GWT;
/**
* This is for quickly finding an asset by name. Partial completion is allowed.
@@ -74,6 +77,7 @@
go.addClickListener( new ClickListener() {
public void onClick(Widget w) {
updateList();
+
}
} );
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/version.txt
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/version.txt 2009-02-02 04:57:36 UTC (rev 25040)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/version.txt 2009-02-02 05:27:15 UTC (rev 25041)
@@ -1 +1 @@
-5.0.0.SNAPSHOT 24990M
\ No newline at end of file
+5.0.0.SNAPSHOT 25037M
\ No newline at end of file
More information about the jboss-svn-commits
mailing list