hey,
i have an OrderedLayout which i fill it with multiple CustomLayout, then i add it to a panel. But when i try to remove the OrderedLayout it can be removed and i end up adding more of same CustomLayout…code sample is below::
{
Window main;
public CustomLayout masterPageLayout;
public CustomLayout calenderEventLayout = null ;
public CustomLayout singleCalendarEventsView = null;
public MyEmailButton btHeading;
private Panel calendarEventsPanel = new Panel();
private OrderedLayout calendarEventsLayoutContainer = new OrderedLayout( OrderedLayout.ORIENTATION_VERTICAL );
public Button btClickHereToReadMore = null;
public Button btGoBack ;
public List<Object> listObjects = new ArrayList<Object> ();
public CalendarEventsViewLayout(CustomLayout mainLayout, Window mainWindow, CustomLayout currentLayout ) {
main = mainWindow;
masterPageLayout = mainLayout;
calendarEventsPanel.addComponent(calendarEventsLayoutContainer);
setCompositionRoot(calendarEventsPanel);
}
public void calendarEventsRenderer(List<Object> objectList)
{
try {
for (Object objectType : objectList)
{
singleCalendarEventsView = new CustomLayout("singleCalendarEventsView");
btClickHereToReadMore = new Button ("Click Here To Read More");
btClickHereToReadMore.setImmediate(true);
btClickHereToReadMore.addListener(Button.ClickEvent.class,
this,"viewClicked");
btClickHereToReadMore.setStyleName(Button.STYLE_LINK);
singleCalendarEventsView.addComponent(btClickHereToReadMore, "btClickHereToReadMore");
calendarEventsLayoutContainer.addComponent(singleCalendarEventsView);
}
calendarEventsPanel.addComponent(calendarEventsLayoutContainer);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void buttonClick(ClickEvent event) {
try {
if ( event.getSource == btGoBack ) {
/*
Why can't all components which are in panel be removed from removeAllComponents();
*/
calendarEventsPanel.removeAllComponents();
calendarEventsRenderer(listObjects );
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void viewClicked(ClickEvent event) {
try {
Object object;
int id = bt.getItemId();
object = listObjects .get(id);
viewSingleEventLayout(object );
} catch (Exception e) {
e.printStackTrace();
}
}
public void viewSingleEventLayout(Object object) {
calenderEventLayout = new CustomLayout("viewNewEvent");
btGoBack = new Button ( "Go Back" , this );
calenderEventLayout.addComponent(btGoBack, "btGoBack");
calendarEventsPanel.addComponent(calenderEventLayout);
}
in short what i would like to achieve is that i have some information and they should be in the same CustomLayout, that means i create mutliple CustomLayouts and i try to add them in an OrderedLayout and to display them in a verticalLayout. When clicks on a single layout, i display the CustomLayout to view a single piece of information, now i have to enable to go to the multiple items at the CustomLayout.
hope i am clear enough
can someone help me how to achieve this?
thanks in advance