Skip to content

Instantly share code, notes, and snippets.

@patjackson52
Created April 9, 2013 14:24
Show Gist options
  • Select an option

  • Save patjackson52/5346063 to your computer and use it in GitHub Desktop.

Select an option

Save patjackson52/5346063 to your computer and use it in GitHub Desktop.
GWT-Bootstrap implementation of the masthead as shown in the twitter bootstrap marketing example. The second file is how to use the Masthead.
MastHead mastHead=new MastHead();
NavLink logIn=new NavLink("Log In");
NavLink aboutButton=new NavLink("About");
mastHead.setText("My Awesome App");
mastHead.setSubtext("Subtitle");
mastHead.addButton(logIn);
mastHead.addButton(aboutButton);
import com.github.gwtbootstrap.client.ui.Column;
import com.github.gwtbootstrap.client.ui.FluidRow;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.NavPills;
import com.github.gwtbootstrap.client.ui.base.DivWidget;
import com.github.gwtbootstrap.client.ui.resources.Bootstrap;
import com.google.gwt.user.client.ui.HasText;
import com.jackson.FirefighterLog.common.GooglePlusSignIn;
public class MastHead extends DivWidget implements HasText {
FluidRow row = new FluidRow();
Column col1 = new Column(8), col2 = new Column(3);
private final Heading heading = new Heading(1);
private NavPills navPills=new NavPills();
public MastHead() {
setStyleName(Bootstrap.page_header);
col1.add(heading);
row.add(col1);
col2.pullRight(true);
// buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
col2.add(navPills);
row.add(col2);
add(row);
}
public String getText() {
return heading.getText();
}
public void setText(String text) {
heading.setText(text);
}
public void setSubtext(String text) {
heading.setSubtext(text);
}
public void addButton(NavLink navLink) {
navPills.add(navLink);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment