Search in sources :

Example 61 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project drools-wb by kiegroup.

the class AuditLogEntryCellHelper method buildColumnDetailsUpdate.

private void buildColumnDetailsUpdate(final ColumnDetails details, final ColumnDetails originalDetails, final List<BaseColumnFieldDiff> diffs, final SafeHtmlBuilder sb) {
    if ((details instanceof ConditionColumnDetails) && (originalDetails instanceof ConditionColumnDetails)) {
        buildColumnDetailsUpdate((ConditionColumnDetails) details, (ConditionColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof LimitedEntryConditionColumnDetails) && (originalDetails instanceof LimitedEntryConditionColumnDetails)) {
        buildColumnDetailsUpdate((LimitedEntryConditionColumnDetails) details, (LimitedEntryConditionColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof ActionInsertFactColumnDetails) && (originalDetails instanceof ActionInsertFactColumnDetails)) {
        buildColumnDetailsUpdate((ActionInsertFactColumnDetails) details, (ActionInsertFactColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof LimitedEntryActionInsertFactColumnDetails) && (originalDetails instanceof LimitedEntryActionInsertFactColumnDetails)) {
        buildColumnDetailsUpdate((LimitedEntryActionInsertFactColumnDetails) details, (LimitedEntryActionInsertFactColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof ActionSetFieldColumnDetails) && (originalDetails instanceof ActionSetFieldColumnDetails)) {
        buildColumnDetailsUpdate((ActionSetFieldColumnDetails) details, (ActionSetFieldColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof LimitedEntryActionSetFieldColumnDetails) && (originalDetails instanceof LimitedEntryActionSetFieldColumnDetails)) {
        buildColumnDetailsUpdate((LimitedEntryActionSetFieldColumnDetails) details, (LimitedEntryActionSetFieldColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof AttributeColumnDetails) && (originalDetails instanceof AttributeColumnDetails)) {
        buildColumnDetailsUpdate((AttributeColumnDetails) details, (AttributeColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof MetadataColumnDetails) && (originalDetails instanceof MetadataColumnDetails)) {
        buildColumnDetailsUpdate((MetadataColumnDetails) details, (MetadataColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof ActionWorkItemColumnDetails) && (originalDetails instanceof ActionWorkItemColumnDetails)) {
        buildColumnDetailsUpdate((ActionWorkItemColumnDetails) details, (ActionWorkItemColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof ActionWorkItemInsertFactColumnDetails) && (originalDetails instanceof ActionWorkItemInsertFactColumnDetails)) {
        buildColumnDetailsUpdate((ActionWorkItemInsertFactColumnDetails) details, (ActionWorkItemInsertFactColumnDetails) originalDetails, diffs, sb);
    } else if ((details instanceof ActionWorkItemSetFieldColumnDetails) && (originalDetails instanceof ActionWorkItemSetFieldColumnDetails)) {
        buildColumnDetailsUpdate((ActionWorkItemSetFieldColumnDetails) details, (ActionWorkItemSetFieldColumnDetails) originalDetails, diffs, sb);
    } else {
        sb.append(TEMPLATE.commentHeader(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogUpdateColumn(details.getColumnHeader())));
        SafeHtmlBuilder sbFields = null;
        // Show changed fields too.
        if (diffs != null && !diffs.isEmpty()) {
            sbFields = new SafeHtmlBuilder();
            for (BaseColumnFieldDiff diff : diffs) {
                String changedFieldName = diff.getFieldName();
                if (changedFieldName.equals(DTColumnConfig52.FIELD_HEADER)) {
                    buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ColumnHeader(), diff.getOldValue(), diff.getValue(), sbFields);
                } else if (changedFieldName.equals(DTColumnConfig52.FIELD_HIDE_COLUMN)) {
                    buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.HideThisColumn(), diff.getOldValue(), diff.getValue(), sbFields);
                } else if (changedFieldName.equals(DTColumnConfig52.FIELD_DEFAULT_VALUE)) {
                    buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DefaultValue(), diff.getOldValue(), diff.getValue(), sbFields);
                }
            }
        }
        if (sbFields != null) {
            sb.append(TEMPLATE.updatedFields(sbFields.toSafeHtml(), labelClass));
        }
    }
}
Also used : LimitedEntryConditionColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryConditionColumnDetails) ConditionColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ConditionColumnDetails) ActionWorkItemSetFieldColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ActionWorkItemSetFieldColumnDetails) MetadataColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.MetadataColumnDetails) LimitedEntryConditionColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryConditionColumnDetails) LimitedEntryActionSetFieldColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryActionSetFieldColumnDetails) LimitedEntryActionInsertFactColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryActionInsertFactColumnDetails) ActionWorkItemColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ActionWorkItemColumnDetails) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) AttributeColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.AttributeColumnDetails) ActionInsertFactColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ActionInsertFactColumnDetails) LimitedEntryActionInsertFactColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryActionInsertFactColumnDetails) ActionWorkItemInsertFactColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ActionWorkItemInsertFactColumnDetails) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) LimitedEntryActionSetFieldColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.LimitedEntryActionSetFieldColumnDetails) ActionSetFieldColumnDetails(org.drools.workbench.models.guided.dtable.shared.auditlog.ActionSetFieldColumnDetails)

Example 62 with SafeHtmlBuilder

use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project drools-wb by kiegroup.

the class WidthCalculator method getElementWidth.

/**
 * Get the width of a single item
 * @param value
 * @return
 */
public int getElementWidth(final V value) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    cell.render(null, value, sb);
    div.setInnerHTML(sb.toSafeHtml().asString());
    int width = div.getClientWidth();
    if (minWidth == null) {
        return div.getClientWidth();
    }
    return minWidth > width ? minWidth : width;
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Aggregations

SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)62 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)12 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)10 Column (com.google.gwt.user.cellview.client.Column)10 MenuItem (com.google.gwt.user.client.ui.MenuItem)7 Cell (com.google.gwt.cell.client.Cell)5 Command (com.google.gwt.user.client.Command)5 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)4 TextCell (com.google.gwt.cell.client.TextCell)4 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 Test (org.junit.Test)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)3 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)3 SingleSelectionModel (com.google.gwt.view.client.SingleSelectionModel)3 Application (cz.metacentrum.perun.webgui.model.Application)3 CustomClickableTextCell (cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell)3 PerunAppTypeCell (cz.metacentrum.perun.webgui.widgets.cells.PerunAppTypeCell)3 AppCommand (org.rstudio.core.client.command.AppCommand)3 ButtonCell (com.google.gwt.cell.client.ButtonCell)2