Java Code Examples for com.google.gwt.user.client.ui.Grid

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.Grid. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: EasyML   File: JobDescPopupPanel.java   View source code 6 votes vote down vote up
/**
 * Create a Grid that describes the job
 */
@SuppressWarnings("deprecation")
private Grid createGrid() {
	Grid grid = new Grid(2, 2);
	grid.setWidth("280px");
	grid.setWidget(0, 0, new Label(Constants.studioUIMsg.jobName()));
	/**
	 * Panel information
	 */

	namebox.setStyleName("boxstyle");
	grid.setWidget(0, 1, namebox);
	grid.setWidget(1, 0, new Label(Constants.studioUIMsg.jobDescription()));

	SubmitListener sl = new SubmitListener();
	namebox.addKeyboardListener(sl);

	descArea.setStyleName("boxstyle");
	descArea.setHeight("auto");
	grid.setWidget(1, 1, descArea);
	grid.setStyleName("bda-newjob-grid");
	return grid;
}
 
Example 2
Project: EasyML   File: ParameterPanel.java   View source code 6 votes vote down vote up
protected void initGridHead(int size){
	this.setSpacing(3);
	paramsGrid = new Grid(size, 3);

	paramsGrid.setStyleName("gridstyle");
	paramsGrid.setBorderWidth(1);
	paramsGrid.setWidth("250px");
	Label nameLabel = new Label(Constants.studioUIMsg.parameter());
	nameLabel.setWidth("65px");
	paramsGrid.setWidget(0, 0, nameLabel);

	Label typeLabel = new Label(Constants.studioUIMsg.type());
	typeLabel.setWidth("40px");
	paramsGrid.setWidget(0, 1, typeLabel);

	Label valueLabel = new Label(Constants.studioUIMsg.value());
	paramsGrid.setWidget(0, 2, valueLabel);
	paramsGrid.setVisible(false);
}
 
Example 3
Project: ontobrowser   File: SearchOptionsView.java   View source code 6 votes vote down vote up
private Panel createPanel() {
	Label label = new Label("Search Options");
	label.addStyleName("search-header");
	label.getElement().getStyle().setDisplay(Display.BLOCK);
	
	Grid grid = new Grid(2,2);
	grid.setText(0, 0, "Ontology/Codelist:");
	grid.setWidget(0, 1, ontologiesDropBox);
	grid.setText(1, 0, "Include Synonyms:");
	grid.setWidget(1, 1, includeSynonyms);
	grid.addStyleName("search-options");
	
	CellFormatter cellFormatter = grid.getCellFormatter();
	for(int i = 0; i < grid.getRowCount(); i++) {
		cellFormatter.addStyleName(i, 0, "search-option");
	}
	
	Panel panel = new FlowPanel();
	panel.add(label);
	panel.add(grid);
    return panel;
}
 
Example 4
Project: google-gin   File: DefaultCardGrid.java   View source code 6 votes vote down vote up
@Inject
public DefaultCardGrid(@BackOfCard Provider<Image> backOfCard,
    @Rows int rows, @Columns int columns) {
  // we use a Provider to avoid weird results with duplicate images in Grid
  this.backOfCard = backOfCard;
  this.grid = new Grid(rows, columns);

  this.rows = rows;
  this.columns = columns;
  
  grid.addStyleName("cardGrid");

  reset();

  initWidget(grid);
}
 
Example 5
Project: riscoss-corporate   File: ConfigImportModule.java   View source code 6 votes vote down vote up
private void loadLayoutStructure() {
	
	page = new VerticalPanel();
	mainView = new HorizontalPanel();
	leftPanel = new VerticalPanel();
	
	mainView.setStyleName("mainViewLayer");
	mainView.setWidth("100%");
	leftPanel.setStyleName("leftPanelLayer");
	leftPanel.setWidth("700px");
	page.setWidth("100%");
	
	Label title = new Label("Import configuration");
	title.setStyleName("title");
	
	//Main layout
	page.add(title);
	page.add(mainView);
	
	//Left layout
	mainView.add(leftPanel);
	grid = new Grid(1,2);
	grid.setCellPadding(5);
	leftPanel.add(grid);
}
 
Example 6
Project: riscoss-corporate   File: EntityDataBox.java   View source code 6 votes vote down vote up
protected void showRiskData( JsonRiskDataList list ) {
		VerticalPanel p = new VerticalPanel();
		p.setWidth("100%");
		Grid grid = new Grid( list.size(), 2 );
//		grid.getColumnFormatter().setWidth(0, "20%");
//		grid.getColumnFormatter().setWidth(1, "80%");
		for( int i = 0; i < list.size(); i++ ) {
			JsonRiskDataList.RiskDataItem item = list.get( i );
			grid.setWidget( i, 0, new Label( item.getId() ) );
			grid.setWidget( i, 1, new Label( item.getValue() ) );
		}
		Label title = new Label(entity);
		title.setStyleName("smallTitle");
		p.add(title);
		p.add(grid);
		panel.setWidget( p );
	}
 
Example 7
Project: riscoss-corporate   File: PreferenceMatrix.java   View source code 6 votes vote down vote up
public void loadValues( ArrayList<JAHPComparison> list ) {
	if( container.getWidget() != null ) {
		container.getWidget().removeFromParent();
	}
	Grid grid = new Grid( 0, 3 );
	int i = 0;
	for( JAHPComparison c : list ) {
		if( c.getId1().equals( c.getId2() ) ) continue;
		grid.resize( grid.getRowCount() +1, 3 );
		
		ComparisonRow row = new ComparisonRow( c );
		grid.setWidget( i, 0, row.getLeftWidget() );
		grid.setWidget( i, 1, row.getSlider() );
		grid.setWidget( i, 2, row.getRightWidget() );
		
		i++;
	}
	this.preferences = list;
	container.setWidget( grid );
}
 
Example 8
Project: firefly   File: WebMouseReadoutPerm.java   View source code 6 votes vote down vote up
private void reinitGridSize(int rows) {
        totalRows = rows+1;
//        scaleDisplayPos = totalRows;
        gridList.clear();

        gridPanel.clear();
        int gridCnt= totalRows / 2 + totalRows%2;
        for(int i=0; i<gridCnt; i++) {
            Grid g= new Grid(2,2);
            for (int r = 0; (r < 2); r++) {
                g.getCellFormatter().setHorizontalAlignment(r, LABEL_IDX, HasHorizontalAlignment.ALIGN_RIGHT);
            }
            GwtUtil.setStyles(g, "lineHeight", "1",
                                 "display", "inline-block" );

            gridList.add(g);
            gridPanel.add(g);
        }
    }
 
Example 9
Project: gerrit   File: Screen.java   View source code 6 votes vote down vote up
protected void onInitUI() {
  final FlowPanel me = (FlowPanel) getWidget();
  me.add(header = new Grid(1, Cols.values().length));
  me.add(body);

  headerText = new InlineLabel();
  if (titleWidget == null) {
    titleWidget = headerText;
  }
  FlowPanel title = new FlowPanel();
  title.add(titleWidget);
  title.setStyleName(Gerrit.RESOURCES.css().screenHeader());
  header.setWidget(0, Cols.Title.ordinal(), title);

  header.setStyleName(Gerrit.RESOURCES.css().screenHeader());
  header
      .getCellFormatter()
      .setHorizontalAlignment(0, Cols.FarEast.ordinal(), HasHorizontalAlignment.ALIGN_RIGHT);
  // force FarEast all the way to the right
  header.getCellFormatter().setWidth(0, Cols.FarEast.ordinal(), "100%");
}
 
Example 10
Project: mvp4g-examples   File: AbstractProductView.java   View source code 6 votes vote down vote up
public void createView() {
	leftButton = new Button( getLeftButtonName() );
	rightButton = new Button( getRightButtonName() );

	Grid grid = new Grid( 2, 2 );
	grid.setText( 0, 0, "Name :" );
	grid.setWidget( 0, 1, createAndGetNameWidget() );

	HorizontalPanel buttons = new HorizontalPanel();
	buttons.add( leftButton );
	buttons.add( rightButton );

	grid.setWidget( 1, 1, buttons );

	setWidget( grid );
}
 
