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

The following examples show how to use gwt.material.design.client.ui.MaterialLabel. 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: IconsView.java    License: Apache License 2.0 6 votes vote down vote up
protected void getAllIcons() {
    for (IconType i : IconType.values()) {
        MaterialColumn column = new MaterialColumn(4, 3, 2);
        column.setTextAlign(TextAlign.CENTER);
        column.setPadding(40);
        MaterialIcon icon = new MaterialIcon();
        icon.setIconSize(IconSize.MEDIUM);
        icon.setIconType(i);

        MaterialLabel label = new MaterialLabel();
        label.setFontSize("0.8em");
        label.setText(i.name().toUpperCase());

        column.add(icon);
        column.add(label);
        iconsRow.add(column);
    }
}
 
Example 2
Source Project: gwt-material-addins   Source File: AlertTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testStructure() {
    Alert alert = getWidget();

    final String TEXT = "text";
    final IconType ICON = IconType.AC_UNIT;
    // Check Structure
    assertEquals(alert.getWidgetCount(), 2);
    assertTrue(alert.getWidget(0) instanceof MaterialIcon);
    assertTrue(alert.getWidget(1) instanceof MaterialLabel);
    // Check setText()
    alert.setText(TEXT);
    assertEquals(alert.getText(), TEXT);
    // Check setIconType()
    alert.setIconType(ICON);
    assertEquals(alert.getIcon().getIconType(), ICON);
}
 
Example 3
Source Project: gwt-material-addins   Source File: LoadingStateTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testStructure() {
    LoadingStatePanel statePanel = getWidget();

    // By Default Loading State Panel must be invisible by default
    assertFalse(statePanel.isVisible());
    assertTrue(statePanel.getElement().hasClassName(IncubatorCssName.LOADING_STATE));
    // Check widget structure
    assertTrue(statePanel.getWidget(0) instanceof MaterialIcon);
    MaterialIcon icon = (MaterialIcon) statePanel.getWidget(0);
    statePanel.setIcon(IconType.POLYMER);
    assertEquals(statePanel.getIcon(), icon);

    final String TITLE = "title";
    final String DESCRIPTION = "description";
    assertTrue(statePanel.getWidget(1) instanceof MaterialLabel);
    MaterialLabel title = (MaterialLabel) statePanel.getWidget(1);
    statePanel.setTitle(TITLE);
    assertTrue(title.getElement().hasClassName(CssName.TITLE));
    assertEquals(title.getText(), TITLE);

    assertTrue(statePanel.getWidget(2) instanceof MaterialLabel);
    MaterialLabel description = (MaterialLabel) statePanel.getWidget(2);
    statePanel.setDescription(DESCRIPTION);
    assertTrue(description.getElement().hasClassName(AddinsCssName.DESCRIPTION));
    assertEquals(description.getText(), DESCRIPTION);
}
 
Example 4
Source Project: gwt-material-addins   Source File: MaterialDndTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testRestriction() {
    // UiBinder
    // given
    MaterialPanel panel = getWidget(false);
    MaterialIcon iconIgnore = new MaterialIcon();
    MaterialLabel labelIgnore = new MaterialLabel();
    panel.add(iconIgnore);
    panel.add(labelIgnore);

    // when / then
    checkRestriction(panel, iconIgnore.getElement(), labelIgnore.getElement());

    // Standard
    // given
    attachWidget();

    // when / then
    checkRestriction(panel, iconIgnore.getElement(), labelIgnore.getElement());
}
 
Example 5
Source Project: gwt-material-addins   Source File: GroupToggleButton.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel);
    }
    return statusTextMixin;
}
 
Example 6
Source Project: gwt-material-addins   Source File: QuestionItem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel, this.asWidget());
    }
    return statusTextMixin;
}
 
Example 7
Source Project: gwt-material-addins   Source File: DateRangePicker.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel, dateInput);
    }
    return statusTextMixin;
}
 
