Java Code Examples for gwt.material.design.client.constants.Color

The following examples show how to use gwt.material.design.client.constants.Color. 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-patterns   Source File: InboxCollapsible.java    License: Apache License 2.0 6 votes vote down vote up
public InboxCollapsible(InboxDTO dto) {
    initWidget(uiBinder.createAndBindUi(this));
    lblCategory.setText(dto.getCategory());
    lblCategory.setTextColor(Color.fromStyleName(dto.getColor()));
    if(dto.getIconType() != null) {
        lblCategory.setIconType(dto.getIconType());
        imgCol.removeFromParent();
    }
    if(dto.getImageUrl() != null) {
        imgCategory.setUrl(dto.getImageUrl());
    }
    lblDescription.setText(dto.getDescription());

    if(dto.getChildren().size() > 0) {
        MaterialCollapsible colapsChildren = new MaterialCollapsible();
        for(InboxDTO child : dto.getChildren()) {
            colapsChildren.add(new InboxCollapsible(child));
            colapsBody.add(colapsChildren);
        }
    }else {
        colapsBody.removeFromParent();
    }
}
 
Example 2
Source Project: gwt-material-addins   Source File: MaterialWindow.java    License: Apache License 2.0 6 votes vote down vote up
public void setToolbarColor(Color toolbarColor) {
    if (toolbarAttachHandler != null) {
        toolbarAttachHandler.removeHandler();
        toolbarAttachHandler = null;
    }

    if (toolbarColor != null) {
        if (toolbar.isAttached()) {
            toolbar.setBackgroundColor(toolbarColor);
        } else {
            if (toolbarAttachHandler == null) {
                toolbarAttachHandler = registerHandler(toolbar.addAttachHandler(attachEvent -> toolbar.setBackgroundColor(toolbarColor)));
            }
        }
    }
}
 
Example 3
Source Project: gwt-material   Source File: MaterialChipTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testStructure() {
    // given
    final String TEXT = "text";
    MaterialChip chip = getWidget();

    // when / then
    chip.setText(TEXT);
    assertEquals(TEXT, chip.getText());
    assertEquals(TEXT, chip.getChipLabel().getText());

    // given
    final IconType icon = IconType.POLYMER;

    // when / then
    chip.setIconType(icon);
    chip.setIconColor(Color.RED);
    assertEquals(icon, chip.getIcon().getIconType());
    assertEquals(Color.RED, chip.getIconColor());

    assertEquals(chip.getChipLabel(), chip.getWidget(0));
    assertEquals(chip.getIcon(), chip.getWidget(1));
}
 
Example 4
Source Project: gwt-material   Source File: MaterialSearchTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testActiveState() {
    // given
    MaterialSearch search = getWidget();

    // when / then
    search.setActive(true);
    assertNotNull(search.getIconClose());
    assertNotNull(search.getIconSearch());

    assertEquals(Color.BLACK, search.getIconClose().getIconColorMixin().getTextColor());
    assertEquals(Color.BLACK, search.getIconSearch().getIconColorMixin().getTextColor());
    search.setActive(false);
    assertEquals(Color.WHITE, search.getIconClose().getIconColorMixin().getTextColor());
    assertEquals(Color.WHITE, search.getIconSearch().getIconColorMixin().getTextColor());

    // when / then
    search.open();
    assertTrue(search.isActive());
    checkOpenHandler(search);

    search.close();
    assertFalse(search.isActive());
    checkCloseHandler(search);
}
 
Example 5
Source Project: lumongo   Source File: CustomTextBox.java    License: Apache License 2.0 6 votes vote down vote up
public CustomTextBox(boolean hasButton) {
	addStyleName(MainResources.GSS.searchBox());

	textBox = new TextBox();
	textBox.setStyleName(MainResources.GSS.searchBoxInput());

	add(textBox);

	if (hasButton) {
		button = new MaterialLink();
		button.setIconType(IconType.SEARCH);
		button.setIconColor(Color.WHITE);
		add(button);
	}

}
 