Example 11
Project: mvp4g-examples   File: AbstractCompanyView.java   View source code 6 votes vote down vote up
public void createView() {
	selectButton = new Button( "Select Name");
	leftButton = new Button( getLeftButtonName() );
	rightButton = new Button( getRightButtonName() );

	Grid grid = new Grid( 2, 2 );
	grid.setText( 0, 0, "Name :" );
	grid.setWidget( 0, 1, createAndGetNameWidget() );

	HorizontalPanel buttons = new HorizontalPanel();
	buttons.add( selectButton );
	buttons.add( leftButton );
	buttons.add( rightButton );

	grid.setWidget( 1, 1, buttons );

	initWidget( grid );
}
 
Example 12
Project: mvp4g-examples   File: UserCreateView.java   View source code 6 votes vote down vote up
public UserCreateView() {

		id = new Label();
		lastName = new TextBox();
		firstName = new TextBox();

		Grid grid = new Grid( 3, 2 );
		grid.setText( 0, 0, "Last Name: " );
		grid.setText( 1, 0, "First Name: " );
		grid.setWidget( 0, 1, lastName );
		grid.setWidget( 1, 1, firstName );

		create = new Button( "Create" );

		VerticalPanel mainPanel = new VerticalPanel();
		mainPanel.add( grid );
		mainPanel.add( create );

		initWidget( mainPanel );
	}
 
Example 13
Project: mvp4g-examples   File: UserDisplayView.java   View source code 6 votes vote down vote up
public UserDisplayView() {

		id = new Label();
		lastName = new Label();
		firstName = new Label();

		Grid grid = new Grid( 3, 2 );
		grid.setText( 0, 0, "Last Name: " );
		grid.setText( 1, 0, "First Name: " );
		grid.setText( 2, 0, "Generated Id: " );
		grid.setWidget( 0, 1, lastName );
		grid.setWidget( 1, 1, firstName );
		grid.setWidget( 2, 1, id );

		create = new Button( "New" );

		VerticalPanel mainPanel = new VerticalPanel();
		mainPanel.add( grid );
		mainPanel.add( create );

		initWidget( mainPanel );
	}
 
Example 14
Project: qafe-platform   File: RendererHelper.java   View source code 6 votes vote down vote up
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
	if (vo != null && ui != null) {
		if (vo.getMenu() != null) {
			MenuBar menu = new MenuBar();
			menu.setAutoOpen(true);
			menu.setWidth("100%");
			UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), uuid, parent, vo.getContext());
			if (renderedComponent instanceof MenuBar) {
				menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
			} else if (renderedComponent instanceof MenuItem) {
				menu.addItem((MenuItem) renderedComponent);
			}
			if (ui instanceof DockPanel) {
				((DockPanel) ui).add(menu, DockPanel.NORTH);
			} else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
				((Panel) ui).add(menu);
		}
	}

}
 
Example 15
Project: qafe-platform   File: BuiltinHandlerHelper.java   View source code 6 votes vote down vote up
private static String getValue(FormPanel formPanel) {
	String value = null;
	
       if (formPanel instanceof HasWidgets) {
           HasWidgets hasWidgets = formPanel;
           Iterator<Widget> itr = hasWidgets.iterator();
           while (itr.hasNext()) {
               Widget widget = itr.next();
               if (widget instanceof Grid) {
                   Grid gridPanel = (Grid) widget;
                   FileUpload fileUpload = (FileUpload) gridPanel.getWidget(0, 0);
                   value = DOM.getElementAttribute(fileUpload.getElement(), "fu-uuid");
                   handleSimpleValue(formPanel, value);
               }
           }
       }
       
       return value;
}
 
