Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant.

Prototype

public static SafeHtml fromSafeConstant(String s) 

Source Link

Document

Returns a SafeHtml constructed from a safe string, i.e., without escaping the string.

Usage

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseDetailsViewImpl.java

License:Apache License

public BaseDetailsViewImpl(boolean create, boolean editable) {
    this.create = create;
    this.editable = editable;
    errorPanel = new AlertPanel(Type.ERROR);
    kaaAdminStyle = Utils.kaaAdminStyle;
    avroUiStyle = Utils.avroUiStyle;// w w w  . ja v  a 2  s .  co  m
    initWidget(uiBinder.createAndBindUi(this));
    constructTopPanel();

    getTitileLabelWidget().setText(Utils.constants.title());
    getSaveButtonWidget().setText(Utils.constants.save());
    getCancelButtonWidget().setText(Utils.constants.cancel());
    requiredFieldsNoteLabel.getElement().setInnerSafeHtml(SafeHtmlUtils
            .fromSafeConstant(Utils.messages.requiredFieldsNote(Utils.avroUiStyle.requiredField())));

    if (create) {
        getTitileLabelWidget().setText(getCreateTitle());
        getCancelButtonWidget().setVisible(true);
    } else {
        getTitileLabelWidget().setText(getViewTitle());
        getBackButtonPanelWidget().setVisible(true);
    }
    subTitleLabel.setText(getSubTitle());

    updateSaveButton(false, false);

    detailsTable.getColumnFormatter().setWidth(0, "200px");
    detailsTable.getColumnFormatter().setWidth(1, "300px");
    if (!create) {
        detailsTable.getColumnFormatter().setWidth(2, "300px");
    }

    getSaveButtonWidget().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            updateSaveButton(false, false);
            hasChanged = false;
        }
    });
    getSaveButtonWidget().setVisible(editable);
    requiredFieldsNoteLabel.setVisible(editable);

    initDetailsTable();

    clearError();
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.config.ConfigSchemaGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<ConfigurationSchemaDto> table, float prefWidth) {
    float result = super.constructActions(table, prefWidth);
    if (!embedded
            && (downloadBaseSchemaColumn == null || table.getColumnIndex(downloadBaseSchemaColumn) == -1)) {
        Header<SafeHtml> downloadBaseSchemaHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadBaseSchema()));

        downloadBaseSchemaColumn = constructDownloadBaseSchemaColumnColumn("");
        table.addColumn(downloadBaseSchemaColumn, downloadBaseSchemaHeader);
        table.setColumnWidth(downloadBaseSchemaColumn, ACTION_COLUMN_WIDTH, Style.Unit.PX);
        result += ACTION_COLUMN_WIDTH;//from   w  w  w .j  ava2  s.  c  o  m
    }

    if (!embedded && (downloadOverrideSchemaColumn == null
            || table.getColumnIndex(downloadOverrideSchemaColumn) == -1)) {
        Header<SafeHtml> downloadOverrideSchemaHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadOverrideSchema()));

        downloadOverrideSchemaColumn = constructDownloadOverrideSchemaColumnColumn("");
        table.addColumn(downloadOverrideSchemaColumn, downloadOverrideSchemaHeader);
        table.setColumnWidth(downloadOverrideSchemaColumn, ACTION_COLUMN_WIDTH, Style.Unit.PX);
        result += ACTION_COLUMN_WIDTH;
    }
    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.event.EventClassesGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<EventClassDto> table, float prefWidth) {
    if (enableActions) {
        float result = 0;
        if (viewSchemaColumn == null || table.getColumnIndex(viewSchemaColumn) == -1) {
            Header<SafeHtml> viewSchemaHeader = new SafeHtmlHeader(
                    SafeHtmlUtils.fromSafeConstant(Utils.constants.schema()));

            viewSchemaColumn = constructViewSchemaColumn("");
            table.addColumn(viewSchemaColumn, viewSchemaHeader);
            table.setColumnWidth(viewSchemaColumn, 40, Unit.PX);
            result += 40;/* w  w w  .j  a v a  2  s . c o m*/
        }
        return result;
    } else {
        return 0;
    }
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.event.EventMapGrid.java

License:Apache License

@Override
protected float constructColumnsImpl(DataGrid<ApplicationEventMapDto> table) {
    float prefWidth = 0;

    prefWidth += constructStringColumn(table, Utils.constants.fqn(),
            new StringValueProvider<ApplicationEventMapDto>() {
                @Override//from  ww w . j  a v a2  s .  c  o  m
                public String getValue(ApplicationEventMapDto item) {
                    return item.getFqn();
                }
            }, 160);

    final Renderer<ApplicationEventAction> actionRenderer = new Renderer<ApplicationEventAction>() {

        @Override
        public String render(ApplicationEventAction action) {
            return Utils.constants.getString(action.name().toLowerCase());
        }

        @Override
        public void render(ApplicationEventAction action, Appendable appendable) throws IOException {
            appendable.append(render(action));
        }
    };

    if (enableActions) {
        List<ApplicationEventAction> actions = new ArrayList<>();
        for (ApplicationEventAction action : ApplicationEventAction.values()) {
            actions.add(action);
        }

        ValueSelectionCell<ApplicationEventAction> actionsCell = new ValueSelectionCell<>(actions,
                actionRenderer);

        Column<ApplicationEventMapDto, ApplicationEventAction> actionColumn = new Column<ApplicationEventMapDto, ApplicationEventAction>(
                actionsCell) {
            @Override
            public ApplicationEventAction getValue(ApplicationEventMapDto object) {
                return object.getAction();
            }
        };

        Header<SafeHtml> actionHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.action()));

        table.addColumn(actionColumn, actionHeader);
        actionColumn.setFieldUpdater(new FieldUpdater<ApplicationEventMapDto, ApplicationEventAction>() {
            @Override
            public void update(int index, ApplicationEventMapDto object, ApplicationEventAction value) {
                object.setAction(value);
            }
        });
        table.setColumnWidth(actionColumn, 80, Unit.PX);
        prefWidth += 80;
    } else {
        prefWidth += constructStringColumn(table, Utils.constants.action(),
                new StringValueProvider<ApplicationEventMapDto>() {
                    @Override
                    public String getValue(ApplicationEventMapDto item) {
                        return actionRenderer.render(item.getAction());
                    }
                }, 80);
    }

    return prefWidth;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.log.LogSchemaGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<LogSchemaDto> table, float prefWidth) {
    float result = super.constructActions(table, prefWidth);
    if (!embedded && (downloadLibraryColumn == null || table.getColumnIndex(downloadLibraryColumn) == -1)) {
        Header<SafeHtml> downloadLibraryHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordLibrary()));

        downloadLibraryColumn = constructDownloadLibraryColumn("");
        table.addColumn(downloadLibraryColumn, downloadLibraryHeader);
        table.setColumnWidth(downloadLibraryColumn, ACTION_COLUMN_WIDTH, Unit.PX);
        result += ACTION_COLUMN_WIDTH;/*w  w w.  ja  v  a  2 s .  co m*/
    }
    if (enableActions) {
        if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) {
            Header<SafeHtml> deleteHeader = new SafeHtmlHeader(SafeHtmlUtils
                    .fromSafeConstant(embedded ? Utils.constants.remove() : Utils.constants.delete()));

            deleteColumn = constructDeleteColumn("");
            table.addColumn(deleteColumn, deleteHeader);
            table.setColumnWidth(deleteColumn, ACTION_COLUMN_WIDTH, Unit.PX);
            result += ACTION_COLUMN_WIDTH;
        }

    }
    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.plugin.BasePluginGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<T> table, float prefWidth) {

    float result = 0;
    if (!embedded && (downloadPropsColumn == null || table.getColumnIndex(downloadPropsColumn) == -1)) {
        Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.configuration()));
        downloadPropsColumn = constructDownloadSchemaColumn("");
        table.addColumn(downloadPropsColumn, downloadRecordSchemaHeader);
        table.setColumnWidth(downloadPropsColumn, ACTION_COLUMN_WIDTH, Unit.PX);
        result += ACTION_COLUMN_WIDTH;//  w  w  w .j  av a2  s .c  o m
    }
    result += super.constructActions(table, prefWidth);
    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.schema.BaseCtlSchemasGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<T> table, float prefWidth) {
    float result = 0;
    if (downloadSchemaColumn == null || table.getColumnIndex(downloadSchemaColumn) == -1) {
        Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordSchema()));
        downloadSchemaColumn = constructDownloadSchemaColumn();
        table.addColumn(downloadSchemaColumn, downloadRecordSchemaHeader);
        table.setColumnWidth(downloadSchemaColumn, 60, Unit.PX);
        result += 60;//w  w  w. jav  a 2  s.c o  m
    }
    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.schema.BaseSchemasGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<T> table, float prefWidth) {
    float result = 0;
    if (!embedded && (downloadSchemaColumn == null || table.getColumnIndex(downloadSchemaColumn) == -1)) {
        Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader(
                SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordSchema()));
        downloadSchemaColumn = constructDownloadSchemaColumn("");
        table.addColumn(downloadSchemaColumn, downloadRecordSchemaHeader);
        table.setColumnWidth(downloadSchemaColumn, ACTION_COLUMN_WIDTH, Unit.PX);
        result += ACTION_COLUMN_WIDTH;/* w  ww  .  j a v a 2s. com*/
    }
    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.SdkProfilesGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<SdkProfileDto> table, float prefWidth) {
    float result = 0;

    if (enableActions) {
        if (generateSdkColumn == null || table.getColumnIndex(generateSdkColumn) == -1) {
            Header<SafeHtml> generateSdkHeader;
            generateSdkHeader = new SafeHtmlHeader(
                    SafeHtmlUtils.fromSafeConstant(Utils.constants.generateSdk()));

            generateSdkColumn = constructGenerateSdkColumn("");
            table.addColumn(generateSdkColumn, generateSdkHeader);
            table.setColumnWidth(generateSdkColumn, 40, Unit.PX);
            result += 40;//from   w  w w.  j av  a2  s  .  c  o  m
        }

        if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) {
            Header<SafeHtml> deleteHeader;
            if (embedded) {
                deleteHeader = new SafeHtmlHeader(SafeHtmlUtils.fromSafeConstant(Utils.constants.remove()));
            } else {
                deleteHeader = new SafeHtmlHeader(SafeHtmlUtils.fromSafeConstant(Utils.constants.delete()));
            }

            deleteColumn = constructDeleteColumn("");
            table.addColumn(deleteColumn, deleteHeader);
            table.setColumnWidth(deleteColumn, 40, Unit.PX);
            result += 40;
        }
    }

    return result;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.topic.TopicGrid.java

License:Apache License

@Override
protected float constructActions(DataGrid<TopicDto> table, float prefWidth) {
    if (enableActions) {
        float result = 0;
        if (!embedded
                && (sendNotificationColumn == null || table.getColumnIndex(sendNotificationColumn) == -1)) {
            Header<SafeHtml> sendNotificationHeader = new SafeHtmlHeader(
                    SafeHtmlUtils.fromSafeConstant(Utils.constants.sendNotification()));

            sendNotificationColumn = constructSendNotificationColumn("");
            table.addColumn(sendNotificationColumn, sendNotificationHeader);
            table.setColumnWidth(sendNotificationColumn, 40, Unit.PX);
            result += 40;/*from   w w  w .j av  a  2s . com*/
        }
        if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) {
            Header<SafeHtml> deleteHeader = new SafeHtmlHeader(SafeHtmlUtils
                    .fromSafeConstant(embedded ? Utils.constants.remove() : Utils.constants.delete()));

            deleteColumn = constructDeleteColumn("");
            table.addColumn(deleteColumn, deleteHeader);
            table.setColumnWidth(deleteColumn, 40, Unit.PX);
            result += 40;
        }

        return result;
    } else {
        return 0;
    }
}