Example 6
Source Project: lumongo   Source File: FilterQueryWidget.java    License: Apache License 2.0 6 votes vote down vote up
public FilterQueryWidget() {
	addStyleName(MainResources.GSS.searchBox());

	textBox = new TextBox();
	textBox.setStyleName(MainResources.GSS.searchBoxInput());

	add(textBox);

	plusButton = new MaterialLink();
	plusButton.setIconType(IconType.ADD);
	plusButton.setIconColor(Color.WHITE);
	add(plusButton);

	minusButton = new MaterialLink();
	minusButton.setIconType(IconType.REMOVE);
	minusButton.setIconColor(Color.WHITE);

	add(minusButton);

}
 
Example 7
Source Project: gwt-material-demo   Source File: ThemeManager.java    License: Apache License 2.0 6 votes vote down vote up
public static void setColor(Color color, Color darkerColor, Color lighterColor) {
    final long DURATION = 1000 * 60 * 60 * 24 * 14; //duration remembering login - 2 weeks
    Date expires = new Date(System.currentTimeMillis() + DURATION);
    Cookies.setCookie(COLOR, color.getCssName(), expires, null, "/", false);

    for (MaterialWidget w : map.keySet()) {
        switch (map.get(w)) {
            case REGULAR_SHADE:
                w.setBackgroundColor(color);
                break;
            case DARKER_SHADE:
                w.setBackgroundColor(darkerColor);
                break;
            case LIGHTER_SHADE:
                w.setBackgroundColor(lighterColor);
                break;
            default:
                break;
        }
    }
}
 
Example 8
Source Project: gwt-material-addins   Source File: LanguageSelectorItem.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    MaterialColumn imageColumn = new MaterialColumn(4,4,4);
    imageColumn.add(image);

    MaterialColumn nameColumn = new MaterialColumn(8,8,8);
    label.setTextColor(Color.BLACK);
    nameColumn.setPadding(0);
    nameColumn.setTextAlign(TextAlign.LEFT);
    nameColumn.add(label);

    if (language.getImage() != null) {
        add(imageColumn);
    }

    if (language.getName() != null) {
        add(nameColumn);
    }
}
 
Example 9
Source Project: gwt-material-addins   Source File: Walkthrough.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    item.add(submit);
    submit.setFontSize("0.8em");
    submit.setBackgroundColor(Color.WHITE);
    submit.setTextColor(Color.GREY);
    submit.setWaves(WavesType.DEFAULT);
    add(item);

    setType(CarouselType.ONBOARD);
    setLayoutPosition(Style.Position.FIXED);
    setEdgeFriction(0);

    registerHandler(addAfterChangeHandler(event -> animate(event.getCurrentSlide())));
    registerHandler(addInitHandler(event -> animate(0)));
    registerHandler(submit.addClickHandler(clickEvent -> CompleteEvent.fire(this)));
}
 
Example 10
protected void checkProperties(MaterialCircularProgress circularProgress) {
    // Size
    circularProgress.setSize(200);
    assertEquals(200.0, circularProgress.getSize());
    // Thickness
    circularProgress.setThickness(20);
    assertEquals(20, circularProgress.getThickness());
    // Start Angle
    circularProgress.setStartAngle(Math.PI / 2);
    assertEquals(Math.PI / 2, circularProgress.getStartAngle());
    // Fill Color
    circularProgress.setFillColor(Color.RED);
    assertEquals(Color.RED, circularProgress.getFillColor());
    assertNotNull(ColorHelper.setupComputedBackgroundColor(circularProgress.getFillColor()));
    // Empty Fill Color
    circularProgress.setEmptyFillColor(Color.RED_LIGHTEN_2);
    assertEquals(Color.RED_LIGHTEN_2, circularProgress.getEmptyFillColor());
    assertNotNull(ColorHelper.setupComputedBackgroundColor(circularProgress.getEmptyFillColor()));
    // Reverse
    circularProgress.setReverse(true);
    assertTrue(circularProgress.isReverse());
}
 