Example 16
Project: qafe-platform   File: RendererHelper.java   View source code 6 votes vote down vote up
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
	if (vo != null && ui != null) {
		if (vo.getMenu() != null) {
			MenuBar menu = new MenuBar();
			menu.setAutoOpen(true);
			menu.setWidth("100%");
			UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), null, uuid, parent, vo.getContext(), null);
			if (renderedComponent instanceof MenuBar) {
				menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
			} else if (renderedComponent instanceof MenuItem) {
				menu.addItem((MenuItem) renderedComponent);
			}
			if (ui instanceof DockPanel) {
				((DockPanel) ui).add(menu, DockPanel.NORTH);
			} else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
				((Panel) ui).add(menu);
		}
	}

}
 
Example 17
Project: GraphemeColourSynaesthesiaApp   File: SimpleView.java   View source code 6 votes vote down vote up
public SimpleView() {
        headerPanel = new Grid(1, 3);
        headerPanel.setWidth("100%");
        headerPanel.setStylePrimaryName("headerPanel");
        footerPanel = new HorizontalPanel();
        borderedContentPanel = new VerticalPanel();
        borderedContentPanel.setStylePrimaryName("contentPanel");
        footerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        addNorth(headerPanel, 50);
//        addSouth(footerPanel, 50);
        scrollPanel = new ScrollPanel();
        borderedContentPanel.add(scrollPanel);
        borderedContentPanel.add(footerPanel);
        footerPanel.setVisible(false);
        add(borderedContentPanel);
    }
 
Example 18
Project: GraphemeColourSynaesthesiaApp   File: ColourPickerTableView.java   View source code 6 votes vote down vote up
public ColourPickerTableView() {
    Grid grid = new Grid(50, 50);
    grid.setBorderWidth(0);
    grid.setCellPadding(0);
    grid.setCellSpacing(0);
    final double columnCount = grid.getColumnCount();
    final double rowCount = grid.getRowCount();
    for (int row = 0; row < rowCount; row++) {
        for (int column = 0; column < columnCount; column++) {
            final Element element = grid.getCellFormatter().getElement(row, column);
            final int rowValue = 255 - (int) (row / (rowCount - 1) * 255);
            final int columnValue = (int) (column / (columnCount - 1) * 255);
            final int colourValue = (int) (columnValue * (1 - row / (rowCount - 1)));
            element.setAttribute("style", "height:5px;width:5px;border:0px none;font-size:1px;color:#FFFFFF;background:rgb(" + colourValue + "," + rowValue + "," + rowValue + ")");
        }
    }
    add(grid);
}
 
Example 19
Project: swcv   File: WordCloudLatestApp.java   View source code 6 votes vote down vote up
private Grid createStatTable(DBStatistics result)
{
    Grid table = new Grid(3, 2);
    table.addStyleName("stat");

    table.setHTML(0, 0, "the number of clouds <b>in total</b>");
    table.setHTML(1, 0, "the number of clouds constructed <b>last month</b>");
    table.setHTML(2, 0, "the number of clouds constructed <b>last week</b>");

    table.setHTML(0, 1, "" + result.getTotal());
    table.setHTML(1, 1, "" + result.getLastMonth());
    table.setHTML(2, 1, "" + result.getLastWeek());

    CellFormatter cf = table.getCellFormatter();
    cf.setWidth(0, 0, "65%");
    cf.setWidth(0, 1, "35%");
    return table;
}
 
Example 20
Project: sigmah   File: HistoryWrapper.java   View source code 6 votes vote down vote up
/**
 * Wrap the given field.
 * 
 * @param field Field to wrap.
 */
public HistoryWrapper(Field<V> field) {
	super(new FlowPanel());
	this.field = field;
	
	final Grid grid = new Grid(1, 2);
	((FlowPanel)getWidget()).add(grid);
	
	historyButton = Forms.button();
	historyButton.setIcon(IconImageBundle.ICONS.history16());
	
	grid.setWidget(0, 0, field);
	grid.setWidget(0, 1, historyButton);
	grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);
	
	grid.getCellFormatter().setStyleName(0, 1, "flexibility-action-iconable");
}
 
