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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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 41
Project: jcommerce   File: PrintTemplatePanel.java   Source Code and License 6 votes vote down vote up
protected void onRender(Element parent, int index) {
        super.onRender(parent, index);
        
        final RichTextArea area = new RichTextArea();
        area.setSize("1000", "600");
        new OrderService().getOrderTemplate(new OrderService.Listener() {
            public void onSuccess(String content) {
                area.setHTML(content);
            }
        });
        RichTextToolbar toolbar = new RichTextToolbar(area);
//        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);
//        grid.setSize("100%", "100%");
        add(grid);
        
        Button button = new Button("Save");
        add(button);
    }
 
Example 42
Project: empiria.player   File: SelectionModuleViewImplTest.java   Source Code and License 5 votes vote down vote up
@Before
public void setup() {
    gridGenerator = mock(SelectionElementGenerator.class);

    selectionView = new SelectionModuleViewImpl(gridGenerator);

    selectionView.selectionGrid = grid = mock(Grid.class);
    selectionView.mainPanel = panel = mock(Panel.class);
    selectionView.promptWidget = mock(Widget.class);
    clickHandler = mock(ClickHandler.class);
    firstButtonGridElement = mock(SelectionButtonGridElementImpl.class);
    secondButtonGridElement = mock(SelectionButtonGridElementImpl.class);
}
 
Example 43
Project: EasyML   File: PropertyTable.java   Source Code and License 5 votes vote down vote up
public PropertyTable(int rows, int cols) {
	super();

	grid = new Grid(rows, cols);
	vp = new VerticalPanel();
	this.setAlwaysShowScrollBars(false);
	this.setSize("100%", "80%");
	vp.setBorderWidth(0);
	vp.add(grid);
	this.add(vp);
	properties = new HashMap<Property, Label>();
}
 
Example 44
Project: appinventor-extensions   File: CopyYoungAndroidProjectCommand.java   Source Code and License 5 votes vote down vote up
private Widget createPreviousCheckpointsTable(List<Project> checkpointProjects) {
  Grid table = new Grid(1 + checkpointProjects.size(), 3);
  table.addStyleName("ode-ProjectTable");

  // Set the widgets for the header row.
  table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
  table.setWidget(0, 0, new Label(MESSAGES.projectNameHeader()));
  table.setWidget(0, 1, new Label(MESSAGES.projectDateCreatedHeader()));
  table.setWidget(0, 2, new Label(MESSAGES.projectDateModifiedHeader()));

  // Set the widgets for the rows representing previous checkpoints
  DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
  int row = 1;
  for (Project checkpointProject : checkpointProjects) {
    table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
    Label nameLabel = new Label(checkpointProject.getProjectName());
    table.setWidget(row, 0, nameLabel);

    Date dateCreated = new Date(checkpointProject.getDateCreated());
    table.setWidget(row, 1, new Label(dateTimeFormat.format(dateCreated)));

    Date dateModified = new Date(checkpointProject.getDateModified());
    table.setWidget(row, 2, new Label(dateTimeFormat.format(dateModified)));
    row++;
  }

  return table;
}
 
Example 45
Project: appinventor-extensions   File: ProjectList.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new ProjectList
 */
public ProjectList() {
  projects = new ArrayList<Project>();
  selectedProjects = new ArrayList<Project>();
  projectWidgets = new HashMap<Project, ProjectWidgets>();

  sortField = SortField.DATE_MODIFIED;
  sortOrder = SortOrder.DESCENDING;

  // Initialize UI
  table = new Grid(1, 5); // The table initially contains just the header row.
  table.addStyleName("ode-ProjectTable");
  table.setWidth("100%");
  table.setCellSpacing(0);
  nameSortIndicator = new Label("");
  dateCreatedSortIndicator = new Label("");
  dateModifiedSortIndicator = new Label("");
  publishedSortIndicator = new Label("");
  refreshSortIndicators();
  setHeaderRow();

  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");

  panel.add(table);
  initWidget(panel);

  // It is important to listen to project manager events as soon as possible.
  Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);

  gallery = GalleryClient.getInstance();
}
 
Example 46
Project: appinventor-extensions   File: ComponentImportWizard.java   Source Code and License 5 votes vote down vote up
private Grid createUrlGrid() {
  TextBox urlTextBox = new TextBox();
  urlTextBox.setWidth("100%");
  Grid grid = new Grid(2, 1);
  grid.setWidget(0, 0, new Label("Url:"));
  grid.setWidget(1, 0, urlTextBox);
  return grid;
}
 