Example 11
Source Project: lumongo   Source File: QueryView.java    License: Apache License 2.0 6 votes vote down vote up
public QueryView() {
	splitPanel = new MaterialSplitPanel();
	splitPanel.setHeight(Window.getClientHeight() - 102 + "px");
	splitPanel.setBarPosition(25);
	leftPanel = new MaterialPanel();
	leftPanel.setBackgroundColor(Color.WHITE);
	leftPanel.setGrid("s6 l3");
	leftScrollPanel = new ScrollPanel();
	leftScrollPanel.setHeight(Window.getClientHeight() - 130 + "px");

	rightPanel = new MaterialPanel();
	rightPanel.setBackgroundColor(Color.GREY_LIGHTEN_2);
	rightPanel.setGrid("s6 l9");
	rightScrollPanel = new ScrollPanel();
	rightScrollPanel.setHeight(Window.getClientHeight() - 130 + "px");

	splitPanel.add(leftPanel);
	splitPanel.add(rightPanel);

	add(splitPanel);
}
 
Example 12
Source Project: gwt-material   Source File: ColorHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static String setupComputedBackgroundColor(Color color) {
    MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
    temp.setBackgroundColor(color);
    RootPanel.get().add(temp);
    String computed = getComputedBackgroundColor(temp.getElement()).toLowerCase();
    temp.removeFromParent();
    return computed;
}
 
Example 13
Source Project: gwt-material   Source File: ColorHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static Color addShade(Color color, Shade shade, int value) {
    Color shadedColor = color;
    String className = color.getCssName();
    if (className != null && !className.isEmpty() && !hasShade(color) && color != Color.WHITE && color != Color.TRANSPARENT && color != Color.BLACK && color != Color.DEFAULT) {
        if (value > 0 && value < 6) {
            className = className + " " + shade.getName() + "-" + value;
            shadedColor = Color.fromStyleName(className, true);
        }
    }
    return shadedColor;
}
 
Example 14
Source Project: gwt-material-addins   Source File: MaterialWindowTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void checkColor(MaterialWindow window) {
    window.setBackgroundColor(Color.RED);
    assertEquals(Color.RED, window.getBackgroundColor());
    window.setToolbarColor(Color.BLUE);
    assertEquals(Color.BLUE, window.getToolbarColor());
    assertTrue(window.getToolbar().getElement().hasClassName(Color.BLUE.getCssName()));
}
 
Example 15
Source Project: gwt-material   Source File: ColorsMixin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setBackgroundColor(Color bgColor) {
    if (this.bgColor != null) {
        uiObject.removeStyleName(this.bgColor.getCssName());
    }
    this.bgColor = bgColor;

    if (bgColor != null) {
        uiObject.addStyleName(bgColor.getCssName());
    }
}
 
Example 16
Source Project: gwt-material   Source File: ColorsMixin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setTextColor(Color textColor) {
    if (this.textColor != null) {
        uiObject.removeStyleName(ensureTextColorFormat(this.textColor.getCssName()));
    }
    this.textColor = textColor;

    if (this.textColor != null) {
        uiObject.addStyleName(ensureTextColorFormat(textColor.getCssName()));
    }
}
 