Example 21
Project: sigmah   File: ProjectView.java   View source code 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public HTMLTable buildBannerTable(final int rows, final int cols) {

	final Grid gridLayout = new Grid(rows, cols);
	gridLayout.addStyleName(ProjectView.STYLE_HEADER_BANNER_FLEX);
	gridLayout.setCellPadding(0);
	gridLayout.setCellSpacing(0);
	gridLayout.setWidth("100%");
	gridLayout.setHeight("100%");

	for (int i = 0; i < gridLayout.getColumnCount() - 1; i++) {
		gridLayout.getColumnFormatter().setWidth(i, "325px");
	}

	return gridLayout;
}
 
Example 22
Project: sigmah   File: ProjectView.java   View source code 6 votes vote down vote up
/**
 * Creates the project banner panel.
 *
 * @return The project banner panel.
 */
private Component createProjectBannerPanel() {

	// Main panel.
	projectBannerPanel = Panels.content(I18N.CONSTANTS.loading()); // Temporary title.

	// Main grid.
	projectBannerGrid = new Grid(1, 2);
	projectBannerGrid.addStyleName(STYLE_HEADER_BANNER);
	projectBannerGrid.setCellPadding(0);
	projectBannerGrid.setCellSpacing(0);
	projectBannerGrid.setWidth("100%");
	projectBannerGrid.setHeight("100%");

	// Logo cell style.
	projectBannerGrid.getCellFormatter().setStyleName(HEADER_BANNER_LOGO_CELL.left, HEADER_BANNER_LOGO_CELL.right, STYLE_HEADER_BANNER_LOGO);

	projectBannerPanel.add(projectBannerGrid);

	return projectBannerPanel;
}
 
Example 23
Project: sigmah   File: EditFlexibleElementAdminView.java   View source code 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void addUndeletableCustomChoice(final String value, boolean checked, final Listener<FieldEvent> disableHandler) {
	
	final ClickableLabel customChoiceLabel = new ClickableLabel(value);
	final Grid grid = (Grid) customChoiceLabel.getWidget();
	
	final CheckBox checkBox = new CheckBox();
	checkBox.setValue(checked);
	grid.setWidget(0, 0, checkBox);

	if(disableHandler != null) {
		checkBox.addListener(Events.Change, disableHandler);
	}

	customChoicesPanel.add(customChoiceLabel);
}
 
Example 24
Project: sigmah   File: OrgUnitView.java   View source code 6 votes vote down vote up
/**
 * Creates the OrgUnit banner panel.
 * 
 * @return The OrgUnit banner panel.
 */
private Component createOrgUnitBannerPanel() {

	// Main panel.
	orgUnitBannerPanel = Panels.content(I18N.CONSTANTS.orgunit()); // Temporary title.

	// Main grid.
	orgUnitBannerGrid = new Grid(1, 2);
	orgUnitBannerGrid.addStyleName(ProjectView.STYLE_HEADER_BANNER);
	orgUnitBannerGrid.setCellPadding(0);
	orgUnitBannerGrid.setCellSpacing(0);
	orgUnitBannerGrid.setWidth("100%");
	orgUnitBannerGrid.setHeight("100%");

	// Logo cell.
	orgUnitBannerGrid.getCellFormatter().setStyleName(HEADER_BANNER_LOGO_CELL.left, HEADER_BANNER_LOGO_CELL.right, ProjectView.STYLE_HEADER_BANNER_LOGO);
	orgUnitBannerGrid.setWidget(HEADER_BANNER_LOGO_CELL.left, HEADER_BANNER_LOGO_CELL.right, OrgUnitImageBundle.ICONS.orgUnitLarge().createImage());

	orgUnitBannerPanel.add(orgUnitBannerGrid);

	return orgUnitBannerPanel;
}
 