Example 8
Source Project: gwt-material-addins   Source File: MaterialTimePicker.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel, timeInput, label);
    }
    return statusTextMixin;
}
 
Example 9
Source Project: gwt-material-addins   Source File: MaterialAutoComplete.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel, list, label);
    }
    return statusTextMixin;
}
 
Example 10
Source Project: gwt-material-addins   Source File: MaterialComboBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public StatusTextMixin<AbstractValueWidget, MaterialLabel> getStatusTextMixin() {
    if (statusTextMixin == null) {
        statusTextMixin = new StatusTextMixin<>(this, errorLabel, this.asWidget(), label);
    }
    return statusTextMixin;
}
 
Example 11
Source Project: gwt-material-addins   Source File: MaterialWindowTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testClearContent() {
    // UiBinder
    // given
    MaterialWindow window = getWidget(false);
    MaterialLabel content = new MaterialLabel("Content");
    window.add(content);

    // when / then
    assertEquals(content, window.getContent().getWidget(0));
    assertTrue(content.isAttached());
    assertEquals(0, content.getChildren().size());

    window.clear();
    assertEquals(0, window.getContent().getChildren().size());
}
 
Example 12
@Override
public void testChildren() {
    // UiBinder
    // given
    MaterialTimePicker timePicker = getWidget(true);

    assertEquals(1, timePicker.getWidgetCount());
    assertTrue(timePicker.getWidget(0) instanceof MaterialPanel);
    MaterialPanel panel = (MaterialPanel) timePicker.getWidget(0);
    assertEquals(3, panel.getWidgetCount());
    assertTrue(panel.getWidget(0) instanceof MaterialInput);
    assertTrue(panel.getWidget(1) instanceof Label);
    assertTrue(panel.getWidget(2) instanceof MaterialLabel);
}
 
Example 13
Source Project: gwt-material-addins   Source File: MaterialSwipeableTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected MaterialSwipeablePanel createWidget() {
    MaterialSwipeablePanel swipeablePanel = new MaterialSwipeablePanel();
    label1 = new MaterialLabel();
    swipeablePanel.add(label1);
    label2 = new MaterialLabel();
    swipeablePanel.add(label2);
    return swipeablePanel;
}
 
Example 14
Source Project: gwt-material-addins   Source File: MaterialSwipeableTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void checkIgnored(MaterialSwipeablePanel swipeablePanel) {
    assertEquals(2, swipeablePanel.getWidgetCount());
    MaterialLabel label1 = (MaterialLabel) swipeablePanel.getWidget(0);
    MaterialLabel label2 = (MaterialLabel) swipeablePanel.getWidget(1);
    swipeablePanel.ignore(label1, label2);
    assertTrue(label1.getElement().hasClassName(AddinsCssName.IGNORED));
    assertTrue(label2.getElement().hasClassName(AddinsCssName.IGNORED));
}
 
Example 15
Source Project: gwt-material-addins   Source File: MaterialComboBoxTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testAddItemOption() {
    // given
    MaterialComboBox<String> comboBox = new MaterialComboBox<>();
    RootPanel.get().add(comboBox);

    // when / then
    // Check Initial children
    assertEquals(0, comboBox.getValues().size());
    assertEquals(3, comboBox.getChildren().size());
    // Check simple String object
    for (int i = 1; i <= 5; i++) {
        comboBox.addItem("item" + i);
    }
    assertEquals(5, comboBox.getValues().size());
    final String VALUE = comboBox.getValues().get(0);
    final String SECOND_VALUE = comboBox.getValues().get(1);
    checkValueChangeEvent(comboBox, Collections.singletonList(VALUE), Collections.singletonList(SECOND_VALUE));

    // Check ListBox
    assertNotNull(comboBox.getWidget(0));
    assertTrue(comboBox.getWidget(0) instanceof MaterialWidget);
    assertEquals(comboBox.getListbox(), comboBox.getWidget(0));
    MaterialWidget listBox = comboBox.getListbox();
    assertEquals(5, listBox.getWidgetCount());
    for (Widget w : listBox) {
        assertNotNull(w);
        assertTrue(w instanceof Option);
    }
    // Check Label
    assertNotNull(comboBox.getWidget(1));
    assertTrue(comboBox.getWidget(1) instanceof Label);
    Label lblTitle = (Label) comboBox.getWidget(1);
    assertTrue(lblTitle.getElement().hasClassName(AddinsCssName.SELECT2LABEL));
    // Check error label
    assertNotNull(comboBox.getWidget(2));
    assertTrue(comboBox.getWidget(2) instanceof MaterialLabel);
    assertEquals(comboBox.getErrorLabel(), comboBox.getWidget(2));

}
 
