Added View Columns Export
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@100346 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2c74fac2d2
commit
4673e09ea7
|
@ -46,16 +46,21 @@ import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
|||
*/
|
||||
public class CSVExportConfigCard extends WizardCard {
|
||||
|
||||
private static final int LABEL_WIDTH = 128;
|
||||
private static final int LABEL_PAD_WIDTH = 2;
|
||||
private static final String DEFAULT_DELIMETER = ",";
|
||||
protected CSVExportSession exportSession;
|
||||
|
||||
protected SimpleComboBox<String> encodings;
|
||||
protected TextField customDelimiterField;
|
||||
protected Radio otherDelimiter;
|
||||
protected Radio commaDelimiter;
|
||||
protected Radio spaceDelimiter;
|
||||
protected Radio tabDelimiter;
|
||||
protected Radio semicoloDelimiter;
|
||||
private SimpleComboBox<String> encodings;
|
||||
private TextField customDelimiterField;
|
||||
private Radio otherDelimiter;
|
||||
private Radio commaDelimiter;
|
||||
private Radio spaceDelimiter;
|
||||
private Radio tabDelimiter;
|
||||
private Radio semicoloDelimiter;
|
||||
|
||||
private Radio viewColumnExportTrue;
|
||||
private Radio viewColumnExportFalse;
|
||||
|
||||
protected ColumnDataGridPanel csvColumnGridPanel;
|
||||
|
||||
|
@ -131,8 +136,12 @@ public class CSVExportConfigCard extends WizardCard {
|
|||
}
|
||||
});
|
||||
|
||||
content.add(new FieldLabel(encodings, "File encoding"));
|
||||
FieldLabel fieldEncoding=new FieldLabel(encodings, "File encoding");
|
||||
fieldEncoding.setLabelWidth(LABEL_WIDTH);
|
||||
fieldEncoding.setLabelPad(LABEL_PAD_WIDTH);
|
||||
content.add(fieldEncoding);
|
||||
|
||||
// Delimiter
|
||||
commaDelimiter = new Radio();
|
||||
commaDelimiter.setBoxLabel("Comma");
|
||||
commaDelimiter.setValue(true);
|
||||
|
@ -192,8 +201,35 @@ public class CSVExportConfigCard extends WizardCard {
|
|||
|
||||
new ToolTip(delimitersPanel, new ToolTipConfig(
|
||||
"The delimiter use to delimit the CSV fields"));
|
||||
content.add(new FieldLabel(delimitersPanel, "Delimiter"));
|
||||
FieldLabel fieldDelimeter=new FieldLabel(delimitersPanel, "Delimiter");
|
||||
fieldDelimeter.setLabelWidth(LABEL_WIDTH);
|
||||
fieldDelimeter.setLabelPad(LABEL_PAD_WIDTH);
|
||||
content.add(fieldDelimeter);
|
||||
|
||||
// Export View Column
|
||||
viewColumnExportTrue = new Radio();
|
||||
viewColumnExportTrue.setBoxLabel("True");
|
||||
viewColumnExportTrue.setValue(true);
|
||||
|
||||
viewColumnExportFalse = new Radio();
|
||||
viewColumnExportFalse.setBoxLabel("False");
|
||||
|
||||
ToggleGroup exportViewColumnGroup = new ToggleGroup();
|
||||
exportViewColumnGroup.add(viewColumnExportTrue);
|
||||
exportViewColumnGroup.add(viewColumnExportFalse);
|
||||
|
||||
HorizontalPanel viewColumnExportPanel = new HorizontalPanel();
|
||||
viewColumnExportPanel.add(viewColumnExportTrue);
|
||||
viewColumnExportPanel.add(viewColumnExportFalse);
|
||||
|
||||
new ToolTip(viewColumnExportPanel, new ToolTipConfig(
|
||||
"Export View Columns Too"));
|
||||
FieldLabel fieldViewColumns=new FieldLabel(viewColumnExportPanel, "Export View Columns");
|
||||
fieldViewColumns.setLabelWidth(LABEL_WIDTH);
|
||||
fieldViewColumns.setLabelPad(LABEL_PAD_WIDTH);
|
||||
content.add(fieldViewColumns);
|
||||
|
||||
// Column Selection Grid
|
||||
csvColumnGridPanel = new ColumnDataGridPanel(this);
|
||||
|
||||
csvColumnGridPanel
|
||||
|
@ -223,6 +259,14 @@ public class CSVExportConfigCard extends WizardCard {
|
|||
return ';';
|
||||
return DEFAULT_DELIMETER.charAt(0);
|
||||
}
|
||||
|
||||
protected boolean getExportViewColumns() {
|
||||
if(viewColumnExportTrue.getValue()){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
|
@ -264,6 +308,7 @@ public class CSVExportConfigCard extends WizardCard {
|
|||
exportSession.setColumns(columns);
|
||||
exportSession.setEncoding(encodings.getCurrentValue());
|
||||
exportSession.setSeparator(String.valueOf(getSelectedDelimiter()));
|
||||
exportSession.setExportViewColumns(getExportViewColumns());
|
||||
goNext();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
|
||||
public class ColumnDataGridPanel extends ContentPanel implements
|
||||
HasSelectionHandlers<ColumnData> {
|
||||
//private static final String GRID_WIDTH ="524px";
|
||||
private static final String GRID_HEIGHT = "280px";
|
||||
protected static final ColumnDataProperties props = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
protected final CheckBoxSelectionModel<ColumnData> sm;
|
||||
|
@ -98,14 +100,15 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight(300);
|
||||
grid.setHeight(GRID_HEIGHT);
|
||||
//grid.setWidth(GRID_WIDTH);
|
||||
// grid.getView().setAutoExpandColumn(labelCol);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
grid.setColumnReordering(false);
|
||||
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.setScrollMode(ScrollMode.AUTO);
|
||||
|
|
Loading…
Reference in New Issue