Example 25
Project: sigmah   File: OrgUnitView.java   View source code 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public HTMLTable buildBannerTable(final int rows, final int cols) {

	final Grid gridLayout = new Grid(rows, cols);
	gridLayout.addStyleName(ProjectView.STYLE_HEADER_BANNER_FLEX);
	gridLayout.setCellPadding(0);
	gridLayout.setCellSpacing(0);
	gridLayout.setWidth("100%");
	gridLayout.setHeight("100%");

	for (int i = 0; i < gridLayout.getColumnCount() - 1; i++) {
		gridLayout.getColumnFormatter().setWidth(i, "325px");
	}

	return gridLayout;
}
 
Example 26
Project: sigmah   File: ClearableField.java   View source code 6 votes vote down vote up
public ClearableField(final Field<T> field) {
	super(new Grid(1, 2));
	
	setLabelSeparator(field.getLabelSeparator());
	setFieldLabel(field.getFieldLabel());

	this.field = field;
	this.deleteIcon = IconImageBundle.ICONS.deleteIcon().createImage();
	
	Grid grid = (Grid) widget;
	grid.setWidget(0, 0, field);
	grid.setWidget(0, 1, deleteIcon);
	grid.setCellSpacing(1);

	grid.getCellFormatter().setWidth(0, 1, "5px");
	
	addClearHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			field.clear();
		}
	});
}
 
Example 27
Project: ineform   File: ModuleRowListPage.java   View source code 6 votes vote down vote up
private void createAndAddFilterGrid() {
    filterGrid = new Grid(2, 3);

    filterGrid.setHTML(0, 0, translatorappI18n.transPage_moduleSelect());
    moduleListBox =
        new ListBoxFW(
            formCtx,
            new RelationFDesc("", "", ModuleConsts.descriptorName).setNullable(true),
            new WidgetRDesc());
    filterGrid.setWidget(0, 1, moduleListBox);

    massUpload = new IneButton(IneButtonType.ACTION, translatorappI18n.massUpload());
    filterGrid.setWidget(0, 2, massUpload);
    massUpload.setVisible(false);

    filterGrid.setHTML(1, 0, translatorappI18n.rowListPage_magicFilter());
    textBox = new TextBoxFW();
    filterGrid.setWidget(1, 1, textBox);

    filterGrid.getElement().getStyle().setMarginBottom(25, Unit.PX);
    filterGrid.getElement().getStyle().setMarginLeft(5, Unit.PX);
    mainPanel.add(filterGrid);
}
 
Example 28
Project: ineform   File: TranslatorPage.java   View source code 6 votes vote down vote up
private void createAndAddFilterGrid() {
    Grid filterGrid = new Grid(2, 2);

    filterGrid.setHTML(0, 0, translatorappI18n.transPage_listmodeSelect());
    listTypeRadioButton =
        new RadioEnumSelectorFW(
            new LongFDesc().setNullable(false),
            TranslateListingType.getValuesAsString(),
            new WidgetRDesc());
    filterGrid.setWidget(0, 1, listTypeRadioButton);

    filterGrid.setHTML(1, 0, translatorappI18n.transPage_moduleSelect());
    moduleListBox =
        new ListBoxFW(
            formCtx,
            new RelationFDesc("", "", ModuleConsts.descriptorName).setNullable(true),
            new WidgetRDesc());
    filterGrid.setWidget(1, 1, moduleListBox);

    filterGrid.getElement().getStyle().setMarginBottom(25, Unit.PX);
    filterGrid.getElement().getStyle().setMarginLeft(5, Unit.PX);
    filterGrid.getElement().getStyle().setHeight(90, Unit.PX);
    filterGrid.getElement().getStyle().setWidth(700, Unit.PX);
    mainPanel.add(filterGrid);
}
 
Example 29
Project: ineform   File: CaptchaWidget.java   View source code 6 votes vote down vote up
private void buildStructure(Rendering rendering) {
    switch (rendering) {
        case HORIZONTAL:
            Grid g = new Grid(1, 2);
            g.setWidget(0, 0, tb);
            g.setWidget(0, 1, img);
            initWidget(g);

            g.setCellSpacing(0);
            g.setCellPadding(0);
            g.setBorderWidth(0);
            break;
        case VERTICAL:
        default:
            FlowPanel fp = new FlowPanel();
            fp.add(img);
            fp.add(tb);
            initWidget(fp);

            setPixelSize(150, 80);
            break;
    }
}
 
