Java Code Examples for com.google.gwt.user.client.ui.RootPanel#add()

The following examples show how to use com.google.gwt.user.client.ui.RootPanel#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StudentScheduleTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void insert(final RootPanel panel) {
	String studentId = panel.getElement().getInnerText().trim();
	panel.getElement().setInnerText(null);
	panel.add(this);
	sSectioningService.lookupStudent(iOnline, studentId, new AsyncCallback<ClassAssignmentInterface.Student>() {
		@Override
		public void onSuccess(Student result) {
			if (result != null) {
				panel.setVisible(true);
				setStudent(result);
				if (SectioningCookie.getInstance().getEnrollmentCoursesDetails()) {
					refresh();
				} else {
					clear();
					iHeader.clearMessage();
					iHeader.setCollapsible(false);
				}
			}
		}
		@Override
		public void onFailure(Throwable caught) {}
	});
}
 
Example 2
Source File: Modal.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void show() {
	this.ensureDismissButton();
	this.redraw();
	this.visible = true;

	Widget modal = getContainerWidget();

	if (modal.isAttached()) {
		modal.removeFromParent();
	}

	Modal.MODAL_BACKDROP.show();
	this.getElement().getStyle().setDisplay(Display.BLOCK);
	RootPanel rootPanel = RootPanel.get();
	rootPanel.add(modal);
	StyleUtils.addStyle(rootPanel, Modal.STYLE_MODAL_OPEN);

	Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
		@Override
		public boolean execute() {
			StyleUtils.addStyle(Modal.this, Modal.STYLE_VISIBLE);
			return false;
		}
	}, 150);
}
 
Example 3
Source File: ReservationTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void insert(final RootPanel panel) {
	initCallbacks();
	iOfferingId = Long.valueOf(panel.getElement().getInnerText());
	if (ReservationCookie.getInstance().getReservationCoursesDetails()) {
		refresh();
	} else {
		clear(false);
		iHeader.clearMessage();
		iHeader.setCollapsible(false);
	}
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
	addReservationClickHandler(new ReservationClickHandler() {
		@Override
		public void onClick(ReservationClickedEvent evt) {
			ToolBox.open(GWT.getHostPageBaseURL() + "gwt.jsp?page=reservation&id=" + evt.getReservation().getId() + "&reservations=" + getReservationIds());
		}
	});
}
 
Example 4
Source File: CourseNumbersSuggestBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
public static AriaSuggestBox insert(RootPanel panel) {
	String config = panel.getElement().getAttribute("configuration");
	final String onchange = panel.getElement().getAttribute("onchange");
	AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
	text.getElement().setAttribute("autocomplete", "off");
	AriaSuggestBox box = new AriaSuggestBox(text, new CourseNumbersSuggestBox(config));
	if (onchange != null)
		box.addValueChangeHandler(new ValueChangeHandler<String>() {
			@Override
			public void onValueChange(ValueChangeEvent<String> event) {
				ToolBox.eval(onchange);
			}
		});
	panel.add(box);
	return box;
}
 
Example 5
Source File: SolverAllocatedMemory.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void insert(final RootPanel panel) {
	String id = panel.getElement().getInnerText();
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
	RPC.execute(new SolverAllocatedMemoryRpcRequest(id), new AsyncCallback<SolverAllocatedMemoryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}

		@Override
		public void onSuccess(SolverAllocatedMemoryRpcResponse result) {
			setWidget(new Label(result.getValue()));
		}
	});
}
 
