All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sencha.gxt.theme.base.client.widget.CollapsePanelDefaultAppearance Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
/**
 * Sencha GXT 3.0.1 - Sencha for GWT
 * Copyright(c) 2007-2012, Sencha, Inc.
 * [email protected]
 *
 * http://www.sencha.com/products/gxt/license/
 */
package com.sencha.gxt.theme.base.client.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.sencha.gxt.core.client.Style.LayoutRegion;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.core.client.resources.StyleInjectorHelper;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.widget.core.client.CollapsePanel.CollapsePanelAppearance;

public class CollapsePanelDefaultAppearance implements CollapsePanelAppearance {

  public interface CollapsePanelResources extends ClientBundle {
    
    @Source("CollapsePanel.css")
    CollapsePanelStyle style();
  }
  
  public interface CollapsePanelStyle extends CssResource {
    String panel();
    
    String iconWrap();
    
    String west(); 
    
    String east();
    
    String north();
    
    String south();
  }
  
  private final CollapsePanelResources resources;
  private final CollapsePanelStyle style;
  
  public CollapsePanelDefaultAppearance() {
    this(GWT.create(CollapsePanelResources.class));
  }
  
  public CollapsePanelDefaultAppearance(CollapsePanelResources resources) {
    this.resources = resources;
    this.style = this.resources.style();
    
    StyleInjectorHelper.ensureInjected(style, true);
  }
  
  
  @Override
  public void render(SafeHtmlBuilder sb, LayoutRegion region) {
    String cls = style.panel();
    
    switch (region) {
      case WEST:
        cls += " " + style.west();
        break;
      case EAST:
        cls += " " + style.east();
        break;
      case NORTH:
        cls += " " + style.north();
        break;
      case SOUTH:
        cls += " " + style.south();
        break;
    }
    
    cls += " " + ThemeStyles.get().style().border();
    
    sb.appendHtmlConstant("
"); sb.appendHtmlConstant("
"); sb.appendHtmlConstant("
"); } @Override public XElement iconWrap(XElement parent) { return parent.getFirstChildElement().cast(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy