Java Code Examples for com.google.gwt.user.client.ui.HorizontalPanel.getWidgetCount()

The following are Jave code examples for showing how to use getWidgetCount() of the com.google.gwt.user.client.ui.HorizontalPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: LAS   File: ESGFSearchPanel.java   Source Code and License Vote up 5 votes
@Override
public void onSuccess(String id) {
    
    spin.hide();
    eventBus.fireEvent(new ESGFDatasetAddedEvent());
    for ( int i = 0; i < datasetPanel.getWidgetCount(); i++) {
        HorizontalPanel entry = (HorizontalPanel) datasetPanel.getWidget(i);
        if ( entry.getWidgetCount() == 1 && entry.getElement().getId().equals(id)) {
            String added = "&nbsp;&nbsp(Data set ready.)";
            HTML addedlabel = new HTML(added);
            entry.add(addedlabel);
        }
    }
}
 
Example 2
Project: gwtlib   File: PagingBar.java   Source Code and License Vote up 5 votes
protected void updateGotoWidget(Widget widget) {
  widget.setVisible(computeNumPages() > 1);
  // Update allowed number of characters in the goto page textbox in case page size has changed (Yuck!)
  if(widget instanceof HorizontalPanel) {
    HorizontalPanel panel = (HorizontalPanel)widget;
    if(panel.getWidgetCount() == 3 && panel.getWidget(1) instanceof TextBox) {
      TextBox gotoPage = (TextBox)panel.getWidget(1);
      int maxlen = String.valueOf(computeNumPages()).length();
      gotoPage.setMaxLength(maxlen);
      gotoPage.setVisibleLength(maxlen);
    }
  }
}
 
Example 3
Project: unitimes   File: CurriculaCourses.java   Source Code and License Vote up 4 votes
public boolean saveCurriculum(CurriculumInterface c) {
	boolean ret = true;
	HashSet<String> courses = new HashSet<String>();
	HashMap<String, CurriculumCourseGroupInterface> groups = new HashMap<String, CurriculumCourseGroupInterface>();
	if (c.hasCourses()) c.getCourses().clear();
	for (int row = 1; row < iTable.getRowCount(); row++) {
		String course = ((CurriculaCourseSelectionBox)iTable.getWidget(row, 1)).getText();
		if (course.isEmpty()) continue;
		if (!courses.add(course)) {
			((CurriculaCourseSelectionBox)iTable.getWidget(row, 1)).setError(MESSAGES.errorDuplicateCourse(course));
			ret = false;
			continue;
		}
		CourseInterface cr = new CourseInterface();
		cr.setCourseName(course);
		for (int i = 0; i < iClassifications.getClassifications().size(); i++) {
			Float share = ((ShareTextBox)iTable.getWidget(row, 2 + 2 * i)).getShare();
			if (share == null) continue;
			Integer lastLike = ((EnrollmentLabel)iTable.getWidget(row, 3 + 2 * i)).iLastLike;
			CurriculumCourseInterface cx = new CurriculumCourseInterface();
			cx.setShare(share);
			cx.setLastLike(lastLike);
			cx.setCurriculumClassificationId(iClassifications.getClassifications().get(i).getId());
			cr.setCurriculumCourse(i, cx);
		}
		if (!cr.hasCurriculumCourses()) continue;
		HorizontalPanel hp = (HorizontalPanel)iTable.getWidget(row, 0);
		for (int i = 0; i < hp.getWidgetCount(); i++) {
			Group g = (Group)hp.getWidget(i);
			CurriculumCourseGroupInterface gr = groups.get(g.getName());
			if (gr == null) {
				gr = new CurriculumCourseGroupInterface();
				gr.setName(g.getName());
				gr.setType(g.getType());
				gr.setEditable(g.isEditable());
				gr.setColor(g.getColor());
				groups.put(g.getName(), gr);
			}
			cr.addGroup(gr);
		}
		c.addCourse(cr);
	}
	return ret;
}
 