Example 6
Source File: ConflictBasedStatisticsPage.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected void populate(FilterInterface filter, GwtRpcResponseList<CBSNode> response) {
	iLastFilter = filter;
	iLastResponse = response;
	for (int row = iPanel.getRowCount() - 1; row > 0; row--)
		iPanel.removeRow(row);
	
	RootPanel cpm = RootPanel.get("UniTimeGWT:CustomPageMessages");
	if (cpm != null && iFilterResponse != null) {
		cpm.clear();
		if (iFilterResponse.hasPageMessages()) {
			for (final PageMessage pm: iFilterResponse.getPageMessages()) {
				P p = new P(pm.getType() == PageMessageType.ERROR ? "unitime-PageError" : pm.getType() == PageMessageType.WARNING ? "unitime-PageWarn" : "unitime-PageMessage");
				p.setHTML(pm.getMessage());
				if (pm.hasUrl()) {
					p.addStyleName("unitime-ClickablePageMessage");
					p.addClickHandler(new ClickHandler() {
						@Override
						public void onClick(ClickEvent event) {
							if (pm.hasUrl()) ToolBox.open(GWT.getHostPageBaseURL() + pm.getUrl());
						}
					});
				}
				cpm.add(p);
			}
		}
	}
	
	if (response == null || response.isEmpty()) {
		iFilter.getFooter().setMessage(MESSAGES.errorConflictStatisticsNoDataReturned());
		return;
	}
	
	if (iTree == null) {
		iTree = new ConflictBasedStatisticsTree(iFilterResponse.getSuggestionProperties());
	}
	iTree.setValue(response);
	iPanel.addRow(iTree);
	iPanel.addRow(iLegend);
}
 
Example 7
Source File: CourseCurriculaTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(final RootPanel panel) {
	initCallbacks();
	iOfferingId = Long.valueOf(panel.getElement().getInnerText());
	iCourseName = null;
	if (CurriculumCookie.getInstance().getCurriculaCoursesDetails()) {
		refresh();
	} else {
		iHeader.clearMessage();
		iHeader.setCollapsible(false);
	}
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
}
 
Example 8
Source File: SingleDateSelector.java    From unitime with Apache License 2.0 5 votes vote down vote up
public static SingleDateSelector insert(RootPanel panel) {
	String format = panel.getElement().getAttribute("format");
	final String onchange = panel.getElement().getAttribute("onchange");
	String error = panel.getElement().getAttribute("error");
	String disabled = panel.getElement().getAttribute("disabled");
	AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
	SingleDateSelector selector = new SingleDateSelector(text, null, false);
	if (format != null)
		selector.iFormat = DateTimeFormat.getFormat(format);
	if (onchange != null)
		selector.addValueChangeHandler(new ValueChangeHandler<Date>() {
			@Override
			public void onValueChange(ValueChangeEvent<Date> event) {
				ToolBox.eval(onchange);
			}
		});
	if (text.getText() != null && !text.getText().isEmpty()) {
		Date date = null;
		try {
			date = selector.iFormat.parse(text.getText());
		} catch (IllegalArgumentException e) {}
		if (date != null)
			selector.setValue(date);
	}
	if (error != null && !error.isEmpty())
		selector.setErrorHint(error);
	if (disabled != null && "true".equalsIgnoreCase(disabled))
		selector.setEnabled(false);
	panel.add(selector);
	return selector;
}
 
Example 9
Source File: EnrollmentTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(final RootPanel panel) {
	iOfferingId = Long.valueOf(panel.getElement().getInnerText());
	if (iOfferingId >= 0 && iShowFilter)
		iHeader.setHeaderTitle(MESSAGES.studentsTable());
	if (SectioningCookie.getInstance().getEnrollmentCoursesDetails()) {
		refresh();
	} else {
		clear();
		iHeader.clearMessage();
		iHeader.setCollapsible(false);
	}
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
}
 
Example 10
Source File: UniTimePageLabel.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(RootPanel panel) {
	String title = panel.getElement().getInnerText();
	if (title != null && !title.isEmpty())
		iLabel.setValue(new PageNameInterface(title));
	panel.getElement().setInnerText("");
	panel.add(iLabel);
	setPageName(title);
}
 
Example 11
Source File: TeachingRequestsWidget.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(final RootPanel panel) {
	iOfferingId = Long.valueOf(panel.getElement().getInnerText());
	if (InstructorCookie.getInstance().isShowTeachingRequests()) {
		refresh();
	}
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
}
 
Example 12
Source File: WordCloudDetailApp.java    From swcv with MIT License 5 votes vote down vote up
private void initializeContentPanel(WordCloud cloud)
{
    SimplePanel panel = createPanel(cloud.getSvg(), cloud.getWidth() + 20, cloud.getHeight() + 20);
    RootPanel rPanel = RootPanel.get("cloud-div");
    rPanel.clear();
    rPanel.add(panel);
    rPanel.setPixelSize(cloud.getWidth() + 20, cloud.getHeight() + 20);
    rPanel.addStyleName("center");
}
 
