Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: Return table column data type #85

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataType;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;

/**
Expand All @@ -27,7 +28,7 @@ public class TableColumnHeader {
private final long fId;
private final String fName;
private final @Nullable String fDescription;
private final @Nullable String fType;
private final DataType fType;

/**
* Constructor
Expand All @@ -40,7 +41,7 @@ public TableColumnHeader(ITmfTreeDataModel dataModel) {
List<@NonNull String> labels = dataModel.getLabels();
fName = dataModel.getLabels().get(0);
fDescription = labels.size() >= 2 ? dataModel.getLabels().get(1) : null;
fType = null;
fType = dataModel.getDataType();
}

/**
Expand Down Expand Up @@ -75,7 +76,7 @@ public String getDescription() {
*
* @return The type of the column
*/
public String getType() {
public DataType getType() {
return fType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.List;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataType;
import org.eclipse.tracecompass.tmf.core.model.ITableColumnDescriptor;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
Expand All @@ -40,7 +39,7 @@ public class TreeModelWrapper {
public static class TreeColumnHeader {
private final String fName;
private final String fTooltip;
private final @Nullable String fDataType;
private final DataType fDataType;

/**
* Constructor with only the name
Expand All @@ -55,12 +54,7 @@ public static class TreeColumnHeader {
public TreeColumnHeader(String name, String tooltip, DataType dataType) {
fName = name;
fTooltip = tooltip;
if (dataType.equals(DataType.STRING)) {
// Default case
fDataType = null;
} else {
fDataType = dataType.name();
}
fDataType = dataType;
}

/**
Expand All @@ -85,7 +79,7 @@ public String getTooltip() {
*
* @return data type.
*/
public @Nullable String getDataType() {
public DataType getDataType() {
return fDataType;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void serialize(TreeColumnHeader value, JsonGenerator gen, SerializerProvi
gen.writeStringField("name", value.getName()); //$NON-NLS-1$
gen.writeStringField("tooltip", value.getTooltip()); //$NON-NLS-1$
if (value.getDataType() != null) {
gen.writeStringField("dataType", value.getDataType()); //$NON-NLS-1$
gen.writeStringField("dataType", value.getDataType().name()); //$NON-NLS-1$
}
gen.writeEndObject();
}
Expand Down
Loading