Example 30
Project: LanguageMemoryApp   File: ColourPickerTableView.java   View source code 6 votes vote down vote up
public ColourPickerTableView() {
    Grid grid = new Grid(50, 50);
    grid.setBorderWidth(0);
    grid.setCellPadding(0);
    grid.setCellSpacing(0);
    final double columnCount = grid.getColumnCount();
    final double rowCount = grid.getRowCount();
    for (int row = 0; row < rowCount; row++) {
        for (int column = 0; column < columnCount; column++) {
            final Element element = grid.getCellFormatter().getElement(row, column);
            final int rowValue = 255 - (int) (row / (rowCount - 1) * 255);
            final int columnValue = (int) (column / (columnCount - 1) * 255);
            final int colourValue = (int) (columnValue * (1 - row / (rowCount - 1)));
            element.setAttribute("style", "height:5px;width:5px;border:0px none;font-size:1px;color:#FFFFFF;background:rgb(" + colourValue + "," + rowValue + "," + rowValue + ")");
        }
    }
    add(grid);
}
 
Example 31
Project: LanguageMemoryApp   File: SimpleView.java   View source code 6 votes vote down vote up
public SimpleView() {
        headerPanel = new Grid(1, 3);
        headerPanel.setWidth("100%");
        headerPanel.setStylePrimaryName("headerPanel");
        footerPanel = new HorizontalPanel();
        borderedContentPanel = new VerticalPanel();
        borderedContentPanel.setStylePrimaryName("contentPanel");
        footerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        addNorth(headerPanel, HEADER_SIZE);
//        addSouth(footerPanel, 50);
        scrollPanel = new ScrollPanel();
        borderedContentPanel.add(scrollPanel);
        borderedContentPanel.add(footerPanel);
        footerPanel.setVisible(false);
        add(borderedContentPanel);
    }
 
Example 32
Project: QMAClone   File: InputWidgetMojiPanel.java   View source code 6 votes vote down vote up
public InputWidgetMojiPanel(PacketProblem problem, AnswerView answerView,
		QuestionPanel questionPanel, SessionData sessionData) {
	super(problem, answerView, questionPanel, sessionData);
	this.answerLength = problem.shuffledAnswers[0].length();

	String choice = problem.choices[0];
	int numberOfChoices = choice.length();
	int perm[] = Random.get().makePermutationArray(numberOfChoices);
	Grid grid = new Grid(2, numberOfChoices / 2);

	for (int i = 0; i < numberOfChoices; ++i) {
		ButtonLetter button = new ButtonLetter(choice.substring(perm[i], perm[i] + 1),
				answerView);
		buttons.add(button);
		button.setStyleName("gwt-Button-mojipanel");
		button.addClickHandler(this);
		grid.setWidget(i / (numberOfChoices / 2), i % (numberOfChoices / 2), button);
	}

	add(grid);
	add(new HTML("上記から" + answerLength + "文字を選んで答えてください<br/>同じ文字を何度でも使えます"));
}
 
Example 33
Project: QMAClone   File: PanelReadyForGame.java   View source code 6 votes vote down vote up
public void setPlayerList(List<PacketMatchingPlayer> players) {
	final Grid grid = new Grid(players.size(), 3);
	grid.addStyleName("gridFrame");
	grid.addStyleName("gridFontNormal");

	for (int row = 0; row < players.size(); ++row) {
		final PacketMatchingPlayer player = players.get(row);
		final Image image = new Image(Constant.ICON_URL_PREFIX + player.imageFileName);
		image.setPixelSize(Constant.ICON_SIZE, Constant.ICON_SIZE);

		grid.setWidget(row, 0, image);
		grid.setHTML(row, 1, player.playerSummary.asSafeHtml());
		grid.setText(row, 2, player.greeting);
	}

	panelGrid.setWidget(grid);
}
 
