Example usage for com.vaadin.server FontAwesome CHECK_CIRCLE

List of usage examples for com.vaadin.server FontAwesome CHECK_CIRCLE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome CHECK_CIRCLE.

Prototype

FontAwesome CHECK_CIRCLE

To view the source code for com.vaadin.server FontAwesome CHECK_CIRCLE.

Click Source Link

Usage

From source file:org.eclipse.hawkbit.ui.filtermanagement.AutoCompleteTextFieldComponent.java

License:Open Source License

private static void setInitialStatusIconStyle(final Label statusIcon) {
    statusIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    statusIcon.setStyleName("hide-status-label");
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterTable.java

License:Open Source License

private Component getStatusIcon(final Object itemId) {
    final Item row1 = getItem(itemId);
    final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1
            .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
    final Label label = new LabelBuilder().name("").buildLabel();
    label.setContentMode(ContentMode.HTML);
    if (targetStatus == TargetUpdateStatus.PENDING) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_PENDING));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
        label.setValue(FontAwesome.ADJUST.getHtml());
    } else if (targetStatus == TargetUpdateStatus.REGISTERED) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_REGISTERED));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
        label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
    } else if (targetStatus == TargetUpdateStatus.ERROR) {
        label.setDescription(i18n.getMessage(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_ERROR)));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.IN_SYNC) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_INSYNC));
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.UNKNOWN) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TARGET_STATUS_UNKNOWN));
        label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml());
    }//from w w w. j  a v  a  2s .c  o m
    return label;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

/**
 * Get status icon./*from  w  w w  . ja  va 2  s .c  om*/
 *
 * @param status
 *            as Status
 * @return Label as UI
 */
private Label getStatusIcon(final Action.Status status) {
    final Label label = new LabelBuilder().name("").buildLabel();
    final String statusIconPending = "statusIconPending";
    label.setContentMode(ContentMode.HTML);
    if (Action.Status.FINISHED == status) {
        label.setDescription(i18n.get("label.finished"));
        label.setStyleName(STATUS_ICON_GREEN);
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else if (Action.Status.ERROR == status) {
        label.setDescription(i18n.get("label.error"));
        label.setStyleName("statusIconRed");
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (Action.Status.WARNING == status) {
        label.setStyleName("statusIconOrange");
        label.setDescription(i18n.get("label.warning"));
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (Action.Status.RUNNING == status) {
        // dynamic spinner
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.running"));
        label.setValue(FontAwesome.ADJUST.getHtml());
    } else if (Action.Status.CANCELING == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.cancelling"));
        label.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
    } else if (Action.Status.CANCELED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.cancelled"));
        label.setStyleName(STATUS_ICON_GREEN);
        label.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
    } else if (Action.Status.RETRIEVED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.retrieved"));
        label.setValue(FontAwesome.CIRCLE_O.getHtml());
    } else if (Action.Status.DOWNLOAD == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.download"));
        label.setValue(FontAwesome.CLOUD_DOWNLOAD.getHtml());
    } else if (Action.Status.SCHEDULED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.scheduled"));
        label.setValue(FontAwesome.HOURGLASS_1.getHtml());
    } else {
        label.setDescription("");
        label.setValue("");
    }
    return label;

}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

/**
 * Create Status Label.//from  w  w w  .j a va  2  s  . co  m
 *
 * @param activeValue
 *            as String
 * @return Labeal as UI
 */
private static Label createActiveStatusLabel(final String activeValue, final boolean endedWithError) {
    final Label label = new LabelBuilder().name("").buildLabel();
    label.setContentMode(ContentMode.HTML);
    if (SPUIDefinitions.SCHEDULED.equals(activeValue)) {
        label.setDescription("Scheduled");
        label.setValue(FontAwesome.HOURGLASS_1.getHtml());
    } else if (SPUIDefinitions.ACTIVE.equals(activeValue)) {
        label.setDescription("Active");
        label.setStyleName("statusIconActive");
    } else if (SPUIDefinitions.IN_ACTIVE.equals(activeValue)) {
        if (endedWithError) {
            label.setStyleName("statusIconRed");
        } else {
            label.setStyleName("statusIconNeutral");
        }
        label.setDescription("In-active");
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else {
        label.setValue("");
    }
    return label;
}

From source file:org.inakirj.imagerulette.screens.DiceGallerySetupView.java

License:Open Source License

/**
 * Adds the row./*from   w ww  . j  ava  2 s . c o m*/
 */
public void addRow(String urlEntry) {
    DiceItem itemCreated = new DiceItem();
    Button validateButton = new Button();
    validateButton.setIcon(FontAwesome.CHECK_CIRCLE_O);
    validateButton.addClickListener(e -> validateUrl(itemCreated));
    itemCreated.setValidateImg(validateButton);
    Image imgRow = null;
    String url = null;
    if (urlEntry != null) {
        StringTokenizer urlEntryTokenizer = new StringTokenizer(urlEntry, " ");
        url = urlEntryTokenizer.nextToken();
        ExternalResource resource = new ExternalResource(url);
        imgRow = new Image("", resource);
        itemCreated.setId(getNextId());
    } else {
        imgRow = new Image("", null);
    }
    imgRow.addStyleName("dice-image");
    imgRow.addStyleName("dice-align-center");
    itemCreated.setImg(imgRow);
    TextField textRow = new TextField();
    textRow.addStyleName("url-style");
    if (url != null) {
        textRow.setValue(url);
        validateButton.setIcon(FontAwesome.CHECK_CIRCLE);
    }
    itemCreated.setUrl(textRow);
    if (urlEntry != null) {
        itemCreated.getUrl().setEnabled(false);
    }
    itemCreated.setValid(imgRow != null);

    Button deleteButton = new Button();
    deleteButton.setIcon(FontAwesome.TRASH);
    itemCreated.setDeleteImg(deleteButton);
    deleteButton.addClickListener(e -> deleteUrl(itemCreated));

    newDataSource.addBean(itemCreated);
    hasReachLimitImages = newDataSource.size() == TOTAL_URL_LIMIT;
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlRunner.java

License:Open Source License

@Override
public void run() {
    TypedProperties properties = settings.getProperties();
    boolean resultsAsText = properties.is(SQL_EXPLORER_RESULT_AS_TEXT);
    int maxResultsSize = properties.getInt(SQL_EXPLORER_MAX_RESULTS);
    String delimiter = properties.get(SQL_EXPLORER_DELIMITER);
    boolean ignoreWhenRunAsScript = properties.is(SQL_EXPLORER_IGNORE_ERRORS_WHEN_RUNNING_SCRIPTS);

    List<Component> resultComponents = new ArrayList<Component>();
    FontAwesome icon = FontAwesome.CHECK_CIRCLE;
    rowsUpdated = false;//www.java2 s . com
    boolean committed = false;
    boolean autoCommitBefore = true;
    try {
        DataSource dataSource = db.getPlatform().getDataSource();
        JdbcSqlTemplate sqlTemplate = (JdbcSqlTemplate) db.getPlatform().getSqlTemplate();
        stmt = null;
        StringBuilder results = new StringBuilder();
        try {
            if (connection == null) {
                connection = dataSource.getConnection();
                connection.setAutoCommit(autoCommit);
            }

            autoCommitBefore = connection.getAutoCommit();
            if (connection.getTransactionIsolation() != sqlTemplate.getIsolationLevel()) {
                connection.setTransactionIsolation(sqlTemplate.getIsolationLevel());
            }
            if (sqlTemplate.isRequiresAutoCommitFalseToSetFetchSize()) {
                connection.setAutoCommit(false);
            }

            SqlScriptReader sqlReader = null;
            try {
                sqlReader = new SqlScriptReader(new StringReader(sqlText));
                sqlReader.setDelimiter(delimiter);
                String sql = sqlReader.readSqlStatement();
                while (sql != null) {
                    JdbcSqlTemplate.close(stmt);
                    if (db.getPlatform().getName().equals("voltdb")) {
                        stmt = connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE,
                                ResultSet.CONCUR_READ_ONLY);
                    } else {
                        stmt = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,
                                ResultSet.CONCUR_READ_ONLY);
                    }

                    String lowercaseSql = sql.trim().toLowerCase();
                    if (!lowercaseSql.startsWith("delete") && !lowercaseSql.startsWith("update")
                            && !lowercaseSql.startsWith("insert")) {
                        if (db.getPlatform().getName().equals(DatabaseNamesConstants.MYSQL)) {
                            stmt.setFetchSize(Integer.MIN_VALUE);
                        } else {
                            stmt.setFetchSize(maxResultsSize < 100 ? maxResultsSize : 100);
                        }
                    }

                    if (logAtDebug) {
                        log.debug("[" + db.getName() + "] Executing: {}", sql.trim());

                    } else {
                        log.info("[" + db.getName() + "] Executing: {}", sql.trim());
                    }
                    if (sql.replaceAll("\\s", "").equalsIgnoreCase(COMMIT_COMMAND)) {
                        committed = true;
                    } else {
                        committed = false;
                    }

                    boolean hasResults = false;
                    try {
                        hasResults = stmt.execute();
                    } catch (SQLException e) {
                        if (runAsScript && ignoreWhenRunAsScript) {
                            results.append(sql);
                            results.append("\n");
                            results.append(buildErrorMessage(e));
                            results.append("\n");
                            results.append("\n");
                        } else {
                            throw e;
                        }
                    }
                    int updateCount = stmt.getUpdateCount();
                    while (hasResults || updateCount != -1) {
                        ResultSet rs = null;
                        try {
                            if (hasResults) {
                                rs = stmt.getResultSet();
                                if (!runAsScript) {
                                    if (!resultsAsText) {
                                        resultComponents.add(new TabularResultLayout(explorer, db, sql, rs,
                                                listener, user, settings, queryPanel, showSqlOnResults,
                                                isInQueryGeneralResults));
                                    } else {
                                        resultComponents.add(putResultsInArea(stmt, maxResultsSize));
                                    }
                                } else {
                                    int rowsRetrieved = 0;
                                    while (rs.next()) {
                                        rowsRetrieved++;
                                    }
                                    results.append(sql);
                                    results.append("\n");
                                    results.append("Rows Retrieved: ");
                                    results.append(rowsRetrieved);
                                    results.append("\n");
                                    results.append("\n");
                                }
                            } else {
                                rowsUpdated = updateCount > 0 ? true : false;
                                if (!runAsScript) {
                                    resultComponents.add(wrapTextInComponent(
                                            String.format("%d rows affected", updateCount)));
                                } else {
                                    results.append(sql);
                                    results.append("\n");
                                    results.append("Rows Affected: ");
                                    results.append(updateCount);
                                    results.append("\n");
                                    results.append("\n");
                                }
                            }
                            hasResults = stmt.getMoreResults();
                            updateCount = stmt.getUpdateCount();
                        } finally {
                            JdbcSqlTemplate.close(rs);
                        }
                    }

                    sql = sqlReader.readSqlStatement();

                }

            } finally {
                IOUtils.closeQuietly(sqlReader);
            }

        } catch (Throwable ex) {
            if (isCanceled) {
                String canceledMessage = "Canceled successfully.\n\n" + sqlText;
                resultComponents.add(wrapTextInComponent(canceledMessage));
            } else {
                icon = FontAwesome.BAN;
                resultComponents.add(wrapTextInComponent(buildErrorMessage(ex), "marked"));
            }
        } finally {
            if (autoCommitBefore) {
                try {
                    connection.commit();
                    connection.setAutoCommit(autoCommitBefore);
                } catch (SQLException e) {
                }
            }
            JdbcSqlTemplate.close(stmt);
            if (autoCommit || (!autoCommit && !rowsUpdated && createdConnection)) {
                JdbcSqlTemplate.close(connection);
                connection = null;
            }

        }

        if (resultComponents.size() == 0 && StringUtils.isNotBlank(results.toString())) {
            resultComponents
                    .add(wrapTextInComponent(results.toString(), icon == FontAwesome.BAN ? "marked" : null));
        }

    } finally {
        endTime = new Date();
        if (listener != null) {
            listener.finished(icon, resultComponents, endTime.getTime() - startTime.getTime(),
                    !autoCommit && rowsUpdated, committed);
        } else if (!autoCommit) {
            rollback(connection);
        }

    }
}