Java Code Examples for gwt.material.design.client.ui.MaterialBadge

The following examples show how to use gwt.material.design.client.ui.MaterialBadge. These examples are extracted from open source projects. 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 Project: gwt-material-demo   Source File: CustomCategoryComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void render(TableSubHeader subheader, int column) {
    super.render(subheader, column);

    subheader.getNameTh().setPaddingLeft(20);

    // Here you can define any element attach to the Category Component SubHeader
    TableHeader newHeader = new TableHeader();
    newHeader.setPaddingLeft(40);
    newHeader.add(new MaterialBadge("$1,000"));
    subheader.add(newHeader);
}
 
Example 2
Source Project: gwt-material-addins   Source File: MaterialOverlayTab.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialBadge getBadge() {
    return badge;
}
 
Example 3
Source Project: lumongo   Source File: QueryOptionsView.java    License: Apache License 2.0 4 votes vote down vote up
public QueryOptionsView(UIQueryResults uiQueryResults) {
	setMargin(15);
	setPadding(10);

	uiQueryObject = uiQueryResults.getUiQueryObject();
	if (uiQueryObject == null) {
		uiQueryObject = new UIQueryObject();
	}

	if (!uiQueryResults.getJsonDocs().isEmpty()) {
		MaterialBadge resultsBadge = new MaterialBadge("Total Results: " + NumberFormat.getFormat("#,##0").format(uiQueryResults.getTotalResults()));
		add(resultsBadge);
		add(new Br());
	}

	MaterialButton executeButton = new MaterialButton("Execute", IconType.SEARCH);
	executeButton.addClickHandler(clickEvent -> runSearch());
	executeButton.setMarginRight(2);
	add(executeButton);

	MaterialButton resetButton = new MaterialButton("Reset", IconType.REFRESH);
	resetButton.addClickHandler(clickEvent -> MainController.get().goTo(new QueryPlace(null)));
	add(resetButton);

	MaterialListBox indexesListBox = new MaterialListBox();
	indexesListBox.setMultipleSelect(true);
	Option selectOneIndexOption = new Option("Select Indexes");
	selectOneIndexOption.setDisabled(true);
	indexesListBox.add(selectOneIndexOption);

	fieldNameCollapsible = new MaterialCollapsible();
	fieldNameCollapsible.setAccordion(false);
	for (IndexInfo indexInfo : uiQueryResults.getIndexes()) {
		createFieldNameCollapsible(indexInfo);

		Option option = new Option(indexInfo.getName());
		if (uiQueryObject.getIndexNames().contains(indexInfo.getName())) {
			option.setSelected(true);
			fieldItems.get(indexInfo.getName()).setVisible(true);
		}
		indexesListBox.add(option);
	}
	indexesListBox.addValueChangeHandler(valueChangeEvent -> {
		for (String indexName : fieldItems.keySet()) {
			fieldItems.get(indexName).setVisible(false);
		}
		for (String itemsSelected : indexesListBox.getItemsSelected()) {
			uiQueryObject.getIndexNames().add(itemsSelected);
			fieldItems.get(itemsSelected).setVisible(true);
		}
	});

	add(indexesListBox);
	add(fieldNameCollapsible);

	CustomTextBox searchBox = new CustomTextBox(true);
	searchBox.setPlaceHolder("q=*:*");
	searchBox.setValue(uiQueryObject.getQuery());
	searchBox.addKeyUpHandler(clickEvent -> {
		if (clickEvent.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
			uiQueryObject.setQuery(searchBox.getValue());
			runSearch();
		}
	});

	searchBox.getButton().setTitle("Execute Query");
	searchBox.getButton().addClickHandler(clickEvent -> {
		uiQueryObject.setQuery(searchBox.getValue());
		runSearch();
	});

	add(searchBox);

	CustomTextBox rowsIntegerBox = new CustomTextBox();
	rowsIntegerBox.setPlaceHolder("rows (defaults to 10)");
	if (uiQueryObject != null && uiQueryObject.getRows() != 10) {
		rowsIntegerBox.setValue(uiQueryObject.getRows() + "");
	}
	rowsIntegerBox.getTextBox().addChangeHandler(changeEvent -> uiQueryObject.setRows(Integer.valueOf(rowsIntegerBox.getValue())));
	rowsIntegerBox.addKeyUpHandler(clickEvent -> {
		if (clickEvent.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
			runSearch();
		}
	});

	add(rowsIntegerBox);

	filterQueryDiv = new Div();
	if (!uiQueryObject.getFilterQueries().isEmpty()) {
		for (String fq : uiQueryObject.getFilterQueries()) {
			createFilterQueryWidget(fq);
		}
	}
	else {
		createFilterQueryWidget(null);
	}

	add(filterQueryDiv);

}