Results 1 to 2 of 2

Thread: Title-Toolbar

  1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    37

    Default Title-Toolbar

    I am using this small amendment for toolbar. On the left it looks like a header, but following the title it can include usual ToolBar items, as it actually being a toolbar.

    Unfortunately if I change the theme, the xtb-title-text has to be changed too. Any idea how to make it - unnecessarily to be changed?

    Code:
    public class TitleToolbar extends ToolBar {
    
    	private TitleToolItem	titleLabel	= new TitleToolItem();
    
    	public TitleToolbar() {
    		super();
    		baseStyle += " x-panel-header title-toolbar";
    	}
    
    	public TitleToolbar(String title) {
    		this();
    		setTitle(title);
    		insert(titleLabel, 0);
    	}
    
    	@Override
    	public void setTitle(String title) {
    		titleLabel.setLabel(title);
    	}
    
    }
    
    public class TitleToolItem extends BoxComponent {
    
    	private String	label;
    
    	public TitleToolItem() {
    
    	}
    
    	public TitleToolItem(String label) {
    		this.label = label;
    	}
    
    	public String getLabel() {
    		return label;
    	}
    
    	public void setLabel(String label) {
    		this.label = label;
    		if (rendered) {
    			el().update(Util.isEmptyString(label) ? "" : label);
    		}
    	}
    
    	@Override
    	protected void onRender(Element target, int index) {
    		setElement(DOM.createDiv(), target, index);
    		addStyleName("xtb-title-text");
    		setLabel(label);
    		super.onRender(target, index);
    	}
    }
    
    .title-toolbar {
    	height: 22px !important;
    	padding-top: 1px !important;
    	padding-bottom: 1px !important;
    	padding-left: 5px !important;
    	border-color:#99BBE8;
    }
    .title-toolbar .xtb-title-text{
    	color: rgb(21, 66, 139);
    	font-weight:bold;
    	font-family:tahoma, arial, verdana, sans-serif;
    }

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Posts
    37

    Default

    I use it like this:


    Code:
    		TitleToolbar toolBar = new TitleToolbar("Szlltand");
    		toolBar.add(new FillToolItem());
    
    		Button close = new Button("Lezr");
    		close.setIcon(icons.save());
    		close.addSelectionListener(new SelectionListener<ButtonEvent>() {
    			@Override
    			public void componentSelected(ButtonEvent ce) {
    				getStoreManager2().saveItemList();
    			}
    		});
    		toolBar.add(close);
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •