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

The following examples show how to use gwt.material.design.client.constants.ProgressType. 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   Source File: MaterialProgressTest.java    License: Apache License 2.0 6 votes vote down vote up
protected void checkProgressBar(MaterialProgress progress) {
    assertNotNull(progress);
    // Check default type
    progress.setType(ProgressType.INDETERMINATE);
    assertEquals(ProgressType.INDETERMINATE, progress.getType());
    progress.setType(ProgressType.DETERMINATE);
    assertEquals(ProgressType.DETERMINATE, progress.getType());

    progress.setPercent(90);
    assertEquals((double) 90, progress.getPercent());
    // Get the target widget for percentage update
    assertNotNull(progress.getWidget(0));
    assertTrue(progress.getWidget(0) instanceof MaterialWidget);
    MaterialWidget progressDiv = (MaterialWidget) progress.getWidget(0);
    assertEquals("90%", progressDiv.getElement().getStyle().getWidth());
    // Check color
    MaterialWidgetTest.checkColor(progress);
}
 
Example 2
Source Project: gwt-material   Source File: ProgressMixin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void showProgress(ProgressType type) {
    if (uiObject instanceof MaterialCollapsibleItem) {
        applyCollapsibleProgress(true);
    } else if (uiObject instanceof MaterialNavBar) {
        ((MaterialNavBar) uiObject).add(progress);
    }
}
 
Example 3
Source Project: gwt-material-demo   Source File: LoaderView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnShowNavBarProgress")
void onShowNavBarProgress(ClickEvent e) {
    navBar.showProgress(ProgressType.INDETERMINATE);
    Timer t = new Timer() {
        @Override
        public void run() {
            navBar.hideProgress();
        }
    };
    t.schedule(3000);
}
 
Example 4
Source Project: gwt-material-addins   Source File: QuestionProgress.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    totalLabel.setHideOn(HideOn.HIDE_ON_SMALL_DOWN);
    add(totalLabel);

    progress.setPercent(50);
    progress.setType(ProgressType.DETERMINATE);
    add(progress);

    reset();
}
 
Example 5
Source Project: gwt-material   Source File: MaterialCollapsibleItem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void showProgress(ProgressType type) {
    getProgressMixin().showProgress(type);
}
 
Example 6
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialProgress() {
    super(CssName.PROGRESS);
    getElement().getStyle().setMargin(0, Unit.PX);
    add(fillContainer);
    setType(ProgressType.INDETERMINATE);
}
 
Example 7
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialProgress(ProgressType type) {
    this();
    setType(type);
}
 
Example 8
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialProgress(ProgressType type, Double percent) {
    this(type);
    setPercent(percent);
}
 
Example 9
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setType(ProgressType type) {
    getTypeMixin().setType(type);
}
 
Example 10
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ProgressType getType() {
    return getTypeMixin().getType();
}
 
Example 11
Source Project: gwt-material   Source File: MaterialProgress.java    License: Apache License 2.0 4 votes vote down vote up
protected CssTypeMixin<ProgressType, MaterialProgress> getTypeMixin() {
    if (typeMixin == null) {
        typeMixin = new CssTypeMixin<>(this, fillContainer);
    }
    return typeMixin;
}
 
Example 12
Source Project: gwt-material-addins   Source File: MaterialAutoComplete.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void showProgress(ProgressType type) {
    getProgressMixin().showProgress(ProgressType.INDETERMINATE);
}
 