Example 47
Project: WebConsole   File: SliderComponent.java   Source Code and License 5 votes vote down vote up
public SlideBar() {
	Element element = getElement();
	this.setWidth("100%");
	this.setHeight("100%");
	this.setStylePrimaryName(BAR_CLASS_NAME);
	DOM.setStyleAttribute(element, "overflow", "hidden");
	BrowserUtils.setStyleAttributeAllBrowsers(element, "boxSizing", "border-box");
	
	track = new Grid();

	track.setWidth("100%");
	track.setHeight("100%");
	track.setStylePrimaryName(TRACK_CLASS_NAME);

	BrowserUtils.setStyleAttributeAllBrowsers(track.getElement(), "boxSizing", "border-box");
	minTrack = new TrackMinMax();
	minTrack.setHeight("100%");
	minTrack.setWidth("100%");
	minTrack.setStylePrimaryName(TRACK_CLASS_NAME + "Min");
	BrowserUtils.setStyleAttributeAllBrowsers(minTrack.getElement(), "boxSizing", "border-box");
	maxTrack = new TrackMinMax();
	maxTrack.setHeight("100%");
	maxTrack.setWidth("100%");
	maxTrack.setStylePrimaryName(TRACK_CLASS_NAME + "Max");
	BrowserUtils.setStyleAttributeAllBrowsers(maxTrack.getElement(), "boxSizing", "border-box");
	
	this.add(track,0,0);
	
	if (!isPassive)
	{
		this.addStyleName(INTERACTIVE_CLASS_NAME);
	}
}
 
Example 48
Project: WebConsole   File: SliderComponent.java   Source Code and License 5 votes vote down vote up
private SliderComponent(Boolean isVertical, Boolean isPassive) {
	// Define container widget
	super(new Grid(), CLASS_NAME);
	
	if (isVertical != null && isVertical) {
		this.isVertical = isVertical;
		this.addStyleName("vertical");
	}
	
	if (isPassive != null && isPassive) {
		this.isPassive = true;
	}
	
	// Define child components
	slideBar = new SlideBar();
	this.setWidth("100%");
	this.setHeight("100%");
	thumb = new Thumb();
	((AbsolutePanel)slideBar).add(thumb,0,0);
	minButton = new MinButton();
	BrowserUtils.setStyleAttributeAllBrowsers(minButton.getElement(), "boxSizing", "border-box");
	maxButton = new MaxButton();
	BrowserUtils.setStyleAttributeAllBrowsers(maxButton.getElement(), "boxSizing", "border-box");
	
	addInteractiveChild(thumb);
	addInteractiveChild(minTrack);
	addInteractiveChild(maxTrack);
	addInteractiveChild(minButton);
	addInteractiveChild(maxButton);	
	
}
 
Example 49
Project: LAS   File: LatLonWidget.java   Source Code and License 5 votes vote down vote up
/**
	 * Constructs an empty widget.
	 */
	public LatLonWidget() {
		panel = new Grid(1,3);
		middle = new VerticalPanel();
		
		rose = new Image(GWT.getModuleBaseURL()+"../images/compass_rose.png");
		rose.addStyleName("OL_MAP-middle");

		southLat = new TextBox();
		northLat = new TextBox();

		southLat.setWidth(boxWidth);
		northLat.setWidth(boxWidth);

		eastLon = new TextBox();
		westLon = new TextBox();

		eastLon.setWidth(boxWidth);
		westLon.setWidth(boxWidth);
        
		panel.setWidget(0, 0, westLon);	
		middle.add(northLat);
		middle.add(rose);
		middle.add(southLat);
		panel.setWidget(0, 1, middle);
		panel.setWidget(0, 2, eastLon);
//		panel.getFlexCellFormatter().setColSpan(2, 0, 2);
		
		initWidget(panel);
	}
 
Example 50
Project: demo-gwt-springboot   File: LoadingMessagePopupPanel.java   Source Code and License 5 votes vote down vote up
@Inject
public LoadingMessagePopupPanel(Messages messages, Asset asset) {
	final Image ajaxImage = new Image(asset.loadingIcon());
	final Grid grid = new Grid(1, 3);
	grid.setWidget(0, 0, ajaxImage);
	grid.setText(0, 2, messages.loadingMessage_message());
	this.container.add(grid);
	add(this.container);
}
 
Example 51
Project: Wiab.pro   File: SimpleColorPicker.java   Source Code and License 5 votes vote down vote up
/**
 * Instantiates a new simple color picker.
 *
 * @param colopicker the colopicker
 */
