Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Created February 21, 2019 23:09
Show Gist options
  • Save branflake2267/671f57ac6dbb3498c936a47d5db9147a to your computer and use it in GitHub Desktop.
Save branflake2267/671f57ac6dbb3498c936a47d5db9147a to your computer and use it in GitHub Desktop.
GXT 4.0.x custom split button appearance barebones.
import com.google.gwt.core.shared.GWT;
import com.sencha.gxt.theme.triton.client.base.button.Css3ButtonCellAppearance;
public class CustomCss3ButtonCellAppearance<C> extends Css3ButtonCellAppearance<C> {
public interface CustomCss3ButtonResources extends Css3ButtonResources {
@Override
@Source({ "com/sencha/gxt/theme/triton/client/base/button/Css3ButtonCell.gss",
"com/sencha/gxt/theme/triton/client/base/button/Css3ButtonCellToolBar.gss",
"CustomStyles.gss" }) // override styles here
Css3ButtonStyle style();
// TODO extend for overriding the super class assets
}
public interface CustomCss3ButtonStyle extends Css3ButtonStyle {
// TODO override by adding the superclass methods to this interface, with annotation resource path override
}
public CustomCss3ButtonCellAppearance() {
super(GWT.<Css3ButtonResources>create(CustomCss3ButtonResources.class));
}
}
/* override the other class selectors in this gss */
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.cell.core.client.SplitButtonCell;
import com.sencha.gxt.widget.core.client.button.SplitButton;
import com.sencha.gxt.widget.core.client.container.FlowLayoutContainer;
import com.sencha.gxt.widget.core.client.menu.Menu;
import com.sencha.gxt.widget.core.client.menu.MenuItem;
public class CustomSplitButtonExample implements EntryPoint {
private SplitButton button1;
@Override
public void onModuleLoad() {
Menu menu1 = new Menu();
menu1.add(new MenuItem("Menu 1"));
menu1.add(new MenuItem("Menu 2"));
menu1.add(new MenuItem("Menu 3"));
// Override the appearance, the look and behavior
CustomCss3ButtonCellAppearance<String> customAppearance = new CustomCss3ButtonCellAppearance();
SplitButtonCell cell1 = new SplitButtonCell(customAppearance);
button1 = new SplitButton(cell1, "Button");
button1.setMenu(menu1);
FlowLayoutContainer flc = new FlowLayoutContainer();
flc.add(button1);
RootPanel.get().add(flc);
}
}
@branflake2267
Copy link
Author

branflake2267 commented Feb 21, 2019

screen shot 2019-02-21 at 3 09 29 pm

This is how you could override the appearance of the split button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment