PDA

View Full Version : Page refresh



urwitharup@yahoo.com
7 May 2009, 4:24 PM
Hello,

I have a strange issue. I need to dynamically load the date of a layout container using a user entered value in a different layout container. As per example,

First Layout container has A,B(Text) on display. Once you click A , another layoutcontainer with M,N,Y (Text) will be displayed. If you click B, then it would be X,Y. With A I have a selection listener to load the second layout. If i click on A/B, the 2nd layout gets displayed without data, if I maximize the screen, then the display with M,N,Y or X,Y come. Can you please help me to get rid of this?

Regards
Arup

micgala
8 May 2009, 5:55 AM
If you post your code, that would help us to see what is wrong with it.

urwitharup@yahoo.com
10 May 2009, 11:32 PM
see the code in below .It is calling a RPC while loading it


package com.ambernet.sep.ucare.oc.client.widgets.forms;


import java.util.Iterator;

import java.util.List;


import com.ambernet.sep.ucare.oc.client.controller.helper.ApplicationInstanceConstants;

import com.ambernet.sep.ucare.oc.client.controller.helper.LabelMapper;

import com.ambernet.sep.ucare.oc.client.controller.helper.ServiceRegister;

import com.ambernet.sep.ucare.oc.client.model.ProductCategory;

import com.ambernet.sep.ucare.oc.client.serviceinterfaces.ProductServiceAsync;

import com.extjs.gxt.ui.client.Events;

import com.extjs.gxt.ui.client.Registry;

import com.extjs.gxt.ui.client.event.BaseEvent;

import com.extjs.gxt.ui.client.event.Listener;

import com.extjs.gxt.ui.client.widget.LayoutContainer;

import com.extjs.gxt.ui.client.widget.MessageBox;

import com.extjs.gxt.ui.client.widget.Text;

import com.extjs.gxt.ui.client.widget.form.FormPanel;

import com.extjs.gxt.ui.client.widget.layout.FitLayout;

import com.google.gwt.core.client.GWT;

import com.google.gwt.user.client.Event;

import com.google.gwt.user.client.rpc.AsyncCallback;


/**

*@authorarup.sarkar

*
*/

publicclass BrowseProductCategory extends LayoutContainer {

private FormPanel fp;
private ProductServiceAsync productService;
privateintproductCategoryId;



public BrowseProductCategory() {
Registry.register(ApplicationInstanceConstants.BROWSE_PRODUCT_CATEGORY, this);
this.setLayout(new FitLayout());

fp = new FormPanel();
fp.setHeading(LabelMapper.getInstance().getMnemonic(
"BROWSEPRODUCT_BROWSECATEGORY"));
fp.setFrame(true);

// productCategoryId = 1;


if (Registry.get(ApplicationInstanceConstants.SELECTED_PRODUCTSEGMENT_ID) != null)
productCategoryId = Integer.parseInt((String) (Registry
.get(ApplicationInstanceConstants.SELECTED_PRODUCTSEGMENT_ID)));
else

return;

productService = Registry.get(ServiceRegister.PRODUCTSERVICE);

productService.getProductCategory(productCategoryId,
new AsyncCallback<List<ProductCategory>>() {

publicvoid onFailure(Throwable caught) {
MessageBox.confirm("Test", "RPC failed.", null);

}

publicvoid onSuccess(
List<ProductCategory> productCategories) {
Iterator productCategoriesIterator = productCategories
.iterator();
while (productCategoriesIterator.hasNext()) {
// GWT.log("yes", null);

ProductCategory productCategory = (ProductCategory) productCategoriesIterator
.next();
final Text productNameText = new Text();
productNameText.setText(productCategory.getName());
final Text productCategoryShortDescription = new Text();
productCategoryShortDescription
.setText(productCategory
.getShortDescription());
finalint id = productCategory.getId();
fp.add(productNameText);
fp.add(productCategoryShortDescription);

productCategoryShortDescription.setTagName("span");
productCategoryShortDescription.setStyleAttribute(
"cursor", "pointer");
productCategoryShortDescription
.sinkEvents(Event.ONCLICK);
productCategoryShortDescription
.sinkEvents(Event.MOUSEEVENTS);

productCategoryShortDescription.addListener(
Events.OnClick, new Listener<BaseEvent>() {
publicvoid handleEvent(BaseEvent be) {

Registry
.register(
ApplicationInstanceConstants.SELECTED_PRODUCTCATEGORY_ID,
Integer
.toBinaryString(id));
BrowseProductCategory.this.hide();
}
});
productCategoryShortDescription.addListener(
Events.OnMouseOver,
new Listener<BaseEvent>() {
publicvoid handleEvent(BaseEvent be) {
productCategoryShortDescription
.setStyleAttribute("color",
"blue");
}
});
productCategoryShortDescription.addListener(
Events.OnMouseOut,
new Listener<BaseEvent>() {
publicvoid handleEvent(BaseEvent be) {
productCategoryShortDescription
.setStyleAttribute("color",
"black");
}

});


}

}

});

add(fp);
}

}

sven
13 May 2009, 3:34 AM
You need to call layout.

urwitharup@yahoo.com
13 May 2009, 3:38 PM
Thanks it works