/** * Adds the given smiles category to the tab panel * @param smileCategoriesTabPanel the tab panel to add the category to * @param categoryInfo the smiley category info */ private void addCategoryToSmileyCategoryPanel( final DecoratedTabPanel smileCategoriesTabPanel, final SmileyHandler.SmileyCategoryInfo categoryInfo ) { //Initialize the scroll panel final SimplePanel scrollPanel = new SimplePanel(); scrollPanel.setStyleName( CommonResourcesContainer.SMILEY_LIST_SCROLL_PANEL_STYLE ); //Add proper tab header if( categoryInfo.minGold > 0 ) { final PriceTagWidget minMoneyTitle = new PriceTagWidget( SmileyHandlerUI.getCategoryTitle( categoryInfo.categoryID ), categoryInfo.minGold, true, false ); smileCategoriesTabPanel.add( scrollPanel, minMoneyTitle ); final int index = smileCategoriesTabPanel.getWidgetIndex( scrollPanel ); pricedCategoryTitles.put( index, minMoneyTitle); } else { smileCategoriesTabPanel.add( scrollPanel, SmileyHandlerUI.getCategoryTitle( categoryInfo.categoryID ) ); } //Remember the category tabsToCategories.put( smileCategoriesTabPanel.getWidgetIndex( scrollPanel ), categoryInfo ); }
/** * Populates the provided tab panel with the smile categories and smiles * @param smileCategoriesTabPanel */ private void populateSmileCategoriesPanel( final DecoratedTabPanel smileCategoriesTabPanel ) { Map<SmileyHandler.SmileyCategoryInfo,List<SmileyHandler.SmileyInfo>> categoryToSmileys = SmileyHandler.getCategoryToSmileInternalCodesMapping(); //First add the favorites category and then all others addCategoryToSmileyCategoryPanel( smileCategoriesTabPanel, SmileyHandler.SMILE_FAVORITES_CATEGORY_INFO ); //Add the remaining categories Iterator<SmileyHandler.SmileyCategoryInfo> categoryIter = categoryToSmileys.keySet().iterator(); while( categoryIter.hasNext() ) { SmileyHandler.SmileyCategoryInfo categoryInfo = categoryIter.next(); //Do not show payed categories if requested if( categoryInfo != SmileyHandler.SMILE_FAVORITES_CATEGORY_INFO && ( showPayedCategories || ( categoryInfo.minGold == 0 ) ) ) { addCategoryToSmileyCategoryPanel( smileCategoriesTabPanel, categoryInfo ); } } }
/** * Allows to add a new avatar's section into the avatar's section dialog * @param avatarSectionsTabPanel the decorated panel storing the smile section * @param avatarSection the avatar section descriptor */ private void addAvatarSectionBody( final DecoratedTabPanel avatarSectionsTabPanel, final PresetAvatarImages.AvatarSectionDescriptor avatarSection ) { //Initialize the scroll panel final ScrollPanel scrollPanel = new ScrollPanel(); scrollPanel.setStyleName( CommonResourcesContainer.CHOOSE_AVATAR_PANEL_STYLE ); //Add to the tab panel final PriceTagWidget minMoneyTitle = new PriceTagWidget( null, avatarSection.price, true, false ); avatarSectionsTabPanel.add( scrollPanel, minMoneyTitle ); //Store the tab to section mapping tabsToSections.put( avatarSectionsTabPanel.getWidgetIndex( scrollPanel ) , avatarSection ); //Store the tab to price tab mapping pricedSectionTitles.put( avatarSectionsTabPanel.getWidgetIndex( scrollPanel ), minMoneyTitle ); }
/*********************************** ***** INITIALIZATION ****** ***********************************/ private AggregateUI() { /* * CRITICAL NOTE: Do not do **anything** in this constructor that might * cause something underneath to call AggregateUI.get() * * The singleton is not yet assigned!!! */ singleton = null; timer = new RefreshTimer(this); // define the not-secure message info... notSecureMsgLabel = new Label(); notSecureMsgLabel.setStyleName("not_secure_message"); notSecurePanel = new FlowPanel(); notSecurePanel.add(notSecureMsgLabel); notSecurePanel.setVisible(false); // define the error message info... errorMsgLabel = new Label(); errorMsgLabel.setStyleName("error_message"); // put the not-secure and error messages in an error panel errorPanel = new FlowPanel(); errorPanel.add(errorMsgLabel); errorPanel.setVisible(false); // create tab datastructures tabMap = new HashMap<Tabs, AggregateTabBase>(); tabPosition = new ArrayList<Tabs>(); wrappingLayoutPanel = new FlowPanel(); // vertical wrappingLayoutPanel.setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME); layoutPanel = new HorizontalPanel(); mainNav = new DecoratedTabPanel(); mainNav.getElement().setId("mainNav"); mainNav.addSelectionHandler(new RefreshSelectionHandler<Integer>()); // add to layout layoutPanel.add(mainNav); layoutPanel.getElement().setId("layout_panel"); wrappingLayoutPanel.add(layoutPanel); helpPanel = new ScrollPanel(); // Create help panel Tree helpTree = new Tree(); rootItem = new TreeItem(); helpTree.addItem(rootItem); helpTree.addOpenHandler(new RefreshOpenHandler<TreeItem>()); helpTree.addCloseHandler(new RefreshCloseHandler<TreeItem>()); helpTree.getElement().setId("help_tree"); helpPanel.add(helpTree); helpPanel.getElement().setId("help_panel"); helpPanel.setVisible(false); wrappingLayoutPanel.add(helpPanel); settingsBar = new NavLinkBar(); RootPanel.get("not_secure_content").add(notSecurePanel); RootPanel.get("error_content").add(errorPanel); RootPanel.get("dynamic_content").add( new HTML("<img src=\"images/odk_color.png\" id=\"odk_aggregate_logo\" class=\"gwt-Image\" />")); RootPanel.get("dynamic_content").add(settingsBar); RootPanel.get("dynamic_content").add(wrappingLayoutPanel); }
public void tabFillOut( final int index, final DecoratedTabPanel tabPanel );
public void tabCleanUp( final int index, final DecoratedTabPanel tabPanel );