Example 13
Source File: WordCloudDetailApp.java    From swcv with MIT License 5 votes vote down vote up
private void initializeSettingPanel(WordCloud cloud)
{
    CaptionPanel settingArea = new SettingsPanel().create(setting);
    settingArea.setCaptionText("options");
    
    RootPanel rPanel = RootPanel.get("cloud-setting");
    rPanel.clear();
    rPanel.add(settingArea);
}
 
Example 14
Source File: UTCDateTimeDemo.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
@Override
public void onModuleLoad() {

    eventListBox = new ListBox(true);
    eventListBox.setVisibleItemCount(20);
    eventListBox.setWidth("800px");
    RootPanel.get("eventlog").add(eventListBox);

    startDate = createDateBox("start-date");
    startTime = createTimeBox("start-time");

    endDate = createDateBox("end-date");
    endTime = createTimeBox("end-time");
    
    allday = new CheckBox("All Day");
    
    // constructing this will bind all of the events
    new UTCDateTimeRangeController(startDate, startTime, endDate, endTime, allday);
    
    RootPanel startPanel = RootPanel.get("start");
    startPanel.add(startDate);
    startPanel.add(startTime);
    startPanel.add(allday);

    RootPanel endPanel = RootPanel.get("end");
    endPanel.add(endDate);
    endPanel.add(endTime);
    
    startDate.setValue(UTCDateBox.getValueForToday(), true);
    startTime.setValue(UTCTimeBox.getValueForNextHour(), true);
}
 
Example 15
Source File: TeachingAssignmentsWidget.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(final RootPanel panel) {
	iInstructorId = panel.getElement().getInnerText();
	if (InstructorCookie.getInstance().isShowTeachingAssignments()) {
		refresh();
	}
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
}
 
Example 16
Source File: RoomNoteChanges.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void insert(final RootPanel panel) {
	load(Long.valueOf(panel.getElement().getInnerText()));
	panel.getElement().setInnerText(null);
	panel.add(this);
	panel.setVisible(true);
}
 
Example 17
Source File: Game.java    From shortyz with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public Game(RootPanel rootPanel, PuzzleServiceProxy service,
    Resources resources, final PuzzleListView plv, Renderer renderer) {
    this.service = service;
    this.plv = plv;
    this.renderer = renderer;
    this.css = resources.css();

    History.newItem("list", false);
    History.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                if (event.getValue().equals("list")) {
                    if (closingRegistration != null) {
                        closingRegistration.removeHandler();
                        closingRegistration = null;
                    }

                    if (autoSaveTimer != null) {
                        autoSaveTimer.cancel();
                        autoSaveTimer.run();
                        autoSaveTimer = null;
                    }

                    mainPanel.setWidget(plv);
                    keyboardIntercept.removeKeyboardListener(l);

                    getDisplayChangeListener().onDisplayChange();
                } else if (event.getValue().startsWith("play=")) {
                    Long id = Long.parseLong(event.getValue().split("=")[1]);
                    loadPuzzle(id);
                }
            }
        });
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setWidth("100%");
    StyleInjector.inject(resources.css().getText());
    keyboardIntercept.setWidth("1px");
    keyboardIntercept.setHeight("1px");
    keyboardIntercept.setStyleName(css.keyboardIntercept());
    rootPanel.add(keyboardIntercept);

    verticalPanel.add(status);
    verticalPanel.setCellHorizontalAlignment(status,
        HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(mainPanel);
    verticalPanel.setCellHorizontalAlignment(mainPanel,
        HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(below);
    display.add(verticalPanel);
    display.setWidth("97%");
    rootPanel.add(display);
}
 
Example 18
Source File: UniTimeVersion.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void insert(final RootPanel panel) {
	panel.add(this);
	panel.setVisible(true);
}
 
Example 19
Source File: UniTimeMobileMenu.java    From unitime with Apache License 2.0 4 votes vote down vote up
private void attach(final RootPanel rootPanel) {
	rootPanel.add(this);
}
 
Example 20
Source File: UniTimePageHeader.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void insert(final RootPanel panel) {
	if (panel.getWidgetCount() > 0) return;
	panel.add(iHeader);
	panel.setVisible(true);
}