Fixed Layout for GXT 3.1.1

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@101952 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-12-05 16:48:51 +00:00
parent dff54ac883
commit 9010e76d76
5 changed files with 101 additions and 36 deletions

View File

@ -93,11 +93,13 @@ public class ChangeColumnTypePanel extends FramedPanel implements
private ChangeColumnTypeDialog parent;
private TRId trId;
private String columnName;
private ColumnData columnChangeType;
private ColumnData sourceColumnChangeType;
private ColumnData columnRequested;
private ColumnData connectionColumn;
private ComboBox<ColumnData> comboColumn = null;
private ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
private FieldLabel comboColumnTypeCodeLabel;
private ComboBox<ColumnDataTypeElement> comboMeasureType = null;
private FieldLabel comboMeasureTypeLabel;
@ -140,7 +142,13 @@ public class ChangeColumnTypePanel extends FramedPanel implements
this.columnName = columnName;
this.eventBus = eventBus;
panelCreated = false;
retrieveColumnRequested();
if (columnName != null && !columnName.isEmpty()) {
retrieveColumnRequested();
} else {
panelCreated = true;
create();
}
}
protected void retrieveColumnRequested() {
@ -271,6 +279,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnTypeCode.setTypeAhead(true);
comboColumnTypeCode.setTriggerAction(TriggerAction.ALL);
comboColumnTypeCodeLabel = new FieldLabel(comboColumnTypeCode,
"Column Type");
// comboMeasureType
ColumnDataTypeProperties propsMeasureType = GWT
.create(ColumnDataTypeProperties.class);
@ -446,8 +456,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(new FieldLabel(comboColumn, "Column"), new VerticalLayoutData(1,
-1, new Margins(1)));
v.add(new FieldLabel(comboColumnTypeCode, "Column Type"),
new VerticalLayoutData(1, -1, new Margins(1)));
v.add(comboColumnTypeCodeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(comboLocaleTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(comboMeasureTypeLabel, new VerticalLayoutData(1, -1, new Margins(
@ -467,6 +477,12 @@ public class ChangeColumnTypePanel extends FramedPanel implements
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
add(v, new VerticalLayoutData(-1, -1, new Margins(0)));
resetToInitialState();
// addButton();
}
protected void resetToInitialState() {
comboMeasureTypeLabel.setVisible(false);
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
@ -474,8 +490,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
comboLocaleTypeLabel.setVisible(false);
// addButton();
}
protected void addHandlersForComboColumn(
@ -620,7 +634,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
+ "!"));
Log.debug("ComboColumnReferenceType selected: "
+ event.getSelectedItem());
ColumnData columnReference = event.getSelectedItem();
updateConfBtnChange(columnReference);
// TODO Mapping fix
/*
* comboColumnMapping.reset();
@ -804,15 +819,15 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected void setComboStatus(ArrayList<ColumnData> result) {
Log.debug("ColumnRequested: " + columnRequested);
String columnId;
if (columnRequested.isViewColumn()) {
columnId = columnRequested.getColumnViewData()
.getSourceTableDimensionColumnId();
} else {
columnId = columnRequested.getColumnId();
}
if (columnRequested != null) {
String columnId;
if (columnRequested.isViewColumn()) {
columnId = columnRequested.getColumnViewData()
.getSourceTableDimensionColumnId();
} else {
columnId = columnRequested.getColumnId();
}
for (ColumnData cd : result) {
Log.debug("Column:" + cd.getColumnId());
if (cd.getColumnId().compareTo(columnId) == 0) {
@ -820,15 +835,20 @@ public class ChangeColumnTypePanel extends FramedPanel implements
return;
}
}
} else {
change.disable();
comboColumnTypeCode.reset();
comboColumnTypeCodeLabel.setVisible(false);
}
}
protected void updateComboStatus(ColumnData cd) {
columnChangeType = cd;
Log.debug("Update Combos ColumnData: " + cd.toString());
sourceColumnChangeType = cd;
Log.debug("Update Combos ColumnData: " + cd);
changeColumnTypeSession = new ChangeColumnTypeSession();
changeColumnTypeSession.setColumnData(cd);
comboColumn.setValue(cd);
comboColumnTypeCodeLabel.setVisible(true);
comboColumnTypeCode.setValue(ColumnTypeCodeStore.selectedElement(cd
.getTypeCode()));
ColumnTypeCode type = ColumnTypeCodeStore.selected(cd.getTypeCode());
@ -887,7 +907,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements
public void update(TRId trId, String columnName) {
this.trId = trId;
this.columnName = columnName;
retrieveColumnRequested();
if (columnName != null && !columnName.isEmpty()) {
retrieveColumnRequested();
} else {
columnRequested = null;
comboColumn.reset();
comboDimensionType.clear();
resetToInitialState();
// Reset comboDimensionType
comboDimensionType.reset();
comboDimensionType.clear();
storeComboDimensionType.commitChanges();
loader.load();
}
}
protected void retrieveConnectionForViewColumn(RefColumn refCol) {
@ -930,6 +966,28 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
protected void updateConfBtnChange(ColumnData columnReference) {
if (connectionColumn == null) {
if (columnReference != null) {
change.enable();
} else {
change.disable();
}
} else {
if (columnReference == null) {
change.disable();
} else {
if (columnReference.getColumnId().compareTo(
connectionColumn.getColumnId()) == 0) {
change.disable();
} else {
change.enable();
}
}
}
}
protected void updateConfBtnChange(ColumnTypeCode columnTypeCode) {
if (columnTypeCode == null) {
ColumnTypeCodeElement codeElement = comboColumnTypeCode.getValue();
@ -946,8 +1004,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
// TODO
protected void configureBtnChange(ColumnTypeCode columnTypeCode) {
ColumnTypeCode sourceTypeCode = ColumnTypeMap
.getColumnTypeCode(columnChangeType.getTypeCode());
.getColumnTypeCode(sourceColumnChangeType.getTypeCode());
switch (sourceTypeCode) {
case ANNOTATION:

View File

@ -10,7 +10,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
* Edit Row
* Dialog to create a column definition
* used in extract codelist widget
*
* @author "Giancarlo Panichi"
*

View File

@ -235,9 +235,10 @@ public class CreateDefColumnPanel extends FramedPanel {
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnSave, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
vPanel.add(form, new VerticalLayoutData(1, -1));

View File

@ -152,13 +152,14 @@ public class ConnectCodelistDialog extends Window implements
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnApply, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(comboDimensionTypeLabel, new VerticalLayoutData(1, -1));
v.add(comboColumnReferenceTypeLabel, new VerticalLayoutData(1, -1));
v.add(flowButton, new VerticalLayoutData(-1, 36,
v.add(flowButton, new VerticalLayoutData(1, 36,
new Margins(5, 2, 5, 2)));
panel.add(v);
@ -290,9 +291,11 @@ public class ConnectCodelistDialog extends Window implements
storeComboColumnReferenceType.clear();
storeComboColumnReferenceType.addAll(result);
storeComboColumnReferenceType.commitChanges();
comboColumnReferenceTypeLabel.setVisible(true);
comboColumnReferenceType.setMinListWidth(191);
comboColumnReferenceTypeLabel.forceLayout();
}
});

View File

@ -202,9 +202,11 @@ public class ReplacePanel extends FramedPanel implements
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnApply, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
VerticalLayoutContainer v = new VerticalLayoutContainer();
if (column.getDataTypeName().compareTo("Date") == 0) {
@ -217,7 +219,7 @@ public class ReplacePanel extends FramedPanel implements
v.add(new FieldLabel(replaceValue, "Replace"),
new VerticalLayoutData(1, -1));
}
v.add(flowButton, new VerticalLayoutData(-1, 36,
v.add(flowButton, new VerticalLayoutData(1, 36,
new Margins(5, 2, 5, 2)));
add(v);
@ -278,14 +280,15 @@ public class ReplacePanel extends FramedPanel implements
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnApply, boxLayoutData);
flowButton.add(btnClose, boxLayoutData);
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1));
v.add(comboDimensionTypeLabel, new VerticalLayoutData(1, -1));
v.add(flowButton, new VerticalLayoutData(-1, 36,
v.add(flowButton, new VerticalLayoutData(1, 36,
new Margins(5, 2, 5, 2)));
add(v);