public SimpleColorPicker(ComplexColorPicker colopicker) {
  super(colopicker);
  style.ensureInjected();

  final Grid grid = new Grid(ROWS, COLS);
  grid.setCellSpacing(0);
  grid.getRowFormatter().getElement(0).addClassName(style.firstRow());
  grid.getRowFormatter().getElement(1).addClassName(style.firstRow());
  int row;
  int col;
  int num = 0;
  for (final String c : COLORS) {
    row = num / COLS;
    col = num % COLS;
    grid.setWidget(row, col, createCell(c));
    num++;
  }
  grid.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
          Cell cell = grid.getCellForEvent(event);
          if (cell != null) {
            String color = COLORS[cell.getRowIndex() * COLS + cell.getCellIndex()];
            onColorChoose(color);
          }
        }
      });
  grid.addStyleName(style.grid());
  initWidget(grid);
}
 
Example 52
Project: che   File: NotificationContainer.java   Source Code and License 5 votes vote down vote up
/**
 * Create notification container.
 *
 * @param resources core resources
 */
@Inject
public NotificationContainer(Resources resources) {
  this.resources = resources;

  nGrid = new Grid(0, 1);
  nGrid.setStyleName(resources.notificationCss().notificationPanelContainer());
  add(nGrid);
}
 
Example 53
Project: easy-vote   File: BallotWidget.java   Source Code and License 5 votes vote down vote up
public BallotWidget(BallotSheetView bsv, EasyVoteAsyncCallback<Void> cb) {
	electionInfo = new VerticalPanel();
	this.add(electionInfo);
	
	electionIdLabel = new Label("Election id: " + bsv.getElectionId());
	electionInfo.add(electionIdLabel);
	
	electionQuestion = new Label(bsv.getQuestion());
	this.add(electionQuestion);
	
	squares = new ArrayList<RadioButton>();
	callback = cb;
	List<CandidateView> candidateList = bsv.getCandidates();
	
	optionsTable = new Grid(candidateList.size()+1, 2);
	optionsTable.addStyleName("BallotWidget-optionsTable");
	for (int i = 0; i < candidateList.size(); i++) {
		optionsTable.getCellFormatter().addStyleName(i, 0, "BallotWidget-optionsTableCells");
		optionsTable.getCellFormatter().addStyleName(i, 1, "BallotWidget-optionsTableCells");
		optionsTable.getCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER);
		
		optionsTable.setText(i, 0, candidateList.get(i).getName());
		RadioButton button = new RadioButton("candidates");
		squares.add(button);
		optionsTable.setWidget(i, 1, button);
	}
	this.add(optionsTable);
	
	submitVoteButton = new Button("Submit Vote");
	submitVoteButton.addStyleName("BallotWidget-submitVoteButton");
	submitVoteButton.addClickHandler(new SubmitHandler());
	this.add(submitVoteButton);
	
	submitBlankVoteButton = new Button("Submit Blank Vote");
	submitBlankVoteButton.addStyleName("BallotWidget-submitVoteButton");
	submitBlankVoteButton.addClickHandler(new SubmitBlankHandler());
	this.add(submitBlankVoteButton);
	
	this.addStyleName("easyvote-BallotWidget");
}
 
Example 54
Project: riscoss-corporate   File: MissingDataInputForm.java   Source Code and License 5 votes vote down vote up
public void load( JSONObject missingData ) {
	
	JSONArray array = missingData.get( "list" ).isArray();
	
	Grid grid = new Grid( array.size() +1, 2 );
	
	for( int i = 0; i < array.size(); i++ ) {
		JSONObject o = array.get( i ).isObject();
		String name = o.get( "question" ).isString().stringValue();
		grid.setWidget( i, 0, new Label( name ) );
		ManualInputField inputField = new ManualInputField( new JsonInputChunk( o ) );
		textboxes.put( o.get( "id" ).isString().stringValue(), inputField );
		grid.setWidget( i, 1, inputField );
	}
	
	grid.setWidget( array.size(), 1, new Button( "Continue", new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			gatherUserEnteredDataAndRunAgain();
		}
	} ) );
	
	dialog = new DialogBox( false, false );
	dialog.setText( "Enter missing data" );
	
	dialog.setWidget( grid );
}
 
Example 55
Project: riscoss-corporate   File: PreferenceMatrix.java   Source Code and License 5 votes vote down vote up
public void insertRow (JAHPComparison c) {
	Grid grid = (Grid) container.getWidget();
	int i = grid.getRowCount();
	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() );
}
 