Example 4
Project: sc2gears   File: HomePage.java   Source Code and License Vote up 4 votes
@Override
  public void buildGUI() {
add( ClientUtils.createVerticalEmptyWidget( 30 ) );

final HorizontalPanel greetingsPanel = new HorizontalPanel();
add( greetingsPanel );

if ( sharedApiAccountUserInfo == null ) {
	// Greeting
	if ( apiUserInfo.getLastVisit() == null ) {
		greetingsPanel.add( new Label( "Welcome " ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "!" ) );
	}
	else {
		greetingsPanel.add( new Label( "Welcome back" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "! Your last visit was at:" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.createTimestampWidget( apiUserInfo.getLastVisit() ) );
	}
}
else {
	if ( sharedApiAccountUserInfo.isHasApiAccount() )
		greetingsPanel.add( new Label( "You are now viewing the" ) );
	else
		greetingsPanel.add( new Label( "You do NOT have access to the" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( ClientUtils.styledWidget( new Label( sharedApiAccountUserInfo.getSharedApiAccount() ), "strong" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( new Label( "API account!" ) );
}

// Replay parser engine version
if ( apiUserInfo.getRepParserEngineVer() != null ) {
	add( ClientUtils.createVerticalEmptyWidget( 30 ) );
	final HorizontalPanel rowPanel = new HorizontalPanel();
	rowPanel.add( new Label( "Replay parser engine version:" ) );
	rowPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
	rowPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getRepParserEngineVer() ), "strong" ) );
	add( rowPanel );
}

// Parsing service tester page
add( ClientUtils.createVerticalEmptyWidget( 30 ) );
add( new Anchor( "Parsing Service Tester page", "/parsing_service_tester.html", "_blank" ) );

add( ClientUtils.createVerticalEmptyWidget( 70 ) );

// Footer
final HorizontalPanel linksPanel = new HorizontalPanel();
linksPanel.setWidth( "500px" );
DOM.setStyleAttribute( linksPanel.getElement(), "padding", "2px" );
DOM.setStyleAttribute( linksPanel.getElement(), "borderTop", "1px solid #555555" );
linksPanel.addStyleName( "noWrap" );
linksPanel.add( new Anchor( "About the Service", "https://sites.google.com/site/sc2gears/parsing-service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Terms of Service", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Terms-of-Service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Privacy Policy", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Privacy-Policy", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 15 ) );
final Label lastLabel = new Label( "© András Belicza, 2011-2014, Icons: Fugue" );
DOM.setStyleAttribute( lastLabel.getElement(), "color", "#555555" );
DOM.setStyleAttribute( lastLabel.getElement(), "paddingTop", "3px" );
linksPanel.add( lastLabel );
linksPanel.setCellWidth( lastLabel, "100%" );
linksPanel.setCellHorizontalAlignment( lastLabel, HasHorizontalAlignment.ALIGN_RIGHT );
for ( int i = linksPanel.getWidgetCount() - 1; i >= 0; i-- )
	DOM.setStyleAttribute( linksPanel.getWidget( i ).getElement(), "fontSize", "80%" );
add( linksPanel );
  }
 
Example 5
Project: unitime   File: CurriculaCourses.java   Source Code and License Vote up 4 votes
public boolean saveCurriculum(CurriculumInterface c) {
	boolean ret = true;
	HashSet<String> courses = new HashSet<String>();
	HashMap<String, CurriculumCourseGroupInterface> groups = new HashMap<String, CurriculumCourseGroupInterface>();
	if (c.hasCourses()) c.getCourses().clear();
	for (int row = 1; row < iTable.getRowCount(); row++) {
		String course = ((CurriculaCourseSelectionBox)iTable.getWidget(row, 1)).getText();
		if (course.isEmpty()) continue;
		if (!courses.add(course)) {
			((CurriculaCourseSelectionBox)iTable.getWidget(row, 1)).setError(MESSAGES.errorDuplicateCourse(course));
			ret = false;
			continue;
		}
		CourseInterface cr = new CourseInterface();
		cr.setCourseName(course);
		for (int i = 0; i < iClassifications.getClassifications().size(); i++) {
			Float share = ((ShareTextBox)iTable.getWidget(row, 2 + 2 * i)).getShare();
			if (share == null) continue;
			Integer lastLike = ((EnrollmentLabel)iTable.getWidget(row, 3 + 2 * i)).iLastLike;
			CurriculumCourseInterface cx = new CurriculumCourseInterface();
			cx.setShare(share);
			cx.setLastLike(lastLike);
			cx.setCurriculumClassificationId(iClassifications.getClassifications().get(i).getId());
			cr.setCurriculumCourse(i, cx);
		}
		if (!cr.hasCurriculumCourses()) continue;
		HorizontalPanel hp = (HorizontalPanel)iTable.getWidget(row, 0);
		for (int i = 0; i < hp.getWidgetCount(); i++) {
			Group g = (Group)hp.getWidget(i);
			CurriculumCourseGroupInterface gr = groups.get(g.getName());
			if (gr == null) {
				gr = new CurriculumCourseGroupInterface();
				gr.setName(g.getName());
				gr.setType(g.getType());
				gr.setEditable(g.isEditable());
				gr.setColor(g.getColor());
				groups.put(g.getName(), gr);
			}
			cr.addGroup(gr);
		}
		c.addCourse(cr);
	}
	return ret;
}