com.google.gwt.user.client.ui.HasText Java Examples

The following examples show how to use com.google.gwt.user.client.ui.HasText. 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: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public LockCell(boolean check, String text, String ariaLabel) {
	super(null);
	if (CONSTANTS.listOfClassesUseLockIcon()) {
		iCheck = new AriaToggleButton(RESOURCES.locked(), RESOURCES.unlocked());
	} else {
		iCheck = new AriaCheckBox();
	}
	if (text != null)
		((HasText)iCheck).setText(text);
	iCheck.setValue(check);
	((HasClickHandlers)iCheck).addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			event.stopPropagation();
		}
	});
	if (ariaLabel != null) setAriaLabel(ariaLabel);
}
 
Example #2
Source File: ListSolutionsPage.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected ClickHandler createClickHandler(final UniTimeHeaderPanel header, final SolutionOperation operation, final HasText parameter, final Long solutionId) {
	return new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			execute(header, operation, parameter, solutionId);
		}
	};
}
 
Example #3
Source File: PageFilter.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setValue(String name, String value) {
	Widget w = iWidgets.get(name);
	FilterParameterInterface param = iFilter.getParameter(name);
	if (param != null) param.setValue(value);
	if (w == null) return;
	if (w instanceof CheckBox) {
		((CheckBox)w).setValue("1".equals(value));
	} else if (w instanceof ListBox) {
		ListBox list = (ListBox)w;
		if (param != null && param.isMultiSelect()) {
			for (int i = 0; i < list.getItemCount(); i++) {
				boolean selected = false;
				for (String val: value.split(","))
					if (val.equalsIgnoreCase(list.getValue(i))) selected = true;
				list.setItemSelected(i, selected);
			}
		} else {
			for (int i = 0; i < list.getItemCount(); i++) {
				if (value.equalsIgnoreCase(list.getValue(i))) {
					list.setSelectedIndex(i); break;
				}
			}
		}
	} else if (w instanceof HasText) {
		((HasText)w).setText(value);
	}
}
 
Example #4
Source File: FlowForm.java    From unitime with Apache License 2.0 5 votes vote down vote up
public int getCell(String text) {
	for (int i = 0; i < getWidgetCount(); i++) {
		Widget w = getWidget(i);
		if ("header-cell".equals(w.getStylePrimaryName()) && w instanceof HasText && text.equals(((HasText)w).getText())) {
			return 1 + i;
		}
	}
	return -1;
}
 
Example #5
Source File: SimpleForm.java    From unitime with Apache License 2.0 5 votes vote down vote up
public int getRow(String text) {
	for (int row = 0; row < getRowCount(); row ++) {
		if (getCellCount(row) > 1) {
			Widget w = getWidget(row, 0);
			if (w instanceof HasText && text.equals(((HasText)w).getText())) return row;
		}
	}
	return -1;
}
 
Example #6
Source File: UniTimeWidget.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void setText(String html) {
	if (iReadOnly == null) {
		iReadOnly = new P("label");
		iReadOnly.setVisible(!getWidget().isVisible());
		if (iPrint != null)
			iReadOnly.addStyleName("unitime-NoPrint");
		insert(iReadOnly, 1);
	}
	if (iReadOnly instanceof HasHTML) {
		((HasHTML)iReadOnly).setHTML(html);
	} else if (iReadOnly instanceof HasText) {
		((HasText)iReadOnly).setText(html);
	}
}
 
Example #7
Source File: ListSolutionsPage.java    From unitime with Apache License 2.0 4 votes vote down vote up
protected void execute(final UniTimeHeaderPanel header, final SolutionOperation operation, final HasText note, final Long solutionId) {
	switch (operation) {
	case EXPORT:
		ToolBox.open(GWT.getHostPageBaseURL() + "export?output=solution.csv&type=course" + (solutionId == null ? "" : "&solution=" + solutionId));
		return;
	}
	final ListSolutionsRequest request = new ListSolutionsRequest(operation);
	String confirmation = null;
	switch (operation) {
	case UNLOAD:
		confirmation = MESSAGES.confirmSolverUnload();
		break;
	case SAVE:
		confirmation = MESSAGES.confirmSolverSave();
		if (iCurrentSolutionNote != null)
			request.setNote(iCurrentSolutionNote.getText());
		break;
	case SAVE_AS_NEW:
		confirmation = MESSAGES.confirmSolverSaveAsNew();
		if (iCurrentSolutionNote != null)
			request.setNote(iCurrentSolutionNote.getText());
		break;
	case SAVE_COMMIT:
		confirmation = MESSAGES.confirmSolverSaveCommit();
		if (iCurrentSolutionNote != null)
			request.setNote(iCurrentSolutionNote.getText());
		break;
	case SAVE_AS_NEW_COMMIT:
		confirmation = MESSAGES.confirmSolverSaveAsNewCommit();
		if (iCurrentSolutionNote != null)
			request.setNote(iCurrentSolutionNote.getText());
		break;
	case UNCOMMIT:
		request.setNote(note.getText());
		request.addSolutionId(solutionId);
		confirmation = MESSAGES.confirmSolverUncommit();
		break;
	case COMMIT:
		request.setNote(note.getText());
		request.addSolutionId(solutionId);
		confirmation = MESSAGES.confirmSolverCommit();
		break;
	case DELETE:
		request.addSolutionId(solutionId);
		confirmation = MESSAGES.confirmSolverDelete();
		break;
	case RELOAD:
		if (iCurrentSolutionNote != null)
			request.setNote(iCurrentSolutionNote.getText());
		break;
	case SELECT:
	case DESELECT:
		request.addSolutionId(solutionId);
		break;
	case UPDATE_NOTE:
		request.setNote(note.getText());
		request.addSolutionId(solutionId);
		break;
	case LOAD:
		request.setConfigurationId(Long.valueOf(iSolverConfig.getSelectedValue()));
		request.setHost(iSolverHost == null ? null : iSolverHost.getSelectedValue());
		break;
	case LOAD_EMPTY:
		request.setConfigurationId(Long.valueOf(iSolverConfig.getSelectedValue()));
		request.setHost(iSolverHost == null ? null : iSolverHost.getSelectedValue());
		request.setOwnerId(Long.valueOf(iSolverOwner.getSelectedValue()));
		break;
	}
	final Command command = new Command() {
		@Override
		public void execute() {
			if (operation == SolutionOperation.INIT || operation == SolutionOperation.CHECK)
				header.showLoading();
			else
				LoadingWidget.showLoading(MESSAGES.waitSolverExecution());
			RPC.execute(request, new AsyncCallback<ListSolutionsResponse>() {
				@Override
				public void onFailure(Throwable caught) {
					LoadingWidget.hideLoading();
					header.setErrorMessage(caught.getMessage());
					UniTimeNotifications.error(caught.getMessage(), caught);
					ToolBox.checkAccess(caught);
				}

				@Override
				public void onSuccess(ListSolutionsResponse response) {
					LoadingWidget.hideLoading();
					header.clearMessage();
					populate(request, response);
					UniTimePageHeader.getInstance().reloadSolverInfo();
				}
			});
		}
	};
	if (confirmation == null) {
		command.execute();
	} else {
		UniTimeConfirmationDialog.confirm(confirmation, command);
	}
}