Example 56
Project: firefly   File: FitsHeaderDialog.java   Source Code and License 5 votes vote down vote up
private void loadTableIntoPanel(DataSet ds, double pixScale, long fileSize){
        //set column widths
        List<BaseTableData.RowData> rows = ds.getModel().getRows();
        int rowLength = 170;
        int dataLength;
        String rowValue;
        for(BaseTableData.RowData row : rows){
            rowValue = row.getValue(3);
            dataLength = rowValue.length()*6;
            //set column width to size of text
            if(dataLength > rowLength){
                rowLength = dataLength;
            }
        }

        TableDataView.Column c = ds.getColumn(0);
        c.setWidth(25);
        c = ds.getColumn(1);
        c.setWidth(100);
        c = ds.getColumn(2);
        c.setWidth(100);
        c = ds.getColumn(3);
        c.setWidth(rowLength);

        BasicTable table = new BasicTable(ds);
        table.setSize("470px", "375px");
        
//        String[] str = values.split(";");
        Grid grid = new Grid (1,2);
        HTMLTable.ColumnFormatter colF = grid.getColumnFormatter();
        colF.setWidth(0, "200px");
        grid.setHTML(0,0,"<b>Pixel Size:</b> " + _nfPix.format(pixScale)+ "''");
        grid.setHTML(0,1,"<b>File Size:</b> " + StringUtils.getSizeAsString(fileSize));
               
        _panel.add(grid);
        _panel.add(table);
    }
 
Example 57
Project: firefly   File: FitsHeaderDialog.java   Source Code and License 5 votes vote down vote up
private VerticalPanel loadTable(DataSet ds, double pixScale, long fileSize){
    VerticalPanel vp = new FitsHeaderPanel();

    //set column widths
    List<BaseTableData.RowData> rows = ds.getModel().getRows();
    int rowLength = 170;
    int dataLength;
    String rowValue;
    for(BaseTableData.RowData row : rows){
        rowValue = row.getValue(3);
        dataLength = rowValue.length()*6;
        //set column width to size of text
        if(dataLength > rowLength){
            rowLength = dataLength;
        }
    }

    TableDataView.Column c = ds.getColumn(0);
    c.setWidth(25);
    c = ds.getColumn(1);
    c.setWidth(75);
    c = ds.getColumn(2);
    c.setWidth(100);
    c = ds.getColumn(3);
    c.setWidth(rowLength);

    BasicTable table = new BasicTable(ds);
    table.setSize("400px", "375px");
    Grid grid = new Grid (1,2);
    HTMLTable.ColumnFormatter colF = grid.getColumnFormatter();
    colF.setWidth(0, "200px");
    grid.setHTML(0,0,"<b>Pixel Size:</b> " + _nfPix.format(pixScale)+ "''");
    grid.setHTML(0,1,"<b>File Size:</b> " + StringUtils.getSizeAsString(fileSize));

    vp.add(grid);
    vp.add(table);

    return vp;
}
 
Example 58
Project: gerrit   File: KeyHelpPopup.java   Source Code and License 5 votes vote down vote up
public KeyHelpPopup() {
  super(true /* autohide */, true /* modal */);
  setStyleName(KeyResources.I.css().helpPopup());

  final Anchor closer = new Anchor(KeyConstants.I.closeButton());
  closer.addClickHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          hide();
        }
      });

  final Grid header = new Grid(1, 3);
  header.setStyleName(KeyResources.I.css().helpHeader());
  header.setText(0, 0, KeyConstants.I.keyboardShortcuts());
  header.setWidget(0, 2, closer);

  final CellFormatter fmt = header.getCellFormatter();
  fmt.addStyleName(0, 1, KeyResources.I.css().helpHeaderGlue());
  fmt.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);

  final Grid lists = new Grid(0, 7);
  lists.setStyleName(KeyResources.I.css().helpTable());
  populate(lists);
  lists.getCellFormatter().addStyleName(0, 3, KeyResources.I.css().helpTableGlue());

  final FlowPanel body = new FlowPanel();
  body.add(header);
  body.getElement().appendChild(DOM.createElement("hr"));
  body.add(lists);

  focus = new FocusPanel(body);
  focus.getElement().getStyle().setProperty("outline", "0px");
  focus.getElement().setAttribute("hideFocus", "true");
  focus.addKeyPressHandler(this);
  focus.addKeyDownHandler(this);
  add(focus);
}
 
Example 59
Project: gerrit   File: KeyHelpPopup.java   Source Code and License 5 votes vote down vote up
private void populate(Grid lists) {
  int[] end = new int[5];
  int column = 0;
  for (KeyCommandSet set : combinedSetsByName()) {
    int row = end[column];
    row = formatGroup(lists, row, column, set);
    end[column] = row;
    if (column == 0) {
      column = 4;
    } else {
      column = 0;
    }
  }
}
 
Example 60
Project: gerrit   File: KeyHelpPopup.java   Source Code and License 5 votes vote down vote up
private int formatGroup(Grid lists, int row, int col, KeyCommandSet set) {
  if (set.isEmpty()) {
    return row;
  }

  if (lists.getRowCount() < row + 1) {
    lists.resizeRows(row + 1);
  }
  lists.setText(row, col + 2, set.getName());
  lists.getCellFormatter().addStyleName(row, col + 2, KeyResources.I.css().helpGroup());
  row++;

  return formatKeys(lists, row, col, set, null);
}