Example 34
Project: Peergos   File: CwRichText.java   View source code 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Create the text area and toolbar
  RichTextArea area = new RichTextArea();
  area.ensureDebugId("cwRichText-area");
  area.setSize("100%", "14em");
  RichTextToolbar toolbar = new RichTextToolbar(area);
  toolbar.ensureDebugId("cwRichText-toolbar");
  toolbar.setWidth("100%");

  // Add the components to a panel
  Grid grid = new Grid(2, 1);
  grid.setStyleName("cw-RichText");
  grid.setWidget(0, 0, toolbar);
  grid.setWidget(1, 0, area);
  return grid;
}
 
Example 35
Project: Peergos   File: CwGrid.java   View source code 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Create a grid
  Grid grid = new Grid(4, 4);

  // Add images to the grid
  int numRows = grid.getRowCount();
  int numColumns = grid.getColumnCount();
  for (int row = 0; row < numRows; row++) {
    for (int col = 0; col < numColumns; col++) {
      grid.setWidget(row, col, new Image(Showcase.images.gwtLogo()));
    }
  }

  // Return the panel
  grid.ensureDebugId("cwGrid");
  return grid;
}
 
Example 36
Project: solr-explorer   File: SpellcheckSearchContextComponent.java   View source code 6 votes vote down vote up
public SpellcheckSearchContextComponent() {
    super("Spellchecking");

    grid = new Grid(6, 2);
    grid.setHTML(0, 0, "<b>Enabled</b>");
    grid.setHTML(1, 0, "<b>Dictionary</b>");
    grid.setHTML(2, 0, "<b>Count</b>");
    grid.setHTML(3, 0, "<b>Only More Popular</b>");
    grid.setHTML(4, 0, "<b>Collate</b>");

    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_CENTER);

    main.setContent(grid);
}
 
Example 37
Project: solr-explorer   File: HighlightSearchContextComponent.java   View source code 6 votes vote down vote up
public HighlightSearchContextComponent() {
    super("Highlighting");

    grid = new Grid(4, 2);
    grid.setHTML(0, 0, "<b>Enabled</b>");
    grid.setHTML(1, 0, "<b>Fields</b>");
    grid.setHTML(2, 0, "<b>Prefix</b>");
    grid.setHTML(3, 0, "<b>Suffix</b>");

    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER);

    main.setContent(grid);
}
 
Example 38
Project: solr-explorer   File: CommonSearchContextComponent.java   View source code 6 votes vote down vote up
public CommonSearchContextComponent() {
    super("Common");

    grid = new Grid(4, 2);
    grid.setHTML(0, 0, "<b>Text Query</b>");
    grid.setHTML(1, 0, "<b>Page Index</b>");
    grid.setHTML(2, 0, "<b>Page Size</b>");
    grid.setHTML(3, 0, "<b>Sort</b>");

    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER);
    grid.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER);

    main.setContent(grid);
}
 
Example 39
Project: swarm   File: CwRichText.java   View source code 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Create the text area and toolbar
  RichTextArea area = new RichTextArea();
  area.ensureDebugId("cwRichText-area");
  area.setSize("100%", "14em");
  RichTextToolbar toolbar = new RichTextToolbar(area);
  toolbar.ensureDebugId("cwRichText-toolbar");
  toolbar.setWidth("100%");

  // Add the components to a panel
  Grid grid = new Grid(2, 1);
  grid.setStyleName("cw-RichText");
  grid.setWidget(0, 0, toolbar);
  grid.setWidget(1, 0, area);
  return grid;
}
 
Example 40
Project: swarm   File: CwGrid.java   View source code 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Create a grid
  Grid grid = new Grid(4, 4);

  // Add images to the grid
  int numRows = grid.getRowCount();
  int numColumns = grid.getColumnCount();
  for (int row = 0; row < numRows; row++) {
    for (int col = 0; col < numColumns; col++) {
      grid.setWidget(row, col, new Image(Showcase.images.gwtLogo()));
    }
  }

  // Return the panel
  grid.ensureDebugId("cwGrid");
  return grid;
}