You are absolutely right.
This is the code (or what is left of it, and still is not working..)
The following class is called from the class XXX.
The class returns a verticalPanel with all kinds of widgets on it,to
keep my functions grouped together.
The calling code is:
public VerticalPanel expensesPanel(Vector vectorMonthPosts ) {
VerticalPanel expensesBody= new VerticalPanel();
InputPanelWidget panelInput = new InputPanelWidget();
VerticalPanel newDataPanel = panelInput.InputPanelWidget();
expensesBody.add(newDataPanel);
return expensesBody;
}
I omitted other calls to other classes for brevity
The InputPanelWidget class looks like this..
package org.blackbox.finap.client.Widget.Expenses;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.client.Window;
import org.blackbox.finap.client.finApData;
import org.blackbox.finap.client.ServerService;
import org.blackbox.finap.client.AbstractAsyncHandler;
import org.blackbox.finap.client.Util.GridPopulator;
import org.blackbox.finap.client.Widget.SimpleDatePicker.DatePicker;
import
org.blackbox.finap.client.Widget.SimpleDatePicker.SimpleDatePicker;
import eu.maydu.gwt.validation.client.actions.FocusAction;
import eu.maydu.gwt.validation.client.actions.StyleAction;
import eu.maydu.gwt.validation.client.actions.LabelTextAction;
import eu.maydu.gwt.validation.client.ValidationProcessor;
import eu.maydu.gwt.validation.client.DefaultValidationProcessor;
import eu.maydu.gwt.validation.client.i18n.ValidationMessages;
import
eu.maydu.gwt.validation.client.validators.standard.NotEmptyValidator;
public class InputPanelWidget {
final Grid inputBoxes = new Grid(2,9);
//GridPopulator addColumn = new GridPopulator();
public VerticalPanel InputPanelWidget(){
VerticalPanel panelInputPanel = new VerticalPanel();
final HorizontalPanel panelInputBoxes= new HorizontalPanel();
panelInputBoxes.setTitle("invoer posten");
final TextBox inputDescription = new TextBox();
inputDescription.setName("inputDescription");
inputDescription.setWidth("100px");
inputDescription.setFocus(true);
panelInputBoxes.add(inputDescription);
// ValidationMessages valMessage =new ValidationMessages();
FocusAction focusAction = new FocusAction();
final ValidationProcessor validator = new
DefaultValidationProcessor();
Label errorLabel = new Label("Error!");
validator.addValidators("notBlank",
new NotEmptyValidator(inputDescription)
.addActionForFailure(new StyleAction
("validationFailedBorder"))
.addActionForFailure(new LabelTextAction(errorLabel))
.addActionForFailure(focusAction)
);
final CheckBox inputIncome =new CheckBox();
inputIncome.setName("incomeSource");
panelInputBoxes.add(inputIncome);
final CheckBox inputExpenses =new CheckBox();
inputExpenses.setName("expensesSource");
panelInputBoxes.add(inputExpenses);
final TextBox inputAmount = new TextBox();
inputAmount.setName("Amount");
inputAmount.setWidth("60px");
panelInputBoxes.add(inputAmount);
final CheckBox inputPaid = new CheckBox();
inputPaid.setName("Paid?");
panelInputBoxes.add(inputPaid);
final CheckBox inputVL = new CheckBox();
inputVL.setName("Vl_ll_post");
panelInputBoxes.add(inputVL);
final TextBox inputSource= new TextBox(); // must be a
selection from db sources
inputSource.setName("Source");
inputSource.setWidth("100px");
panelInputBoxes.add(inputSource);
final DatePicker inputDatePaid = new SimpleDatePicker();
inputDatePaid.setName("Date Paid");
panelInputBoxes.add(inputDatePaid);
final DatePicker inputDateDue=new SimpleDatePicker();
inputDateDue.setName("Date Due");
panelInputBoxes.add(inputDateDue);
//Create the grid
//inputBoxes.setBorderWidth(1);
addRowToGrid(inputDescription.getName(),inputDescription,0);
addRowToGrid(inputIncome.getName(),inputIncome,1);
addRowToGrid(inputExpenses.getName(),inputExpenses,2);
addRowToGrid(inputAmount.getName(),inputAmount,3);
addRowToGrid(inputPaid.getName(),inputPaid,4);
addRowToGrid(inputVL.getName(),inputVL,5);
addRowToGrid(inputSource.getName(),inputSource,6);
addRowToGrid( inputDatePaid.getName(),inputDatePaid,7);
addRowToGrid(inputDateDue.getName(),inputDateDue,8);
panelInputPanel.add(inputBoxes);
// panelInputPanel.add(panelInputBoxes);
// Add a 'ADD' button.
panelInputPanel.add( new Button("+", new ClickListener() {
public void onClick(Widget sender) {
boolean success=validator.validate();
if (success) {
finApData toServer = new finApData();
toServer.description= inputDescription.getText();
toServer.source= inputSource.getText();
putDataToServer(toServer);
// clear out the values for new input
inputDescription.setText("");
inputIncome.setChecked(false);
inputExpenses.setChecked(false);
inputAmount.setText("");
inputPaid.setChecked(false);
inputVL.setChecked(false);
inputSource.setText("");
inputDatePaid.setText("");
inputDateDue.setText("");
} else {
Window.alert("Please enter the description!");
}
}
}));
return panelInputPanel;
}
public void addRowToGrid(String name, Widget widget, int column) {
inputBoxes.setText(0,column,name);
inputBoxes.setWidget(1,column,widget);
inputBoxes.getCellFormatter().setStyleName(0,column,"input-
name");
inputBoxes.getCellFormatter().setStyleName(1,column,"input-
widget");
}
private void putDataToServer(finApData object) {
ServerService.getInstance().inputItem(
object,
new putItemToServer()
);
//getPostData(this.month); // need a way to refresh only part
of the page..
}
class putItemToServer extends AbstractAsyncHandler {
public void handleFailure(Throwable caught) {
Window.alert(" insert failed!");
}
public void handleSuccess(Object result) {
String didItWork="success";
if (didItWork.equals(result)) {
Window.alert("Succesfully inserted!");
} else {
Window.alert("uh-Oh!?!");
}
}
}
}
I deleted practically all the code, but the problem still persist.
However when I'm not calling this class, the error is gone..So it must
be something in the code. The java code is compiling fine..
Thx for any help..
NTDeaf
On 13 dec, 19:02, Ian Bambury <[email protected]> wrote:
> I would suggest you post some code.
>
> The best way is to reduce your app bit by bit until you have something
> manageable which demonstrates the problem in the fewest number of lines.
>
> Chances are that on the way you'll discover what is causing it, but if you
> don't, you'll have something to demonstrate the problem.
>
> You haven't even said what widget it is (obviously one with a cell, but that
> still leaves a fair few) or what you are trying to do with it. Or even
> posted the code of the 'offending class', even though you say you know which
> one it is. Or given the error stack. Or any clue at all, really.
>
> Ian
>
> http://examples.roughian.com
>
> 2009/12/13 ntdeaf <[email protected]>
>
> > Hi all,
>
> > I'm at the end of my wits.. The website is woring in the hosted
> > browser from GWT 1.7, but when I want to display the site in the
> > browser (firefox 3.5) I get a blank page. I have firebug installed, en
> > I know where the offending class is. But I don't know how to solve
> > this one. Could anyone give me some pointers?
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.