Fixed dimension of panel
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@84254 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d422e65551
commit
96d7251995
|
@ -27,16 +27,21 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SDMXTableDetailCard extends WizardCard {
|
||||
|
||||
protected final String TABLEDETAILPANELWIDTH = "100%";
|
||||
protected final String TABLEDETAILPANELHEIGHT = "100%";
|
||||
protected final String FORMWIDTH = "538px";
|
||||
|
||||
protected SDMXImportSession importSession;
|
||||
protected SDMXTableDetailCard thisCard;
|
||||
|
||||
protected static final AgenciesProperties agenciesProperties = GWT.create(AgenciesProperties.class);
|
||||
protected static final AgenciesProperties agenciesProperties = GWT
|
||||
.create(AgenciesProperties.class);
|
||||
protected VerticalLayoutContainer p = new VerticalLayoutContainer();
|
||||
protected VerticalPanel tableDetailPanel;
|
||||
|
||||
|
@ -51,32 +56,26 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
|
||||
TabResource detail = new TabResource();
|
||||
|
||||
|
||||
|
||||
public SDMXTableDetailCard(final SDMXImportSession importSession) {
|
||||
super("SDMX Table Detail", "");
|
||||
|
||||
this.importSession = importSession;
|
||||
thisCard = this;
|
||||
|
||||
|
||||
tableDetailPanel = new VerticalPanel();
|
||||
|
||||
tableDetailPanel.setSpacing(4);
|
||||
tableDetailPanel.setWidth("100%");
|
||||
tableDetailPanel.setHeight("100%");
|
||||
tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH);
|
||||
tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT);
|
||||
|
||||
|
||||
FramedPanel form2 = new FramedPanel();
|
||||
form2.setHeadingText("Details");
|
||||
form2.setWidth("100%");
|
||||
form2.setHeight("100%");
|
||||
//form2.setWidth(350);
|
||||
FramedPanel form = new FramedPanel();
|
||||
form.setHeadingText("Details");
|
||||
form.setWidth(FORMWIDTH);
|
||||
|
||||
FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setHeadingText("Information");
|
||||
fieldSet.setCollapsible(false);
|
||||
form2.add(fieldSet);
|
||||
form.add(fieldSet);
|
||||
|
||||
// VerticalLayoutContainer p = new VerticalLayoutContainer();
|
||||
fieldSet.add(p);
|
||||
|
@ -87,12 +86,13 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
name.setValue(importSession.getSelectedCodelist().getName());
|
||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||
|
||||
|
||||
description = new TextArea();
|
||||
description.setAllowBlank(false);
|
||||
description.setEmptyText("Enter a description...");
|
||||
description.setValue(importSession.getSelectedCodelist().getDescription());
|
||||
p.add(new FieldLabel(description, "Description"), new VerticalLayoutData(1, -1));
|
||||
description.setValue(importSession.getSelectedCodelist()
|
||||
.getDescription());
|
||||
p.add(new FieldLabel(description, "Description"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
rights = new TextArea();
|
||||
rights.setEmptyText("Enter rights...");
|
||||
|
@ -100,42 +100,47 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
p.add(new FieldLabel(rights, "Rights"), new VerticalLayoutData(1, -1));
|
||||
|
||||
/*
|
||||
ListStore<Agencies> agenciesStore = new ListStore<Agencies>(agenciesProperties.key());
|
||||
|
||||
RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>>() {
|
||||
|
||||
|
||||
public void load(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
final PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>> loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>>(proxy);
|
||||
|
||||
loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, Agencies, PagingLoadResult<Agencies>>(agenciesStore));
|
||||
|
||||
//agenciesStore.addAll(TestData.getStates());
|
||||
|
||||
combo = new ComboBox<Agencies>(agenciesStore, agenciesProperties.nameLabel());
|
||||
addHandlersForEventObservation(combo, agenciesProperties.nameLabel());
|
||||
|
||||
combo.setLoader(loader);
|
||||
combo.setEmptyText("Enter Agency...");
|
||||
combo.setTriggerAction(TriggerAction.ALL);
|
||||
combo.setAllowBlank(false);
|
||||
combo.setForceSelection(true);
|
||||
combo.setVisible(true);
|
||||
* ListStore<Agencies> agenciesStore = new
|
||||
* ListStore<Agencies>(agenciesProperties.key());
|
||||
*
|
||||
* RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>> proxy = new
|
||||
* RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>>() {
|
||||
*
|
||||
*
|
||||
* public void load(PagingLoadConfig loadConfig, final
|
||||
* AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||
* loadData(loadConfig, callback); } };
|
||||
*
|
||||
*
|
||||
* final PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>>
|
||||
* loader = new PagingLoader<PagingLoadConfig,
|
||||
* PagingLoadResult<Agencies>>(proxy);
|
||||
*
|
||||
* loader.setRemoteSort(false); loader.addLoadHandler(new
|
||||
* LoadResultListStoreBinding<PagingLoadConfig, Agencies,
|
||||
* PagingLoadResult<Agencies>>(agenciesStore));
|
||||
*
|
||||
* //agenciesStore.addAll(TestData.getStates());
|
||||
*
|
||||
* combo = new ComboBox<Agencies>(agenciesStore,
|
||||
* agenciesProperties.nameLabel());
|
||||
* addHandlersForEventObservation(combo,
|
||||
* agenciesProperties.nameLabel());
|
||||
*
|
||||
* combo.setLoader(loader); combo.setEmptyText("Enter Agency...");
|
||||
* combo.setTriggerAction(TriggerAction.ALL);
|
||||
* combo.setAllowBlank(false); combo.setForceSelection(true);
|
||||
* combo.setVisible(true);
|
||||
*/
|
||||
|
||||
|
||||
// HorizontalLayoutContainer agenciesSelect= selectAgencies();
|
||||
//p.add(new FieldLabel(combo, "Agencies"), new VerticalLayoutData(1, -1));
|
||||
// p.add(new FieldLabel(combo, "Agencies"), new VerticalLayoutData(1,
|
||||
// -1));
|
||||
|
||||
/*FieldLabel comboLabel=new FieldLabel(combo, "");
|
||||
comboLabel.setLabelSeparator("");
|
||||
p.add(comboLabel, new VerticalLayoutData(1, -1));
|
||||
/*
|
||||
* FieldLabel comboLabel=new FieldLabel(combo, "");
|
||||
* comboLabel.setLabelSeparator(""); p.add(comboLabel, new
|
||||
* VerticalLayoutData(1, -1));
|
||||
*/
|
||||
|
||||
agencyName = new TextField();
|
||||
|
@ -154,9 +159,9 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
checkData();
|
||||
}
|
||||
});
|
||||
form2.addButton(checkButton);
|
||||
form.addButton(checkButton);
|
||||
|
||||
tableDetailPanel.add(form2);
|
||||
tableDetailPanel.add(form);
|
||||
|
||||
setContent(tableDetailPanel);
|
||||
|
||||
|
@ -164,13 +169,13 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
|
||||
protected void checkData() {
|
||||
if (name.getValue() == null || name.getValue().isEmpty()
|
||||
|| description.getValue() == null
|
||||
|| description.getValue().isEmpty()
|
||||
|| !name.isValid() || description.getValue() == null
|
||||
|| description.getValue().isEmpty() || !description.isValid()
|
||||
|| rights.getValue() == null || rights.getValue().isEmpty()
|
||||
|| agencyName.getValue() == null || agencyName.getValue().isEmpty()
|
||||
) {
|
||||
AlertMessageBox d = new AlertMessageBox(
|
||||
"Attention!", "Fill in all fields");
|
||||
|| !rights.isValid() || agencyName.getValue() == null
|
||||
|| agencyName.getValue().isEmpty() || !agencyName.isValid()) {
|
||||
AlertMessageBox d = new AlertMessageBox("Attention!",
|
||||
"Fill in all fields");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -191,51 +196,45 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
}
|
||||
}
|
||||
|
||||
/*protected void loadData(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||
TDGXTServiceAsync.INSTANCE.getAgencies(new AsyncCallback<List<Agencies>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Agencies> result) {
|
||||
Log.trace("loaded "+result.size()+" agencies");
|
||||
for(int i=0; i<result.size(); i++){
|
||||
Agencies ag=result.get(i);
|
||||
//if(ag.getId().compareTo())
|
||||
}
|
||||
|
||||
callback.onSuccess(new PagingLoadResultBean<Agencies>(result, result.size(), 0));
|
||||
}
|
||||
});
|
||||
}*/
|
||||
/*
|
||||
* protected void loadData(PagingLoadConfig loadConfig, final
|
||||
* AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||
* TDGXTServiceAsync.INSTANCE.getAgencies(new
|
||||
* AsyncCallback<List<Agencies>>() {
|
||||
*
|
||||
* @Override public void onFailure(Throwable caught) {
|
||||
* callback.onFailure(caught); }
|
||||
*
|
||||
* @Override public void onSuccess(List<Agencies> result) {
|
||||
* Log.trace("loaded "+result.size()+" agencies"); for(int i=0;
|
||||
* i<result.size(); i++){ Agencies ag=result.get(i);
|
||||
* //if(ag.getId().compareTo()) }
|
||||
*
|
||||
* callback.onSuccess(new PagingLoadResultBean<Agencies>(result,
|
||||
* result.size(), 0)); } }); }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper to add handlers to observe events that occur on each combobox
|
||||
|
||||
private <T> void addHandlersForEventObservation(final ComboBox<T> combo, final LabelProvider<T> labelProvider) {
|
||||
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<T> event) {
|
||||
|
||||
Info.display("Value Changed", "New value: "
|
||||
+ (event.getValue() == null ? combo.getValue() : labelProvider.getLabel(event.getValue()) + "!"));
|
||||
}
|
||||
});
|
||||
|
||||
combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<T> event) {
|
||||
Info.display("Agency Selected", "You selected "
|
||||
+ (event.getSelectedItem() == null ? combo.getValue() : labelProvider.getLabel(event.getSelectedItem()) + "!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
*
|
||||
* private <T> void addHandlersForEventObservation(final ComboBox<T> combo,
|
||||
* final LabelProvider<T> labelProvider) { combo.addValueChangeHandler(new
|
||||
* ValueChangeHandler<T>() {
|
||||
*
|
||||
* @Override public void onValueChange(ValueChangeEvent<T> event) {
|
||||
*
|
||||
* Info.display("Value Changed", "New value: " + (event.getValue()
|
||||
* == null ? combo.getValue() :
|
||||
* labelProvider.getLabel(event.getValue()) + "!")); } });
|
||||
*
|
||||
* combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||
* @Override public void onSelection(SelectionEvent<T> event) {
|
||||
* Info.display("Agency Selected", "You selected " +
|
||||
* (event.getSelectedItem() == null ? combo.getValue() :
|
||||
* labelProvider.getLabel(event.getSelectedItem()) + "!")); } });
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
@ -251,8 +250,7 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
importSession.setTabResource(detail);
|
||||
SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard(
|
||||
importSession);
|
||||
getWizardWindow()
|
||||
.addCard(sdmxOperationInProgressCard);
|
||||
getWizardWindow().addCard(sdmxOperationInProgressCard);
|
||||
Log.info("NextCard SDMXOperationInProgressCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
|
@ -262,7 +260,6 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
|
@ -280,65 +277,53 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private HorizontalLayoutContainer selectAgencies(){
|
||||
|
||||
|
||||
|
||||
HorizontalLayoutContainer documentSelectionPanel = new HorizontalLayoutContainer();
|
||||
|
||||
Radio radioAgenciesAlready = new Radio();
|
||||
|
||||
radioAgenciesAlready.setBoxLabel("Present");
|
||||
radioAgenciesAlready.setValue(true);
|
||||
radioAgenciesAlready.setName("Agencies");
|
||||
|
||||
Radio radioAgencyNew = new Radio();
|
||||
radioAgencyNew.setBoxLabel("New");
|
||||
radioAgencyNew.setName("AgencyNew");
|
||||
|
||||
|
||||
documentSelectionPanel.add(radioAgenciesAlready);
|
||||
documentSelectionPanel.add(radioAgencyNew);
|
||||
|
||||
|
||||
ToggleGroup toggle = new ToggleGroup();
|
||||
toggle.add(radioAgenciesAlready);
|
||||
toggle.add(radioAgencyNew);
|
||||
|
||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||
try {
|
||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||
Radio radio = (Radio) group.getValue();
|
||||
Log.info("Document Selected:" + radio.getName());
|
||||
if (radio.getName().compareTo("AgencyNew") == 0) {
|
||||
//agencyName.setVisible(true);
|
||||
//combo.setVisible(false);
|
||||
//
|
||||
} else {
|
||||
if (radio.getName().compareTo("Agency") == 0) {
|
||||
//agencyName.setVisible(false);
|
||||
//combo.setVisible(true);
|
||||
//
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return documentSelectionPanel;
|
||||
|
||||
}
|
||||
* private HorizontalLayoutContainer selectAgencies(){
|
||||
*
|
||||
*
|
||||
*
|
||||
* HorizontalLayoutContainer documentSelectionPanel = new
|
||||
* HorizontalLayoutContainer();
|
||||
*
|
||||
* Radio radioAgenciesAlready = new Radio();
|
||||
*
|
||||
* radioAgenciesAlready.setBoxLabel("Present");
|
||||
* radioAgenciesAlready.setValue(true);
|
||||
* radioAgenciesAlready.setName("Agencies");
|
||||
*
|
||||
* Radio radioAgencyNew = new Radio(); radioAgencyNew.setBoxLabel("New");
|
||||
* radioAgencyNew.setName("AgencyNew");
|
||||
*
|
||||
*
|
||||
* documentSelectionPanel.add(radioAgenciesAlready);
|
||||
* documentSelectionPanel.add(radioAgencyNew);
|
||||
*
|
||||
*
|
||||
* ToggleGroup toggle = new ToggleGroup(); toggle.add(radioAgenciesAlready);
|
||||
* toggle.add(radioAgencyNew);
|
||||
*
|
||||
* toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>()
|
||||
* {
|
||||
*
|
||||
* @Override public void onValueChange(ValueChangeEvent<HasValue<Boolean>>
|
||||
* event) { try { ToggleGroup group = (ToggleGroup) event.getSource(); Radio
|
||||
* radio = (Radio) group.getValue(); Log.info("Document Selected:" +
|
||||
* radio.getName()); if (radio.getName().compareTo("AgencyNew") == 0) {
|
||||
* //agencyName.setVisible(true); //combo.setVisible(false); // } else { if
|
||||
* (radio.getName().compareTo("Agency") == 0) {
|
||||
* //agencyName.setVisible(false); //combo.setVisible(true); // } else {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* }
|
||||
*
|
||||
* } catch (Exception e) { Log.error("ToggleGroup: onValueChange " +
|
||||
* e.getLocalizedMessage()); }
|
||||
*
|
||||
* } });
|
||||
*
|
||||
* return documentSelectionPanel;
|
||||
*
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -27,11 +27,17 @@ import com.sencha.gxt.widget.core.client.toolbar.FillToolItem;
|
|||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
* A generic Wizard Window.
|
||||
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class WizardWindow extends Window {
|
||||
|
||||
protected final String WIZARDWIDTH="640px";
|
||||
protected final String WIZARDHEIGHT="480px";
|
||||
protected final boolean WIZARRESIZABLE=false;
|
||||
|
||||
protected ArrayList<WizardCard> cardStack = new ArrayList<WizardCard>();
|
||||
|
||||
protected TextButton backButton;
|
||||
|
@ -63,9 +69,11 @@ public class WizardWindow extends Window {
|
|||
super();
|
||||
this.eventBus= new SimpleEventBus();
|
||||
Log.info(title);
|
||||
//setModal(true);
|
||||
setResizable(true);
|
||||
setCollapsible(true);
|
||||
setResizable(WIZARRESIZABLE);
|
||||
setCollapsible(false);
|
||||
setWidth(WIZARDWIDTH);
|
||||
setHeight(WIZARDHEIGHT);
|
||||
|
||||
|
||||
listeners = new ArrayList<WizardListener>();
|
||||
|
||||
|
|
Loading…
Reference in New Issue