public void afterEncodingType() { refreshLayout(getForm(Form.MAIN)); }
@Override public void setupProperties() { super.setupProperties(); List<String> defaultEncodings = getDefaultEncodings(); if (defaultEncodings.size() > 0) { encodingType.setPossibleValues(getProperties()); encodingType.setValue(defaultEncodings.get(0)); } }
@Override public String convertToDatum(byte[] value) { // byte[] to String with specified encoding return value == null ? null : Charset.forName(properties.encoding.getEncoding()).decode(ByteBuffer.wrap(value)).toString(); }
@Test public void testEncodingTypeProperties() throws Throwable { EncodingTypeProperties defaultProperties = (EncodingTypeProperties) new EncodingTypeProperties( "defaultEncodingProperties").init(); Form defaultMainForm = defaultProperties.getForm(Form.MAIN); assertEquals(EncodingTypeProperties.ENCODING_TYPE_ISO_8859_15, defaultProperties.encodingType.getValue()); assertFalse(defaultMainForm.getWidget("encodingType").isHidden()); EncodingTypeProperties specifyProperties = (EncodingTypeProperties) new EncodingTypeProperties( "defaultEncodingProperties") { }; }.init(); Form specifyMainForm = specifyProperties.getForm(Form.MAIN); assertEquals("UTF-16", specifyProperties.encodingType.getValue()); assertFalse(specifyMainForm.getWidget("encodingType").isHidden());
@Override public void setupLayout() { super.setupLayout(); Form mainForm = Form.create(this, Form.MAIN); mainForm.addRow(main.getForm(Form.REFERENCE)); mainForm.addRow(widget(fileName).setWidgetType(Widget.FILE_WIDGET_TYPE)); Form advancedForm = Form.create(this, Form.ADVANCED); advancedForm.addRow(advancedSeparator); advancedForm.addRow(thousandsSeparator); advancedForm.addColumn(decimalSeparator); advancedForm.addRow(encoding.getForm(Form.MAIN)); Form wizardForm = Form.create(this, FORM_WIZARD); wizardForm.addRow(name); wizardForm.addRow(widget(fileName).setWidgetType(Widget.FILE_WIDGET_TYPE)); wizardForm.addRow(encoding.getForm(Form.MAIN)); wizardForm.addRow(rowSeparator); wizardForm.addColumn(fieldSeparator); wizardForm.addRow(csvOptions); wizardForm.addRow(escapeChar); wizardForm.addColumn(textEnclosure); wizardForm.addRow(header); wizardForm.addColumn(footer); wizardForm.addRow(removeEmptyRow); wizardForm.addRow(limit); wizardForm.addRow(widget(preview).setLongRunning(true).setWidgetType(Widget.BUTTON_WIDGET_TYPE)); // TODO need add "Schema" to edit schema // wizardForm.addColumn(main.getForm(Form.REFERENCE)); wizardForm.addRow(widget(previewTable).setWidgetType(Widget.JSON_TABLE_WIDGET_TYPE)); }
@Override public void setupProperties() { super.setupProperties(); encoding.encodingType.setPossibleValues(encoding.getDefaultEncodings()); encoding.encodingType.setValue(EncodingTypeProperties.ENCODING_TYPE_ISO_8859_15); nbRandom.setValue(10); setSchemaListener(new ISchemaListener() { @Override public void afterSchema() { updateOutputSchemas(); beforeDecodeTable(); } }); }
assertEquals("Encoding", encodingType.getDisplayName()); assertFalse(formWizard.getWidget(wizardProps.encoding.getName()).isHidden()); assertFalse(encodingForm.getWidget(wizardProps.encoding.encodingType.getName()).isHidden()); assertTrue(encodingForm.getWidget(wizardProps.encoding.customEncoding.getName()).isHidden());
@Override public void setupProperties() { super.setupProperties(); useOsRowSeparator.setValue(true); creatDirIfNotExist.setValue(true); splitEvery.setValue(1000); flushOnRowNum.setValue(1); encoding.encodingType.setPossibleValues(encoding.getDefaultEncodings()); encoding.encodingType.setValue(EncodingTypeProperties.ENCODING_TYPE_ISO_8859_15); }
Form encodingForm = wizardForm.getChildForm(props.encoding.getName()); assertFalse(encodingForm.getWidget(props.encoding.encodingType.getName()).isHidden()); assertTrue(encodingForm.getWidget(props.encoding.customEncoding.getName()).isHidden());
public void afterEncodingType() { refreshLayout(getForm(Form.MAIN)); }
@Override public void setupProperties() { super.setupProperties(); List<String> defaultEncodings = getDefaultEncodings(); if (defaultEncodings.size() > 0) { encodingType.setPossibleValues(getProperties()); encodingType.setValue(defaultEncodings.get(0)); } }
assertFalse(inputAdvancedForm.getWidget(input.checkDate.getName()).isHidden()); assertFalse(input.checkDate.getValue()); Form encodingForm = inputAdvancedForm.getChildForm(input.encoding.getName()); assertFalse(encodingForm.getWidget(input.encoding.encodingType.getName()).isHidden()); assertTrue(encodingForm.getWidget(input.encoding.customEncoding.getName()).isHidden());
public FileOutputDelimitedRuntime(TFileOutputDelimitedProperties props) { this.props = props; this.useStream = props.targetIsStream.getValue(); this.encoding = props.encoding.getEncoding(); setFieldSeparator(props.fieldSeparator.getValue()); setRowSeparator(props.rowSeparator.getValue()); if (props.csvOptions.getValue()) { setEscapeAndTextEnclosure(props.escapeChar.getValue(), props.textEnclosure.getValue()); } init(); }