Updated Value Data Format

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@112162 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-02-18 11:37:43 +00:00
parent 49be22a821
commit 66199d7147
2 changed files with 28 additions and 8 deletions

View File

@ -51,10 +51,13 @@ import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.text.shared.AbstractSafeHtmlRenderer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.client.loader.RpcProxy;
import com.sencha.gxt.data.shared.LabelProvider;
@ -88,6 +91,13 @@ import com.sencha.gxt.widget.core.client.info.Info;
*/
public class ChangeColumnTypePanel extends FramedPanel implements
CodelistSelectionListener, ColumnMappingListener, MonitorDialogListener {
interface ComboBoxTemplates extends XTemplates {
@XTemplate("<div qtip=\"{example}\" qtitle=\"Format {id}\">{id}</div>")
SafeHtml format(String id, String example);
}
private String WIDTH = "640px";
private String HEIGHT = "520px";
private EventBus eventBus;
@ -476,20 +486,30 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboPeriodType.setTriggerAction(TriggerAction.ALL);
comboPeriodTypeLabel = new FieldLabel(comboPeriodType, "Period Type");
// comboTimeDataFormat
ValueDataFormatProperties propsTimeDataFormat = GWT
// comboValueDataFormat
ValueDataFormatProperties propsValueDataFormat = GWT
.create(ValueDataFormatProperties.class);
storeComboValueDataFormat = new ListStore<ValueDataFormat>(
propsTimeDataFormat.id());
propsValueDataFormat.id());
comboValueDataFormat = new ComboBox<ValueDataFormat>(
storeComboValueDataFormat, propsTimeDataFormat.example());
storeComboValueDataFormat, propsValueDataFormat.label(),
new AbstractSafeHtmlRenderer<ValueDataFormat>() {
public SafeHtml render(ValueDataFormat item) {
final ComboBoxTemplates comboBoxTemplates = GWT
.create(ComboBoxTemplates.class);
return comboBoxTemplates.format(item.getId(),
item.getExample());
}
}
);
Log.trace("ComboTimeDataFormat created");
addHandlersForComboTimeDataFormat(propsTimeDataFormat.example());
addHandlersForComboValueDataFormat(propsValueDataFormat.label());
comboValueDataFormat.setEmptyText("Select a time format...");
comboValueDataFormat.setEmptyText("Select a format...");
comboValueDataFormat.setWidth(191);
comboValueDataFormat.setTypeAhead(true);
comboValueDataFormat.setTriggerAction(TriggerAction.ALL);
@ -740,7 +760,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
protected void addHandlersForComboTimeDataFormat(
protected void addHandlersForComboValueDataFormat(
final LabelProvider<ValueDataFormat> labelProvider) {
comboValueDataFormat
.addSelectionHandler(new SelectionHandler<ValueDataFormat>() {

View File

@ -19,6 +19,6 @@ public interface ValueDataFormatProperties extends
@Path("id")
ModelKeyProvider<ValueDataFormat> id();
LabelProvider<ValueDataFormat> example();
LabelProvider<ValueDataFormat> label();
}