Example 17
Source Project: lumongo   Source File: QueryOptionsView.java    License: Apache License 2.0 5 votes vote down vote up
private void createFieldNameCollapsible(IndexInfo indexInfo) {
	MaterialCollapsibleItem item = new MaterialCollapsibleItem();
	item.setVisible(false);
	fieldItems.put(indexInfo.getName(), item);

	MaterialCollapsibleHeader header = new MaterialCollapsibleHeader();
	header.setBackgroundColor(Color.GREY_LIGHTEN_1);
	MaterialLink link = new MaterialLink("'" + indexInfo.getName() + "' fields");
	link.setTextColor(Color.WHITE);
	header.add(link);

	MaterialCollapsibleBody body = new MaterialCollapsibleBody();
	body.setPaddingTop(0);
	body.setBackgroundColor(Color.WHITE);

	CustomTabPanel tabPanel = new CustomTabPanel(TabType.DEFAULT);
	tabPanel.setMarginLeft(-40);
	tabPanel.setMarginRight(-40);

	String qfTabId = UIUtil.getRandomId();
	MaterialTabItem qfTabItem = tabPanel.createAndAddTabListItem("QF", "#" + qfTabId);
	tabPanel.createAndAddTabPane(qfTabId, new FieldsDiv(indexInfo.getQfList(), uiQueryObject.getQueryFields()));
	header.addClickHandler(clickEvent -> qfTabItem.selectTab());

	String flTabId = UIUtil.getRandomId();
	tabPanel.createAndAddTabListItem("FL", "#" + flTabId);
	tabPanel.createAndAddTabPane(flTabId, new FieldsDiv(indexInfo.getFlList(), uiQueryObject.getDisplayFields()));

	String facetsTabId = UIUtil.getRandomId();
	tabPanel.createAndAddTabListItem("Facets", "#" + facetsTabId);
	tabPanel.createAndAddTabPane(facetsTabId, new FieldsDiv(indexInfo.getFacetList(), uiQueryObject.getFacets()));

	body.add(tabPanel);

	item.add(header);
	item.add(body);

	fieldNameCollapsible.add(item);
}
 
Example 18
Source Project: gwt-material   Source File: MaterialTab.java    License: Apache License 2.0 5 votes vote down vote up
public void setIndicatorColor(Color indicatorColor) {
    this.indicatorColor = indicatorColor;

    if (indicatorColorMixin != null && indicatorColor != null) {
        indicatorColorMixin.setBackgroundColor(indicatorColor);
    }
}
 
Example 19
Source Project: gwt-material   Source File: MaterialSearch.java    License: Apache License 2.0 5 votes vote down vote up
public MaterialSearch(String placeholder, Color backgroundColor, Color iconColor, boolean active, int shadow) {
    this(placeholder);
    setBackgroundColor(backgroundColor);
    setIconColor(iconColor);
    setActive(active);
    setShadow(shadow);
}
 
Example 20
Source Project: gwt-material   Source File: EnumHelperTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testFromStyleName() {
    assertEquals(Color.PINK,
        EnumHelper.fromStyleName("pink", Color.class, Color.DEFAULT));

    assertEquals(Color.PINK,
        EnumHelper.fromStyleName("pink lighten-1", Color.class, Color.DEFAULT));

    assertEquals(Color.PINK_LIGHTEN_1,
        EnumHelper.fromStyleName("pink lighten-1", Color.class, Color.DEFAULT, true));
}
 
Example 21
Source Project: gwt-material   Source File: MaterialWidgetTestCase.java    License: Apache License 2.0 5 votes vote down vote up
public static <H extends UIObject & HasColors> void checkColor(H hasColors) {
    final Element element = hasColors.getElement();
    hasColors.setTextColor(Color.WHITE);
    assertTrue(element.hasClassName(Color.WHITE.getCssName() + "-text"));
    hasColors.setBackgroundColor(Color.BLACK);
    assertTrue(element.hasClassName(Color.BLACK.getCssName()));
}
 