Example 13
protected void checkStructure(MaterialFileUploader fileUploader) {
    // when / then
    assertEquals(1, fileUploader.getWidgetCount());
    assertTrue(fileUploader.getWidget(0) instanceof MaterialUploadPreview);
    MaterialUploadPreview uploadPreview = (MaterialUploadPreview) fileUploader.getWidget(0);
    assertEquals(uploadPreview, fileUploader.getUploadPreview());
    // Upload Header
    assertNotNull(uploadPreview.getWidget(0));
    assertTrue(uploadPreview.getWidget(0) instanceof MaterialUploadHeader);
    MaterialUploadHeader header = (MaterialUploadHeader) uploadPreview.getWidget(0);
    assertEquals(header, fileUploader.getUploadPreview().getUploadHeader());
    // Uploaded Files Label
    assertTrue(header.getWidget(0) instanceof Span);
    Span uploadedfiles = (Span) header.getWidget(0);
    assertEquals(AddinsCssName.NO_UPLOADED_FILES, uploadedfiles.getId());
    // Close Icon
    assertTrue(header.getWidget(1) instanceof MaterialIcon);
    MaterialIcon iconClose = (MaterialIcon) header.getWidget(1);
    assertEquals(IconType.CLOSE, iconClose.getIconType());
    assertEquals(AddinsCssName.UPLOAD_CLOSE, iconClose.getId());
    // Minimize Icon
    assertTrue(header.getWidget(2) instanceof MaterialIcon);
    MaterialIcon iconMinimize = (MaterialIcon) header.getWidget(2);
    assertEquals(IconType.KEYBOARD_ARROW_DOWN, iconMinimize.getIconType());
    assertEquals(AddinsCssName.UPLOAD_COLAPS, iconMinimize.getId());
    // Total Progress
    assertTrue(header.getWidget(3) instanceof MaterialProgress);
    MaterialProgress progress = (MaterialProgress) header.getWidget(3);
    assertEquals(ProgressType.DETERMINATE, progress.getType());
    assertEquals(AddinsCssName.TOTAL_UPLOAD_PROGRESS, progress.getId());
    // Upload Collection
    assertNotNull(uploadPreview.getWidget(1));
    assertTrue(uploadPreview.getWidget(1) instanceof MaterialUploadCollection);
    MaterialUploadCollection collection = (MaterialUploadCollection) uploadPreview.getWidget(1);
    assertEquals(collection, fileUploader.getUploadPreview().getUploadCollection());
    assertTrue(collection.getElement().hasClassName(AddinsCssName.PREVIEWS));
    assertTrue(collection.getElement().hasClassName(CssName.CARD));
    // Collection Item
    assertTrue(collection.getWidget(0) instanceof MaterialCollectionItem);
    MaterialCollectionItem item = (MaterialCollectionItem) collection.getWidget(0);
    assertEquals(AddinsCssName.ZDROP_TEMPLATE, item.getId());
    assertTrue(item.getElement().hasClassName(AddinsCssName.CLEARHACK));
    assertTrue(item.getElement().hasClassName(CssName.VALIGN_WRAPPER));
    assertTrue(item.getElement().hasClassName(AddinsCssName.ITEM_TEMPLATE));
    // Upload Information
    assertTrue(item.getWidget(0) instanceof MaterialWidget);
    MaterialWidget dropInfo = (MaterialWidget) item.getWidget(0);
    assertTrue(dropInfo.getElement().hasAttribute("data-dz-thumbnail"));
    assertTrue(dropInfo.getElement().hasClassName(CssName.LEFT));
    assertTrue(dropInfo.getElement().hasClassName(AddinsCssName.PV));
    assertTrue(dropInfo.getElement().hasClassName(AddinsCssName.ZDROP_INFO));
    // Name Wrapper
    assertTrue(dropInfo.getWidget(0) instanceof MaterialWidget);
    MaterialWidget nameWrapper = (MaterialWidget) dropInfo.getWidget(0);
    // Name
    assertTrue(nameWrapper.getWidget(0) instanceof Span);
    Span name = (Span) nameWrapper.getWidget(0);
    assertTrue(name.getElement().hasAttribute("data-dz-name"));
    // Size
    assertTrue(nameWrapper.getWidget(1) instanceof Span);
    Span size = (Span) nameWrapper.getWidget(1);
    assertTrue(size.getElement().hasAttribute("data-dz-size"));
    // Preview Icon
    assertTrue(dropInfo.getWidget(1) instanceof MaterialIcon);
    MaterialIcon previewIcon = (MaterialIcon) dropInfo.getWidget(1);
    assertEquals(IconType.INSERT_DRIVE_FILE, previewIcon.getIconType());
    assertTrue(previewIcon.getElement().hasClassName(AddinsCssName.PREVIEW_ICON));
    // Upload Progress
    assertTrue(dropInfo.getWidget(2) instanceof MaterialProgress);
    MaterialProgress currentProgress = (MaterialProgress) dropInfo.getWidget(2);
    assertEquals(ProgressType.DETERMINATE, currentProgress.getType());
    assertTrue(currentProgress.getWidget(0).getElement().hasAttribute("data-dz-uploadprogress"));
    // Error Wrapper
    assertTrue(dropInfo.getWidget(3) instanceof MaterialWidget);
    MaterialWidget errorWrapper = (MaterialWidget) dropInfo.getWidget(3);
    assertTrue(errorWrapper.getElement().hasClassName(AddinsCssName.DZ_ERROR_MESSAGE));
    assertTrue(errorWrapper.getWidget(0) instanceof Span);
    Span errorMessage = (Span) errorWrapper.getWidget(0);
    assertTrue(errorMessage.getElement().hasAttribute("data-dz-errormessage"));
    assertEquals(AddinsCssName.ERROR_MESSAGE, errorMessage.getId());
    assertTrue(item.getWidget(1) instanceof MaterialCollectionSecondary);
    MaterialCollectionSecondary secondary = (MaterialCollectionSecondary) item.getWidget(1);
    assertTrue(secondary.getWidget(0) instanceof MaterialButton);
    MaterialButton btnClear = (MaterialButton) secondary.getWidget(0);
    assertTrue(btnClear.getElement().hasAttribute("data-dz-remove"));
    assertTrue(btnClear.getElement().hasClassName(AddinsCssName.PH));
}
 
Example 14
Source Project: gwt-material   Source File: HasProgress.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets Indeterminate progress.
 */
void showProgress(ProgressType type);
 
Example 15
protected void setupLoader() {
    progress.setType(ProgressType.INDETERMINATE);

}