Example 16
protected void checkStructure(MaterialSideProfile profile, boolean checkElement) {
    if (checkElement) {
        assertTrue(profile.getElement().hasClassName(CssName.SIDE_PROFILE));
    }
    assertEquals(1, profile.getWidgetCount());
    assertTrue(profile.getWidget(0) instanceof MaterialLabel);
}
 
Example 17
Source Project: lumongo   Source File: Footer.java    License: Apache License 2.0 5 votes vote down vote up
public Footer() {

		setBackgroundColor(Color.GREY_DARKEN_2);

		MaterialRow row = new MaterialRow();
		MaterialColumn leftColumn = new MaterialColumn(12, 6, 6);
		MaterialColumn rightColumn = new MaterialColumn(12, 6, 6);
		row.add(leftColumn);
		row.add(rightColumn);
		add(row);

		setType(FooterType.FIXED);
		MaterialLabel label = new MaterialLabel("LuMongo is distributed under a commercially friendly Apache Software license");
		label.setTextColor(Color.WHITE);
		label.setMarginTop(15);
		leftColumn.add(label);

		MaterialButton chatButton = new MaterialButton("Chat with Us");
		chatButton.setMarginTop(10);
		chatButton.setMarginLeft(20);
		chatButton.setFloat(Style.Float.RIGHT);
		chatButton.setIconType(IconType.CHAT_BUBBLE);
		chatButton.addClickHandler(clickEvent -> Window
				.open("https://gitter.im/lumongo/lumongo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge", "_blank",
						"menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
		rightColumn.add(chatButton);

		MaterialButton sourceButton = new MaterialButton("Source");
		sourceButton.setMarginTop(10);
		sourceButton.setIconType(IconType.CODE);
		sourceButton.setFloat(Style.Float.RIGHT);
		sourceButton.addClickHandler(
				clickEvent -> Window.open("https://github.com/lumongo/lumongo", "_blank", "menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
		rightColumn.add(sourceButton);

	}
 
Example 18
Source Project: gwt-material   Source File: AbstractValueWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ClearOnKeyUpMixin<AbstractValueWidget, MaterialLabel> getClearOnKeyUpMixin() {
    if (clearOnKeyUpMixin == null) {
        clearOnKeyUpMixin = new ClearOnKeyUpMixin(this,  getStatusTextMixin().getPlaceholder());
    }
    return clearOnKeyUpMixin;
}
 
Example 19
Source Project: gwt-material-demo   Source File: SwipeableView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("swipeablePanel")
void onSwipeRight(SwipeRightEvent<Widget> e) {
    MaterialLabel label = (MaterialLabel) e.getTarget();
    MaterialToast.fireToast(label.getText() + " swiped right");
}
 
Example 20
Source Project: gwt-material-demo   Source File: SwipeableView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("swipeablePanel")
void onSwipeLeft(SwipeLeftEvent<Widget> e) {
    MaterialLabel label = (MaterialLabel) e.getTarget();
    MaterialToast.fireToast(label.getText() + " swiped left");
}
 
Example 21
Source Project: gwt-material-addins   Source File: GroupToggleButton.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getErrorLabel() {
    return errorLabel;
}
 
Example 22
Source Project: gwt-material-addins   Source File: RatingQuestionItem.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getLowLabel() {
    return lowLabel;
}
 
Example 23
Source Project: gwt-material-addins   Source File: RatingQuestionItem.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getHighLabel() {
    return highLabel;
}
 
Example 24
Source Project: gwt-material-addins   Source File: DateRangePicker.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getErrorLabel() {
    return errorLabel;
}
 
Example 25
Source Project: gwt-material-addins   Source File: MaterialTimePicker.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getErrorLabel() {
    return errorLabel;
}
 
Example 26
Source Project: gwt-material-addins   Source File: MaterialAutoComplete.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getErrorLabel() {
    return errorLabel;
}
 
Example 27
Source Project: gwt-material-addins   Source File: MaterialComboBox.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialLabel getErrorLabel() {
    return errorLabel;
}
 
Example 28
@Override
protected MaterialSideProfile createWidget() {
    MaterialSideProfile profile = new MaterialSideProfile();
    profile.add(new MaterialLabel());
    return profile;
}
 
Example 29
Source Project: lumongo   Source File: HomeView.java    License: Apache License 2.0 4 votes vote down vote up
public void drawSplashPage(InstanceInfo instanceInfo) {
	clear();

	MaterialRow row = new MaterialRow();
	add(row);

	{
		MaterialColumn infoColumn = new MaterialColumn();
		infoColumn.setGrid("s12 m6");
		row.add(infoColumn);

		MaterialCard infoCard = new MaterialCard();
		MaterialCardContent infoContent = new MaterialCardContent();
		infoCard.add(infoContent);
		infoColumn.add(infoCard);

		MaterialCardTitle infoCardTitle = new MaterialCardTitle();
		infoCardTitle.setText("Basic Info");
		infoContent.add(infoCardTitle);

		MaterialLabel lumongoVersionLabel = new MaterialLabel("LuMongo Version: " + instanceInfo.getLumongoVersion());
		MaterialLabel luceneVersionLabel = new MaterialLabel("Lucene Version: " + instanceInfo.getLuceneVersion());
		MaterialLabel lumongoMemoryLabel = new MaterialLabel("LuMongo Memory: " + instanceInfo.getLumongoMemory());
		MaterialLabel jvmFreeMemoryLabel = new MaterialLabel("JVM Free Memory: " + instanceInfo.getJvmFreeMemory());
		MaterialLabel jvmMaxMemoryLabel = new MaterialLabel("JVM Max Memory: " + instanceInfo.getJvmMaxMemoryMB());
		MaterialLabel jvmTotalMemoryLabel = new MaterialLabel("JVM Total Memory: " + instanceInfo.getJvmTotalMemoryMB());
		MaterialLabel jvmUsedMemoryLabel = new MaterialLabel("JVM Used Memory: " + instanceInfo.getJvmUsedMemory());

		infoContent.add(lumongoVersionLabel);
		infoContent.add(luceneVersionLabel);
		infoContent.add(lumongoMemoryLabel);
		infoContent.add(jvmFreeMemoryLabel);
		infoContent.add(jvmMaxMemoryLabel);
		infoContent.add(jvmTotalMemoryLabel);
		infoContent.add(jvmUsedMemoryLabel);
	}

	{
		MaterialColumn chartColumn = new MaterialColumn(12, 6, 6);
		MaterialCard card = new MaterialCard();

		Map<String, Serializable> data = new HashMap<>();
		for (IndexInfo indexInfo : instanceInfo.getIndexes()) {
			data.put(indexInfo.getName(), indexInfo.getTotalDocs());
		}
		Scheduler.get().scheduleDeferred(() -> {
			Highcharts chart = PieChart.getBuilder().setChartTitle("Index Info").setHeight(400).setData(data).setYAxisAllowDecimals(false).build();
			card.add(chart);
			chartColumn.add(card);
			row.add(chartColumn);
		});

	}

}