本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox.addChangeHandler方法的典型用法代码示例。如果您正苦于以下问题:Java ListBox.addChangeHandler方法的具体用法?Java ListBox.addChangeHandler怎么用?Java ListBox.addChangeHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.addChangeHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeListBox
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Initializes the list box that allows to select styles
* @param listBox the list box to initialize
* @param dataToName the mapping from the style ID to the human readable name of the style
* @param dataToStyleName the mapping from the style ID to the CSS style name
* @param defaultValue the default style ID that should be set as selected
*/
public void initializeListBox( final ListBox listBox, final Map<Integer, String> dataToName,
final Map<Integer, String> dataToStyleName, final int defaultValue) {
//Initialize the list box with data
Iterator< Entry<Integer,String> > entrySetIter = dataToName.entrySet().iterator();
while( entrySetIter.hasNext() ) {
Entry<Integer, String> entry = entrySetIter.next();
listBox.addItem( entry.getValue(), dataToStyleName.get( entry.getKey() ) );
}
listBox.setVisibleItemCount( 1 );
//Set the default value as being selected
setListBoxStyleID( listBox, defaultValue, dataToStyleName );
//Add the change listener
listBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent e) {
//Update the sample view
updateSampleViewStyles();
}
});
}
示例2: makeTemplatesMenu
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Creates a drop down menu for selecting Template repositories.
* @return the drop down menu of repository Urls.
*/
private ListBox makeTemplatesMenu() {
final ListBox templatesMenu = new ListBox();
templatesMenu.addItem(MESSAGES.templateUploadNewUrlCaption());
templatesMenu.addItem(MIT_TEMPLATES);
for (int k = 0; k < dynamicTemplateUrls.size(); k++) { // Dynamically added Urls
templatesMenu.addItem(dynamicTemplateUrls.get(k));
}
templatesMenu.setSelectedIndex(MIT_TEMPLATES_INDEX);
templatesMenu.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = templatesMenu.getSelectedIndex();
if (selectedIndex == 0) {
templatesMenu.setSelectedIndex(lastSelectedIndex);
usingExternalTemplate = true; // MIT templates at index 1
removeButton.setVisible(false);
new InputTemplateUrlWizard(instance).center(); // This will do a callback
} else if (selectedIndex == 1) {
removeButton.setVisible(false); lastSelectedIndex = selectedIndex;
usingExternalTemplate = false; // MIT templates at index 1
templateHostUrl = "";
retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex)); // may do callback
} else {
removeButton.setVisible(true); lastSelectedIndex = selectedIndex;
usingExternalTemplate = true; // MIT templates at index 1
templateHostUrl = templatesMenu.getValue(selectedIndex);
retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex)); // may do callback
}
}
});
templatesMenu.setVisibleItemCount(1); // Turns menu into a drop-down list).
return templatesMenu;
}
示例3: onModuleLoad
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public void onModuleLoad() {
PublishSubject<String> query = PublishSubject.create();
TextBox text = new TextBox(); RootPanel.get().add(text);
text.addValueChangeHandler(e -> query.onNext(e.getValue()));
Button search = new Button("search"); RootPanel.get().add(search);
search.addClickHandler(e -> query.onNext(text.getValue()));
ListBox url = new ListBox(); RootPanel.get().add(url);
url.addItem(NOMINATIM_OPENSTREETMAP);
url.addItem("http://localhost:8080/");
url.addChangeHandler(e -> query.onNext(text.getValue()));
FlowPanel results = new FlowPanel(); RootPanel.get().add(results);
// remember last selected server
Storage storage = Storage.getLocalStorageIfSupported();
if (storage != null) {
try {
url.setSelectedIndex(Integer.valueOf(storage.getItem("nominatim.url")));
} catch (Exception ignore) {}
url.addChangeHandler(c -> storage.setItem("nominatim.url", Integer.toString(url.getSelectedIndex())));
}
// on each tick, re-configure root resource and fire new request
query.switchMap(q -> {
results.clear();
if (q == null || q.isEmpty()) return Observable.empty();
Nominatim nominatim = new Nominatim_RestServiceModel(() -> osm(url.getSelectedItemText()));
return nominatim.search(q, "json").doOnNext(n -> results.add(new Label(
"[" + (int) (n.importance * 10.) + "] " + n.display_name + " (" + n.lon + "," + n.lat + ")")));
}).retry((cnt, err) -> {
GWT.log("request error: " + err, err); return true;
}).subscribe();
// fires initial search
text.setValue("Málaga,España", true);
}
示例4: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
addLabel();
ListBox labelsLBox = new ListBox();
labelsLBox.addItem("Add label", "0");
labelsLBox.addItem("Set font", "1");
labelsLBox.addItem("Set properties", "2");
labelsLBox.addItem("Offset label by distance", "3");
labelsLBox.addItem("Fade label by distance", "4");
labelsLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
ListBox source = (ListBox) event.getSource();
reset();
switch (source.getSelectedValue()) {
case "0": addLabel(); break;
case "1": setFont(); break;
case "2": setProperties(); break;
case "3": offsetByDistance(); break;
case "4": fadeByDistance(); break;
default: break;
}
}
});
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(labelsLBox, 20, 20);
contentPanel.add(new HTML("<p>Create Labels</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例5: initComp
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void initComp() {
buttonImage = new Image(REMOVE_BUTTON_IMAGE);
buttonImage.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
removeButton = new Anchor();
removeButton.addClickHandler(this);
removeButton.setPixelSize(12, 12);
removeButton.getElement().appendChild(buttonImage.getElement());
fieldsList = new ListBox();
fieldsList.addChangeHandler(this);
fieldsList.setPixelSize(100, 20);
for (Field field : Field.values()) {
fieldsList.addItem(field.getName());
}
actionList = new ListBox();
actionList.setPixelSize(140, 20);
textBox = new TextBox();
textBox.setPixelSize(140, 12);
priorityList = new ListBox();
priorityList.setPixelSize(140, 20);
for (JobPriority priority : JobPriority.values()) {
priorityList.addItem(priority.name());
}
stateList = new ListBox();
stateList.setPixelSize(140, 20);
for (JobStatus status : JobStatus.values()) {
stateList.addItem(status.name());
}
valuePanel = new SimplePanel();
valuePanel.setPixelSize(150, 25);
setActionsAccordingToSelectedField();
}
示例6: setRuneLabel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected void setRuneLabel(final Anchor label, final ListBox skills,
final ListBox runes) {
label.setTarget("_blank");
runes.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!disableListeners)
updateRuneLabel(label, skills, runes);
}
});
updateRuneLabel(label, skills, runes);
}
示例7: setSkillLabel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected void setSkillLabel(final Anchor label, final ListBox skills) {
label.setTarget("_blank");
skills.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!disableListeners)
updateSkillLabel(label, skills);
}
});
updateSkillLabel(label, skills);
}
示例8: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
addBillboard();
ListBox billboardsLBox = new ListBox();
billboardsLBox.addItem("Add billboard", "0");
billboardsLBox.addItem("Set billboard properties at creation", "1");
billboardsLBox.addItem("Change billboard properties", "2");
billboardsLBox.addItem("Size billboard in meters", "3");
billboardsLBox.addItem("Add multiple billboards", "4");
billboardsLBox.addItem("Scale by viewer distance", "5");
billboardsLBox.addItem("Fade by viewer distance", "6");
billboardsLBox.addItem("Offset by viewer distance", "7");
billboardsLBox.addItem("Add marker billboards", "8");
billboardsLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
ListBox source = (ListBox)changeEvent.getSource();
reset();
switch (source.getSelectedValue()) {
case "0": addBillboard(); break;
case "1": setBillboardProperties(); break;
case "2": changeBillboardProperties(); break;
case "3": sizeBillboardInMeters(); break;
case "4": addMultipleBillboards(); break;
case "5": scaleByDistance(); break;
case "6": fadeByDistance(); break;
case "7": offsetByDistance(); break;
case "8": addMarkerBillboards();
default: break;
}
}
});
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(billboardsLBox, 20, 20);
contentPanel.add(new HTML("<p>Add billboard images and markers to the scene.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例9: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
createPrimitives(csVPanel.getViewer().scene());
applyColorMaterial(rectangle);
commonMaterialLBox = new ListBox();
commonMaterialLBox.addChangeHandler(new MChangeHandler());
commonMaterialLBox.addItem("Select", "0");
commonMaterialLBox.addItem("Color", "1");
commonMaterialLBox.addItem("Image", "2");
proceduralTexturesLBox = new ListBox();
proceduralTexturesLBox.addChangeHandler(new MChangeHandler());
proceduralTexturesLBox.addItem("Select", "0");
proceduralTexturesLBox.addItem("Checkerboard", "1");
proceduralTexturesLBox.addItem("Dot", "2");
proceduralTexturesLBox.addItem("Grid", "3");
proceduralTexturesLBox.addItem("Stripe", "4");
baseMaterialsLBox = new ListBox();
baseMaterialsLBox.addChangeHandler(new MChangeHandler());
baseMaterialsLBox.addItem("Select", "0");
baseMaterialsLBox.addItem("Alpha Map", "1");
baseMaterialsLBox.addItem("Bump Map", "2");
baseMaterialsLBox.addItem("Diffuse", "3");
baseMaterialsLBox.addItem("Emission Map", "4");
baseMaterialsLBox.addItem("Normal Map", "5");
baseMaterialsLBox.addItem("Specular Map", "6");
miscMaterialsLBox = new ListBox();
miscMaterialsLBox.addChangeHandler(new MChangeHandler());
miscMaterialsLBox.addItem("Select", "0");
miscMaterialsLBox.addItem("Rim Lighting", "1");
miscMaterialsLBox.addItem("Water", "2");
exampleCompositeMaterialsLBox = new ListBox();
exampleCompositeMaterialsLBox.addChangeHandler(new MChangeHandler());
exampleCompositeMaterialsLBox.addItem("Select", "0");
exampleCompositeMaterialsLBox.addItem("Composite Example", "1");
polylineMaterialsLBox = new ListBox();
polylineMaterialsLBox.addChangeHandler(new MChangeHandler());
polylineMaterialsLBox.addItem("Select", "0");
polylineMaterialsLBox.addItem("Polyline Arrow", "1");
polylineMaterialsLBox.addItem("Polyline Glow", "2");
polylineMaterialsLBox.addItem("Polyline Outline", "3");
FlexTable flexTable = new FlexTable();
flexTable.setCellSpacing(1);
flexTable.setCellPadding(1);
flexTable.setHTML(1, 0, "<font color=\"white\">Common materials</font>");
flexTable.setWidget(1, 1, commonMaterialLBox);
flexTable.setHTML(2, 0, "<font color=\"white\">Procedural textures</font>");
flexTable.setWidget(2, 1, proceduralTexturesLBox);
flexTable.setHTML(3, 0, "<font color=\"white\">Base materials</font>");
flexTable.setWidget(3, 1, baseMaterialsLBox);
flexTable.setHTML(4, 0, "<font color=\"white\">Misc materials</font>");
flexTable.setWidget(4, 1, miscMaterialsLBox);
flexTable.setHTML(5, 0, "<font color=\"white\">Example composite materials</font>");
flexTable.setWidget(5, 1, exampleCompositeMaterialsLBox);
flexTable.setHTML(6, 0, "<font color=\"white\">Polyline materials</font>");
flexTable.setWidget(6, 1, polylineMaterialsLBox);
//
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(flexTable, 20, 20);
contentPanel.add(new HTML("<p>Browse Cesium's built in materials and define new ones using the Fabric schema.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例10: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
ViewerOptions csViewerOptions = new ViewerOptions();
csViewerOptions.infoBox = false;
csViewerOptions.selectionIndicator = false;
csViewerOptions.shadows = false;
csVPanel = new ViewerPanel(csViewerOptions);
ModelGraphicsOptions modelGraphicsOptions = new ModelGraphicsOptions();
modelGraphicsOptions.uri = new ConstantProperty<>(GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.glb");
modelGraphicsOptions.minimumPixelSize = new ConstantProperty<>(128);
modelGraphicsOptions.maximumScale = new ConstantProperty<>(20000);
ModelGraphics modelGraphics = new ModelGraphics(modelGraphicsOptions);
Cartesian3 position = Cartesian3.fromDegrees(-123.0744619, 44.0503706, 5000.0);
double heading = Math.toRadians(135);
double pitch = 0;
double roll = 0;
Quaternion orientation = Transforms.headingPitchRollQuaternion(position, new org.cesiumjs.cs.core.HeadingPitchRoll(heading, pitch, roll));
EntityOptions entityOptions = new EntityOptions();
entityOptions.name = GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.glb";
entityOptions.position = new ConstantPositionProperty(position);
entityOptions.orientation = new ConstantProperty<>(orientation);
entityOptions.model = modelGraphics;
csVPanel.getViewer().trackedEntity = csVPanel.getViewer().entities().add(entityOptions);
final ListBox modelsLBox = new ListBox();
modelsLBox.addItem("Aircraft", "0");
modelsLBox.addItem("Ground vehicle", "1");
modelsLBox.addItem("Hot Air Balloon", "2");
modelsLBox.addItem("Milk truck", "3");
modelsLBox.addItem("Skinned character", "4");
modelsLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
csVPanel.getViewer().entities().removeAll();
switch (modelsLBox.getSelectedValue()) {
case "0": createModel(GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.glb", 5000.0); break;
case "1": createModel(GWT.getModuleBaseURL() + "SampleData/models/CesiumGround/Cesium_Ground.glb", 0); break;
case "2": createModel(GWT.getModuleBaseURL() + "SampleData/models/CesiumBalloon/CesiumBalloon.glb", 1000.0); break;
case "3": createModel(GWT.getModuleBaseURL() + "SampleData/models/CesiumMilkTruck/CesiumMilkTruck-kmc.glb", 0); break;
case "4": createModel(GWT.getModuleBaseURL() + "SampleData/models/CesiumMan/Cesium_Man.glb", 0); break;
default: break;
}
}
});
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(modelsLBox, 20, 20);
contentPanel.add(new HTML("<p>Create 3D models using glTF.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例11: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
ListBox kmlLBox = new ListBox();
kmlLBox.addItem("KML - Global Science Facilities", GWT.getModuleBaseURL() + "SampleData/kml/facilities/facilities.kml");
kmlLBox.addItem("KMZ with embedded data - GDP per capita", GWT.getModuleBaseURL() + "SampleData/kml/gdpPerCapita2008.kmz");
kmlLBox.addItem("gx KML extensions - Bike Ride", GWT.getModuleBaseURL() + "SampleData/kml/bikeRide.kml");
kmlLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
reset();
ListBox source = (ListBox) changeEvent.getSource();
final Viewer viewer = csVPanel.getViewer();
org.cesiumjs.cs.scene.Camera camera = viewer.camera;
CanvasElement canvas = viewer.canvas();
camera.flyHome(0);
KmlDataSourceOptions kmlDataSourceOptions = new KmlDataSourceOptions();//camera, canvas);
kmlDataSourceOptions.canvas = canvas;
kmlDataSourceOptions.camera = camera;
if (!source.getSelectedValue().contains("bikeRide")) {
csVPanel.getViewer().dataSources().add(KmlDataSource.load(source.getSelectedValue(), kmlDataSourceOptions));
} else {
csVPanel.getViewer().dataSources().add(KmlDataSource.load(source.getSelectedValue(), kmlDataSourceOptions)).then(new Fulfill<KmlDataSource>() {
@Override
public void onFulfilled(KmlDataSource dataSource) {
viewer.clock().shouldAnimate = false;
final Entity rider = dataSource.entities.getById("tour");
viewer.flyTo(rider).then(new Fulfill<Boolean>() {
@Override
public void onFulfilled(Boolean value) {
viewer.trackedEntity = rider;
viewer.selectedEntity = viewer.trackedEntity;
viewer.clock().multiplier = 30;
viewer.clock().shouldAnimate = true;
}
});
}
});
}
}
});
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(kmlLBox, 20, 20);
contentPanel.add(new HTML("<p>A simple KML example.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例12: buildPanel
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
_eventsLbl = new Label("View Changed");
_eventsLbl.getElement().getStyle().setColor("red");
_eventsLbl.setVisible(false);
_changesLbl = new Label();
_changesLbl.getElement().getStyle().setColor("red");
_changesLbl.setVisible(false);
ListBox lBox = new ListBox();
lBox.addItem("Camera Options", "0");
lBox.addItem("Fly in a city", "1");
lBox.addItem("Fly to San Diego", "2");
lBox.addItem("Fly to Location with heading, pitch and roll", "3");
lBox.addItem("Fly to My Location", "4");
lBox.addItem("Fly to Rectangle", "5");
lBox.addItem("View a Rectangle", "6");
lBox.addItem("Set camera reference frame", "7");
lBox.addItem("Set camera with heading, pitch, and roll", "8");
lBox.addItem("View in ICRF", "9");
lBox.addItem("Move events", "10");
lBox.addItem("Camera changed event", "11");
lBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
reset();
ListBox source = (ListBox) changeEvent.getSource();
switch (source.getSelectedValue()) {
case "1": flyInACity(); break;
case "2": flyToSanDiego(); break;
case "3": flyToHeadingPitchRoll(); break;
case "5": flyToRectangle(); break;
case "6": viewRectangle(); break;
case "7": setReferenceFrame(); break;
case "8": setHeadingPitchRoll(); break;
case "9": viewInICRF(); break;
case "10": cameraEvents(); break;
case "11": cameraChanges(); break;
default: break;
}
}
});
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(lBox, 20, 20);
contentPanel.add(new HTML("<p>Fly to a specified location or view a geographic rectangle.</p>"));
contentPanel.add(_eventsLbl);
contentPanel.add(_changesLbl);
contentPanel.add(aPanel);
initWidget(contentPanel);
}
示例13: populateDialog
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
protected void populateDialog() {
addNewGrid( 2, 3, false, "", false);
//Add the radio-html widget to the panel
this.addToGrid(this.getCurrentGridIndex(), FIRST_COLUMN_INDEX, 3, radioHTML, false, false);
//Construct and add the listbox
HorizontalPanel panel = new HorizontalPanel();
panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_LEFT );
panel.setSize("100%", "100%");
Label chooseLabel = new Label( titlesI18N.chooseRadioText() );
chooseLabel.setStyleName( CommonResourcesContainer.CONST_FIELD_VALUE_DEFAULT_IMP_STYLE_NAME );
final ListBox chooseRadioListBox = new ListBox();
for( String name : nameToUrl.keySet() ) {
chooseRadioListBox.addItem( name );
}
chooseRadioListBox.addChangeHandler( new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setRadioStation( chooseRadioListBox.getItemText( chooseRadioListBox.getSelectedIndex() ) );
}
});
final String defaultRadioStation = chooseRadioListBox.getItemText(0);
panel.add( chooseLabel );
panel.add( new HTML(" "));
panel.add( chooseRadioListBox );
this.addToGrid(this.getCurrentGridIndex(), FIRST_COLUMN_INDEX, 2, panel, true, false);
//Set the default radio station
setRadioStation( defaultRadioStation );
//Create navigation button "Close"
Button closeButton = new Button();
closeButton.setText( titlesI18N.closeButtonTitle() );
closeButton.setStyleName( CommonResourcesContainer.USER_DIALOG_ACTION_BUTTON_STYLE );
closeButton.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent e) {
//Close the dialog
hide();
}
} );
this.addToGrid( SECOND_COLUMN_INDEX, closeButton, false, true);
}
示例14: OdkTablesManageInstanceFilesSubTab
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesManageInstanceFilesSubTab(OdkTablesTabUI parent) {
this.parent = parent;
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
// displayDeleted = false;
currentTable = null;
// first construct a copy so you can build the list box before you
// update it. This seems like bad style.
currentTables = new ArrayList<TableEntryClient>();
// set up the box so you can only select one and you provide both the
// table name and ID.
tableBox = new ListBox();
// new TableEntryClientListBox(currentTables, false, false,
// "Select a table to view.");
tableBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = tableBox.getSelectedIndex();
// Call this to clear the contents while you are waiting on
// the response from the server.
tableFileData.updateDisplay(null);
currentTable = null;
selectedValue = selectedIndex;
updateContentsForSelectedTable();
}
});
tableFileData = new OdkTablesViewInstanceFileInfo(this);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("select_table_panel");
selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
selectTablePanel.setWidget(0, 1, tableBox);
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableFileData);
}
示例15: OdkTablesManageTableFilesSubTab
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Sets up the View Table subtab.
*/
public OdkTablesManageTableFilesSubTab(OdkTablesTabUI parent) {
this.parent = parent;
addFileButton = new OdkTablesTableIdServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
UIConsts.TABLE_FILE_UPLOAD_SERVLET_ADDR, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT, this,
this);
setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
// displayDeleted = false;
currentTable = null;
// first construct a copy so you can build the list box before you
// update it. This seems like bad style.
currentTables = new ArrayList<TableEntryClient>();
// set up the box so you can only select one and you provide both the
// table name and ID.
tableBox = new ListBox();
// new TableEntryClientListBox(currentTables, false, false,
// "Select a table to view.");
tableBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int selectedIndex = tableBox.getSelectedIndex();
// Call this to clear the contents while you are waiting on
// the response from the server.
tableFileData.updateDisplay(null);
currentTable = null;
selectedValue = selectedIndex;
updateContentsForSelectedTable();
}
});
tableFileData = new OdkTablesViewTableFileInfo(this);
selectTablePanel = new FlexTable();
selectTablePanel.getElement().setId("select_table_panel");
selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
selectTablePanel.setWidget(0, 1, tableBox);
if (AggregateUI.getUI().getUserInfo().getGrantedAuthorities()
.contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
selectTablePanel.setWidget(1, 0, addFileButton);
}
// deletedRowsCheckBox = new OdkTablesDisplayDeletedRowsCheckBox(this,
// displayDeleted);
// selectTablePanel.setWidget(0, 2, deletedRowsCheckBox);
topPanel = new HorizontalPanel();
topPanel.add(selectTablePanel);
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
add(topPanel);
add(tableFileData);
}