Example 22
Source Project: gwt-material-demo   Source File: DataHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static List<Version> getAllVersions() {
    List<Version> versions = new ArrayList<>();
    versions.add(new Version("2.1.1", "August 2018", Version.VersionLink.CORE_2_1_1.getName(), Version.VersionLink.ADDINS_2_1_1.getName(), Version.VersionLink.THEME_2_1_1.getName(), Version.VersionLink.JQUERY_2_1_1.getName(), Version.VersionLink.TABLE_2_1_1.getName(), Color.INDIGO));
    versions.add(new Version("2.1", "July 2018", Version.VersionLink.CORE_2_1.getName(), Version.VersionLink.ADDINS_2_1.getName(), Version.VersionLink.THEME_2_1.getName(), Version.VersionLink.JQUERY_2_1.getName(), Version.VersionLink.TABLE_2_1.getName(), Color.INDIGO));
    versions.add(new Version("2.0.1", "February 2018", Version.VersionLink.CORE_2_0_1.getName(), Version.VersionLink.ADDINS_2_0_1.getName(), Version.VersionLink.THEME_2_0_1.getName(), Version.VersionLink.JQUERY_2_0_1.getName(), Version.VersionLink.TABLE_2_0_1.getName(), Color.GREEN));
    versions.add(new Version("2.0", "November 2017", Version.VersionLink.CORE_2_0.getName(), Version.VersionLink.ADDINS_2_0.getName(), Version.VersionLink.THEME_2_0.getName(), Version.VersionLink.JQUERY_2_0.getName(), Version.VersionLink.TABLE_2_0.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc7", "October 2017", Version.VersionLink.CORE_2_0_RC7.getName(), Version.VersionLink.ADDINS_2_0_RC7.getName(), Version.VersionLink.THEME_2_0_RC7.getName(), Version.VersionLink.JQUERY_2_0_RC7.getName(), Version.VersionLink.TABLE_2_0_RC7.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc6", "July 2017", Version.VersionLink.CORE_2_0_RC6.getName(), Version.VersionLink.ADDINS_2_0_RC6.getName(), Version.VersionLink.THEME_2_0_RC6.getName(), Version.VersionLink.JQUERY_2_0_RC6.getName(), Version.VersionLink.TABLE_2_0_RC6.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc5", "May 2017", Version.VersionLink.CORE_2_0_RC5.getName(), Version.VersionLink.ADDINS_2_0_RC5.getName(), Version.VersionLink.THEME_2_0_RC5.getName(), Version.VersionLink.JQUERY_2_0_RC5.getName(), Version.VersionLink.TABLE_2_0_RC5.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc4", "March 2017", Version.VersionLink.CORE_2_0_RC4.getName(), Version.VersionLink.ADDINS_2_0_RC4.getName(), Version.VersionLink.THEME_2_0_RC4.getName(), Version.VersionLink.JQUERY_1_0_RC4.getName(), Version.VersionLink.TABLE_1_0_RC4.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc3", "November 2016", Version.VersionLink.CORE_2_0_RC3.getName(), Version.VersionLink.ADDINS_2_0_RC3.getName(), Version.VersionLink.THEME_2_0_RC3.getName(), Version.VersionLink.JQUERY_1_0_RC3.getName(), Version.VersionLink.TABLE_1_0_RC3.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc3", "November 2016", Version.VersionLink.CORE_2_0_RC3.getName(), Version.VersionLink.ADDINS_2_0_RC3.getName(), Version.VersionLink.THEME_2_0_RC3.getName(), Version.VersionLink.JQUERY_1_0_RC3.getName(), Version.VersionLink.TABLE_1_0_RC3.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc2", "November 2016", Version.VersionLink.CORE_2_0_RC2.getName(), Version.VersionLink.ADDINS_2_0_RC2.getName(), Version.VersionLink.THEME_2_0_RC2.getName(), Version.VersionLink.JQUERY_1_0_RC2.getName(), Version.VersionLink.TABLE_1_0_RC2.getName(), Color.GREEN));
    versions.add(new Version("2.0-rc1", "October 2016", Version.VersionLink.CORE_2_0_RC1.getName(), Version.VersionLink.ADDINS_2_0_RC1.getName(), Version.VersionLink.THEME_2_0_RC1.getName(), Version.VersionLink.JQUERY_1_0_RC1.getName(), Version.VersionLink.TABLE_1_0_RC1.getName(), Color.GREEN));
    versions.add(new Version("1.6.2", "September 2016", Version.VersionLink.CORE_1_6_2.getName(), Version.VersionLink.ADDINS_1_6_2.getName(), null, null, null, Color.AMBER_DARKEN_2));
    versions.add(new Version("1.6.1", "August 2016", Version.VersionLink.CORE_1_6_1.getName(), null, null, null, null, Color.DEEP_ORANGE_ACCENT_2));
    versions.add(new Version("1.6.0", "August 2016", Version.VersionLink.CORE_1_6_0.getName(), Version.VersionLink.ADDINS_1_6_0.getName(), Version.VersionLink.THEME_1_6_0.getName(), null, null, Color.BROWN_DARKEN_1));
    versions.add(new Version("1.5.3", "July 2016", Version.VersionLink.CORE_1_5_3.getName(), null, null, null, null, Color.TEAL));
    versions.add(new Version("1.5.2", "June 2016", Version.VersionLink.CORE_1_5_2.getName(), Version.VersionLink.ADDINS_1_5_2.getName(), Version.VersionLink.THEME_1_5_2.getName(), null, null, Color.PINK_ACCENT_1));
    versions.add(new Version("1.5.1", "June 2016", Version.VersionLink.CORE_1_5_1.getName(), Version.VersionLink.ADDINS_1_5_1.getName(), Version.VersionLink.THEME_1_5_1.getName(), null, null, Color.TEAL));
    versions.add(new Version("1.5.0", "April 2016", Version.VersionLink.CORE_1_5_0.getName(), Version.VersionLink.ADDINS_1_5_0.getName(), Version.VersionLink.THEME_1_5_0.getName(), null, null, Color.DEEP_ORANGE));
    versions.add(new Version("1.4.1", "January 2016", Version.VersionLink.CORE_1_4_1.getName(), null, Version.VersionLink.THEME_1_4.getName(), null, null, Color.RED));
    versions.add(new Version("1.4", "November 2015", Version.VersionLink.CORE_1_4.getName(), null, Version.VersionLink.THEME_1_4.getName(), null, null, Color.PURPLE));
    versions.add(new Version("1.3.3", "July 2015", Version.VersionLink.CORE_1_3_3.getName(), null, null, null, null, Color.PINK));
    versions.add(new Version("1.3.2", "June 2015", Version.VersionLink.CORE_1_3_2.getName(), null, null, null, null, Color.BROWN));
    versions.add(new Version("1.3.1", "April 2015", Version.VersionLink.CORE_1_3_1.getName(), null, null, null, null, Color.RED));
    versions.add(new Version("1.3", "April 2015", Version.VersionLink.CORE_1_3.getName(), null, null, null, null, Color.BLUE));
    versions.add(new Version("1.2", "April 2015", Version.VersionLink.CORE_1_2.getName(), null, null, null, null, Color.GREEN));
    versions.add(new Version("1.0", "April 2015", Version.VersionLink.CORE_1.getName(), null, null, null, null, Color.AMBER));
    return versions;
}
 
Example 23
Source Project: gwt-material-demo   Source File: Apps.java    License: Apache License 2.0 5 votes vote down vote up
public Apps(String name, String owner, String ownerImage, String link, String image, Color color) {
    this.name = name;
    this.owner = owner;
    this.ownerImage = ownerImage;
    this.link = link;
    this.image = image;
    this.color = color;
}
 
Example 24
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnFinish")
void onFinishDialog(ClickEvent e) {
    MaterialTreeItem item = new MaterialTreeItem();
    item.setText(txtName.getText());
    item.setIconType(IconType.FOLDER);
    item.setIconColor(Color.BLUE);
    docTree.getSelectedItem().addItem(item);
    MaterialPathAnimator.reverseAnimate(btnAdd.getElement(), addOverlay.getElement());
}
 
Example 25
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("withBackground")
void withBackground(ValueChangeEvent<Boolean> e) {
    if (e.getValue()) {
        animator.setBackgroundColor(Color.RED);
    } else {
        animator.setBackgroundColor(Color.WHITE);
    }
}
 
Example 26
Source Project: gwt-material-demo   Source File: SignaturePadView.java    License: Apache License 2.0 5 votes vote down vote up
protected void chooseColor(MaterialColumn widget) {
    Color color = widget.getBackgroundColor();
    if (color != null) {
        signaturePad.setPenColor(ColorHelper.setupComputedBackgroundColor(color));
    }
    colorSelected.setText("Pen Color : " + color.name());
    colorSelected.setTextColor(color);
}
 
Example 27
Source Project: gwt-material-addins   Source File: MaterialComboBoxTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void testColor() {
    super.testColor();

    // given
    MaterialComboBox<User> comboBox = getWidget();

    // when / then
    comboBox.setTextColor(Color.RED);
    assertEquals(Color.RED, comboBox.getTextColor());
}
 
Example 28
Source Project: gwt-material-demo   Source File: ThemeManager.java    License: Apache License 2.0 5 votes vote down vote up
public static void loadTheme(ThemeLoader.ThemeBundle themeBundle) {
    ThemeLoader.loadAsync(themeBundle, new ThemeLoader.ThemeAsyncCallback() {
        @Override
        public void onSuccess(int resourceCount) {
            if (themeBundle == ThemeAmber.INSTANCE) {
                setColor(Color.AMBER, Color.AMBER_DARKEN_3, Color.AMBER_LIGHTEN_2);
            } else if (themeBundle == ThemeBlue.INSTANCE) {
                setColor(Color.BLUE, Color.BLUE_DARKEN_3, Color.BLUE_LIGHTEN_2);
            } else if (themeBundle == ThemeBrown.INSTANCE) {
                setColor(Color.BROWN, Color.BROWN_DARKEN_3, Color.BROWN_LIGHTEN_2);
            } else if (themeBundle == ThemeGreen.INSTANCE) {
                setColor(Color.GREEN, Color.GREEN_DARKEN_3, Color.GREEN_LIGHTEN_2);
            } else if (themeBundle == ThemeGrey.INSTANCE) {
                setColor(Color.GREY, Color.GREY_DARKEN_3, Color.GREY_LIGHTEN_2);
            } else if (themeBundle == ThemeOrange.INSTANCE) {
                setColor(Color.ORANGE, Color.ORANGE_DARKEN_3, Color.ORANGE_LIGHTEN_2);
            } else if (themeBundle == ThemePink.INSTANCE) {
                setColor(Color.PINK, Color.PINK_DARKEN_3, Color.PINK_LIGHTEN_2);
            } else if (themeBundle == ThemePurple.INSTANCE) {
                setColor(Color.PURPLE, Color.PURPLE_DARKEN_3, Color.PURPLE_LIGHTEN_2);
            } else if (themeBundle == ThemeRed.INSTANCE) {
                setColor(Color.RED, Color.RED_DARKEN_3, Color.RED_LIGHTEN_2);
            } else if (themeBundle == ThemeYellow.INSTANCE) {
                setColor(Color.YELLOW, Color.YELLOW_DARKEN_3, Color.YELLOW_LIGHTEN_2);
            }
        }

        @Override
        public void onFailure(Throwable reason) {
            MaterialToast.fireToast(reason.getMessage());
        }
    });
}
 
Example 29
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 30
Source Project: gwt-material-addins   Source File: LoadingStatePanel.java    License: Apache License 2.0 5 votes vote down vote up
public void setState(State state, String title, String description) {
    this.state = state;
    setTitle(title);
    setDescription(description);
    setVisible(true);
    if (isAnimation()) {
        new MaterialAnimation().transition(Transition.BOUNCEIN).animate(icon);
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblTitle);
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblDescription);
    }
    if (state == State.LOADING) {
        icon.setIconType(IconType.LOOP);
        icon.setBackgroundColor(Color.WHITE);
        icon.setIconColor(Color.BLACK);
        LoadingEvent.fire(this);
        loader.show();

    } else if (state == State.SUCCESS) {
        loader.hide();
        icon.setIconType(IconType.CHECK);
        icon.setBackgroundColor(Color.BLUE);
        icon.setIconColor(Color.WHITE);

        SuccessEvent.fire(this);
    } else if (state == State.ERROR) {
        loader.hide();
        icon.setIconType(IconType.ERROR);
        icon.setBackgroundColor(Color.RED);
        icon.setIconColor(Color.WHITE);

        ErrorEvent.fire(this);
    }
}