From aa845044ab0909bbea203fcf3c861a813670523d Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 3 Feb 2015 11:55:16 +0000 Subject: [PATCH] Fixed Layout git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@111611 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ExtractCodelistDetailsCard.java | 15 +-- ...xtractCodelistOperationInProgressCard.java | 93 +++++++++++-------- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java index 355159d..9b58091 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java @@ -102,15 +102,16 @@ public class ExtractCodelistDetailsCard extends WizardCard { automaticallyAttachTrue = new Radio(); automaticallyAttachTrue.setBoxLabel("True"); automaticallyAttachTrue.setValue(true); + automaticallyAttachFalse = new Radio(); automaticallyAttachFalse.setBoxLabel("False"); - - ToggleGroup automticallyAttachGroup = new ToggleGroup(); - automticallyAttachGroup.add(automaticallyAttachTrue); - automticallyAttachGroup.add(automaticallyAttachFalse); - - automticallyAttachGroup + + ToggleGroup automaticallyAttachGroup = new ToggleGroup(); + automaticallyAttachGroup.add(automaticallyAttachTrue); + automaticallyAttachGroup.add(automaticallyAttachFalse); + + automaticallyAttachGroup .addValueChangeHandler(new ValueChangeHandler>() { @Override @@ -141,7 +142,7 @@ public class ExtractCodelistDetailsCard extends WizardCard { "Automatically attach the generated codelist")); FieldLabel fieldAttach = new FieldLabel(automaticallyAttachPanel, "Attach"); - p.add(fieldAttach, new VerticalLayoutData(1, -1, new Margins(0))); + p.add(fieldAttach, new VerticalLayoutData(-1, -1, new Margins(0))); // // diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java index 8ef70d1..efefd39 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java @@ -109,7 +109,6 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard "Collateral id is null", new Throwable( "Collateral id is null")); } - TDGWTServiceAsync.INSTANCE.setTabResourceToFinal(collateralTRId, new AsyncCallback() { @@ -165,70 +164,82 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard } - private void createChangeColumnSession(ArrayList refColumns){ - ColumnData orig=extractCodelistSession.getAttachColumn(); - ColumnTypeCode origColumnTypeCode= ColumnTypeMap.getColumnTypeCode(orig.getTypeCode()); - ColumnDataType origColumnDataType= ColumnTypeMap.getColumnDataType(orig.getDataTypeName()); - - String labelOfAttachColumn=null; - ColumnTypeCode typeCodeOfColumnAttach=null; - for(ExtractCodelistTargetColumn targetCol:extractCodelistSession.getTargetColumns()){ - if(targetCol.getSourceColumn().getColumnId().compareTo(orig.getColumnId())==0){ - if(targetCol.isNewColumn()){ - labelOfAttachColumn=targetCol.getDefColumn().getLabel(); - typeCodeOfColumnAttach=targetCol.getDefColumn().getColumnType(); + private void createChangeColumnSession(ArrayList refColumns) { + ColumnData orig = extractCodelistSession.getAttachColumn(); + ColumnTypeCode origColumnTypeCode = ColumnTypeMap + .getColumnTypeCode(orig.getTypeCode()); + ColumnDataType origColumnDataType = ColumnTypeMap + .getColumnDataType(orig.getDataTypeName()); + + String labelOfAttachColumn = null; + ColumnTypeCode typeCodeOfColumnAttach = null; + for (ExtractCodelistTargetColumn targetCol : extractCodelistSession + .getTargetColumns()) { + if (targetCol.getSourceColumn().getColumnId() + .compareTo(orig.getColumnId()) == 0) { + if (targetCol.isNewColumn()) { + labelOfAttachColumn = targetCol.getDefColumn().getLabel(); + typeCodeOfColumnAttach = targetCol.getDefColumn() + .getColumnType(); } else { - labelOfAttachColumn=targetCol.getTargetColumn().getLabel(); - typeCodeOfColumnAttach=ColumnTypeMap.getColumnTypeCode(targetCol.getTargetColumn().getTypeCode()); + labelOfAttachColumn = targetCol.getTargetColumn() + .getLabel(); + typeCodeOfColumnAttach = ColumnTypeMap + .getColumnTypeCode(targetCol.getTargetColumn() + .getTypeCode()); } break; } } - - ColumnData codelistColumnReference=null; - - if(labelOfAttachColumn==null){ - showErrorAndHide( - "Error in extract codelist", + + ColumnData codelistColumnReference = null; + + if (labelOfAttachColumn == null) { + showErrorAndHide("Error in extract codelist", "An error occured no label retrieved for attach column", - "No label retrieved for attach column", new Throwable("No label retrieved for attach column")); + "No label retrieved for attach column", new Throwable( + "No label retrieved for attach column")); return; } else { - for(ColumnData refColumn:refColumns){ - if(refColumn.getLabel().compareTo(labelOfAttachColumn)==0){ - if(ColumnTypeMap.getColumnTypeCode(refColumn.getTypeCode()).compareTo(typeCodeOfColumnAttach)==0){ - codelistColumnReference=refColumn; + for (ColumnData refColumn : refColumns) { + if (refColumn.getLabel().compareTo(labelOfAttachColumn) == 0) { + if (ColumnTypeMap + .getColumnTypeCode(refColumn.getTypeCode()) + .compareTo(typeCodeOfColumnAttach) == 0) { + codelistColumnReference = refColumn; break; } else { - + } } - + } } - if(codelistColumnReference!=null){ - ColumnTypeCode columnTypeCodeTarget = ColumnTypeMap.getColumnTypeCode(codelistColumnReference.getTypeCode()); - ColumnDataType columnDataTypeTarget = ColumnTypeMap.getColumnDataType(codelistColumnReference.getDataTypeName()); - - ChangeColumnTypeSession changeColumnTypeSession=new - ChangeColumnTypeSession(orig, origColumnTypeCode, origColumnDataType, columnTypeCodeTarget, columnDataTypeTarget, codelistColumnReference); + if (codelistColumnReference != null) { + ColumnTypeCode columnTypeCodeTarget = ColumnTypeCode.DIMENSION; + + ChangeColumnTypeSession changeColumnTypeSession = new ChangeColumnTypeSession( + orig, origColumnTypeCode, origColumnDataType, + columnTypeCodeTarget, null, codelistColumnReference); callChangeColumnType(changeColumnTypeSession); } else { - showErrorAndHide( - "Error in extract codelist", + showErrorAndHide("Error in extract codelist", "An error occured no attach column match", - "No attach column match", new Throwable("No attach column match")); + "No attach column match", new Throwable( + "No attach column match")); } } private void callChangeColumnType( - ChangeColumnTypeSession changeColumnTypeSession) { + ChangeColumnTypeSession changeColumnTypeSession) { TDGWTServiceAsync.INSTANCE.startChangeColumnType( changeColumnTypeSession, new AsyncCallback() { public void onFailure(Throwable caught) { if (caught instanceof TDGWTSessionExpiredException) { - getEventBus().fireEvent(new SessionExpiredEvent( - SessionExpiredType.EXPIREDONSERVER)); + getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); } else { showErrorAndHide( "Error in extract codelist", @@ -238,7 +249,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard } public void onSuccess(String taskId) { - automaticallyAttached=true; + automaticallyAttached = true; openMonitorDialog(taskId); }