Skip to content

Commit

Permalink
Merge pull request #20 from elvisisking/teiiddes-1426
Browse files Browse the repository at this point in the history
TEIIDDES-1426 Number of preview lines when importing flat file is the enter values in reverse order issue
  • Loading branch information
blafond committed Sep 12, 2012
2 parents a14f510 + e651c4a commit de94d38
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.teiid.core.util.CoreArgCheck;
import org.teiid.core.util.I18nUtil;
import org.teiid.designer.core.util.StringUtilities;
import org.teiid.designer.transformation.ui.UiConstants;
Expand Down Expand Up @@ -84,11 +85,15 @@ private static String getString(final String id, final Object param) {
boolean synchronizing = false;

/**
* @param info the import data (cannot be <code>null</code>)
* @since 4.0
*/
public TeiidMetadataImportFormatPage(TeiidMetadataImportInfo info) {
super(TeiidMetadataImportFormatPage.class.getSimpleName(), TITLE);
this.info = info;

CoreArgCheck.isNotNull(info, "info"); //$NON-NLS-1$
this.info = info;

setImageDescriptor(UiPlugin.getDefault().getImageDescriptor(
Images.IMPORT_TEIID_METADATA));
}
Expand Down Expand Up @@ -175,9 +180,14 @@ private void synchronizeUI() {
selectedFileText.setText(dataFileInfo.getDataFile().getName());

boolean isDelimitedOption = this.dataFileInfo.doUseDelimitedColumns();

this.numberPreviewLinesText.setText(Integer.toString(this.dataFileInfo.getNumberOfCachedFileLines()));


{ // number of preview lines
final String numLines = Integer.toString(this.dataFileInfo.getNumberOfCachedFileLines());

if (!numLines.equals(this.numberPreviewLinesText.getText())) {
this.numberPreviewLinesText.setText(numLines);
}
}

this.delimitedColumnsRB.setSelection(isDelimitedOption);
this.fixedWidthColumnsRB.setSelection(!isDelimitedOption);
Expand Down Expand Up @@ -355,10 +365,4 @@ private void loadFileContentsViewers() {
}
}
}

public TeiidMetadataFileInfo getFileInfo() {
return this.dataFileInfo;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.teiid.core.util.CoreArgCheck;
import org.teiid.core.util.CoreStringUtil;
import org.teiid.core.util.I18nUtil;
import org.teiid.designer.core.util.StringUtilities;
Expand Down Expand Up @@ -124,11 +125,15 @@ private static String getString(final String id, final Object param) {
boolean synchronizing = false;

/**
* @param info the import data (cannot be <code>null</code>)
* @since 4.0
*/
public TeiidMetadataImportOptionsPage(TeiidMetadataImportInfo info) {
super(TeiidMetadataImportOptionsPage.class.getSimpleName(), DELIMITED_TITLE);
this.info = info;

CoreArgCheck.isNotNull(info, "info"); //$NON-NLS-1$
this.info = info;

setImageDescriptor(UiPlugin.getDefault().getImageDescriptor(
Images.IMPORT_TEIID_METADATA));
}
Expand Down Expand Up @@ -214,9 +219,24 @@ private void synchronizeUI() {
boolean isDelimitedOption = this.dataFileInfo.doUseDelimitedColumns();

this.useHeaderForColumnNamesCB.setSelection(this.dataFileInfo.doUseHeaderForColumnNames());
this.headerLineNumberText.setText(Integer.toString(this.dataFileInfo.getHeaderLineNumber()));
this.delimitedFirstDataRowText.setText(Integer.toString(dataFileInfo.getFirstDataRow()));
this.fixedFirstDataRowText.setText(Integer.toString(dataFileInfo.getFirstDataRow()));

{ // header line number
final String lineNum = Integer.toString(this.dataFileInfo.getHeaderLineNumber());

if (!lineNum.equals(this.headerLineNumberText.getText())) {
this.headerLineNumberText.setText(lineNum);
}
}

{ // data row
final String dataRow = Integer.toString(dataFileInfo.getFirstDataRow());

if (!dataRow.equals(this.delimitedFirstDataRowText.getText())) {
this.delimitedFirstDataRowText.setText(dataRow);
}
}

this.fixedFirstDataRowText.setText(Integer.toString(dataFileInfo.getFirstDataRow()));

boolean enable = isDelimitedOption;
this.useHeaderForColumnNamesCB.setEnabled(enable);
Expand Down Expand Up @@ -1262,10 +1282,6 @@ private void loadFileContentsViewers() {
fixedFileContentsViewer.getDocument().set(sb.toString());
}

public TeiidMetadataFileInfo getFileInfo() {
return this.dataFileInfo;
}

class ColumnDataLabelProvider extends ColumnLabelProvider {

private final int columnNumber;
Expand Down Expand Up @@ -1334,7 +1350,7 @@ class ColumnNameEditingSupport extends EditingSupport {
/**
* Create a new instance of the receiver.
*
* @param viewer
* @param viewer the viewer where the editing support is being provided (cannot be <code>null</code>)
*/
public ColumnNameEditingSupport(ColumnViewer viewer) {
super(viewer);
Expand Down Expand Up @@ -1402,7 +1418,7 @@ class ColumnWidthEditingSupport extends EditingSupport {
/**
* Create a new instance of the receiver.
*
* @param viewer
* @param viewer the viewer where the editing support is being provided (cannot be <code>null</code>)
*/
public ColumnWidthEditingSupport(ColumnViewer viewer) {
super(viewer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.teiid.core.util.CoreArgCheck;
import org.teiid.core.util.CoreStringUtil;
import org.teiid.core.util.I18nUtil;
import org.teiid.designer.core.ModelerCore;
Expand Down Expand Up @@ -107,11 +108,15 @@ private static String getString(final String id, final Object param) {
boolean synchronizing = false;

/**
* @param info the import data (cannot be <code>null</code>)
* @since 4.0
*/
public TeiidMetadataImportViewModelPage(TeiidMetadataImportInfo info) {
super(TeiidMetadataImportViewModelPage.class.getSimpleName(), TITLE);
this.info = info;

CoreArgCheck.isNotNull(info, "info"); //$NON-NLS-1$
this.info = info;

setImageDescriptor(UiPlugin.getDefault().getImageDescriptor(
Images.IMPORT_TEIID_METADATA));
}
Expand Down Expand Up @@ -510,12 +515,18 @@ private void synchronizeUI() {
} else {
this.viewModelFileText.setText(StringUtilities.EMPTY_STRING);
}

if( this.fileInfo.getViewTableName() != null ) {
this.viewTableNameText.setText(this.fileInfo.getViewTableName());
} else {
this.viewTableNameText.setText(StringUtilities.EMPTY_STRING);
}

{ // view table name
final String viewTableName = this.fileInfo.getViewTableName();

if (viewTableName != null) {
if (!viewTableName.equals(viewTableName)) {
this.viewTableNameText.setText(viewTableName);
}
} else {
this.viewTableNameText.setText(StringUtilities.EMPTY_STRING);
}
}

synchronizing = false;
}
Expand Down Expand Up @@ -626,10 +637,4 @@ private boolean viewAlreadyExists() {

return false;
}


public TeiidFileInfo getFileInfo() {
return this.fileInfo;
}

}

0 comments on commit de94d38

Please sign in to comment.