Java Code Examples for com.google.gwt.event.logical.shared.SelectionEvent

The following are top voted examples for showing how to use com.google.gwt.event.logical.shared.SelectionEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: drools-wb   File: AddFieldClickHandler.java   View source code 7 votes vote down vote up
@Override
public void onClick( final ClickEvent event ) {
    final FormStylePopup pop = new FormStylePopup( TestScenarioConstants.INSTANCE.ChooseAFieldToAdd() );
    final FactFieldSelector selector = createAddNewField( pop );
    pop.addAttribute( TestScenarioConstants.INSTANCE.ChooseAFieldToAdd(),
                      selector );
    pop.add( new ModalFooterOKCancelButtons( new Command() {
        @Override
        public void execute() {
            SelectionEvent.fire( selector,
                                 selector.getSelectedText() );
        }
    }, new Command() {
        @Override
        public void execute() {
            pop.hide();
        }
    }
    ) );

    pop.show();
}
 
Example 2
Project: DocIT   File: TreePanel.java   View source code 6 votes vote down vote up
public TreePanel(GwtTree main) {
	this.main = main;
	
	this.addSelectionHandler(new SelectionHandler<TreeItem>() {
		
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			Object obj = event.getSelectedItem().getUserObject();
			if (obj instanceof CompanyItem) {
				TreePanel.this.main.showCompany(((CompanyItem)obj).getId());
			} else if (obj instanceof DepartmentItem) {
				TreePanel.this.main.showDepartment(((DepartmentItem)obj).getId());
			} else if (obj instanceof EmployeeItem) {
				TreePanel.this.main.showEmployee(((EmployeeItem)obj).getId());
			}
		}
	});
}
 
Example 3
Project: EasyML   File: BaseTree.java   View source code 6 votes vote down vote up
public BaseTree() {
	super(new TreeImageResources(), true);

	this.addStyleName("bda-treedir");

	this.addSelectionHandler(new SelectionHandler<TreeItem>() {
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			TreeItem item = event.getSelectedItem();
			Boolean state = item.getState();
			// [GWT Issue 3660] to avoid pass invoke onSection two times
			TreeItem parent = item.getParentItem();
			item.getTree().setSelectedItem(parent, false);
			if (parent != null)
				parent.setSelected(false);
			item.setState(!state);
		}
	});
}
 
Example 4
Project: sig-seguimiento-vehiculos   File: CopyElementDialog.java   View source code 6 votes vote down vote up
private ComboBox<VectorLayerInfo> initLayerCombo1() {
					
	VectorLayerProperties properties = GWT
			.create(VectorLayerProperties.class);

	layerStore1 = new ListStore<VectorLayerInfo>(properties.key());

	layerCombo1 = new ComboBox<VectorLayerInfo>(layerStore1,
			properties.name());
	layerCombo1.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText()));
	layerCombo1.setTypeAhead(true);
	layerCombo1.setTriggerAction(TriggerAction.ALL);
	layerCombo1.setForceSelection(true);
	layerCombo1.setEditable(false);
	layerCombo1.enableEvents();
	layerCombo1.setWidth(width);

	layerCombo1.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() {
		@Override
		public void onSelection(SelectionEvent<VectorLayerInfo> event) {
			layerCombo1.setValue(event.getSelectedItem(), true);
		}
	});

	return layerCombo1;
}
 
Example 5
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   View source code 6 votes vote down vote up
private SelectionHandler<Widget> getTabPanelSelectionHandler() {
	return new SelectionHandler<Widget>() {

		@Override
		public void onSelection(SelectionEvent<Widget> event) {
			if (UIMessages.INSTANCE.empty().equals(getActiveTab())) {
				dataFormatField.setVisible(false);
			} else {
				dataFormatField.setVisible(true);
			}
			if (UIMessages.INSTANCE.wfs().equals(getActiveTab())) {
				vectorFormatCombo.setValue(VectorFormat.GML_FORMAT);
			} else {
				vectorFormatCombo.setValue(null);
			}
			
			if (UIMessages.INSTANCE.gitHubResponseTitle().equals(getActiveTab())) {					
				layerName.setEnabled(false);
			} else {
				layerName.setEnabled(true);
			}
		}
	};
}
 
Example 6
Project: LAS   File: OutputPanel.java   View source code 6 votes vote down vote up
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    DatasetWidget datasetWidget = datasetButton.getDatasetWidget();
    boolean isFromMyDatasetWidget = event.getSource().equals(datasetWidget);
    if (isFromMyDatasetWidget) {
        TreeItem item = event.getSelectedItem();
        Object variableUserObject = item.getUserObject();
        if (variableUserObject instanceof VariableSerializable) {
            VariableSerializable variable = (VariableSerializable) variableUserObject;
            // Remove extra variable UserLists before
            // applyVariableChange
            // TODO: Replace this with a higher level method or use
            // events
            variableControls.removeListBoxesExceptFirst();
            if ( variable.getAttributes().get("grid_type").equals(vizGalVariable.getAttributes().get("grid_type") )) {
                applyVariableChange(variable, true);
            } else {
                Window.alert("LAS cannot compare data on a grid with in-situ data.");
            }
        }
    }
}
 
Example 7
Project: LAS   File: DatasetWidget.java   View source code 6 votes vote down vote up
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();
    currentlySelected = item;
    TreeItem child = item.getChild(0);
    if ( child != null && child.getText().equals(DatasetWidget.LOADING) ) {
        CategorySerializable cat = (CategorySerializable) item.getUserObject();
        Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
    }
    // Open the item.  Work around double firing bug.
    // http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
    TreeItem selItem = event.getSelectedItem();
    TreeItem parent = selItem.getParentItem();
    selItem.getTree().setSelectedItem(parent, false); // null is ok
    if(parent != null)
        parent.setSelected(false);  // not compulsory
    selItem.setState(!selItem.getState(), false);

}
 
Example 8
Project: LAS   File: ClimateAnalysis.java   View source code 6 votes vote down vote up
@Override
public void onSelection(SelectionEvent event) {
	DatasetWidget source = (DatasetWidget) event.getSource();
	Object uo = source.getCurrentlySelected();
	if ( uo instanceof VariableSerializable ) {
		VariableSerializable v = (VariableSerializable) uo;
		xSecondName = v.getDSName();
		xSecondID = v.getDSID();
		xSecondVarID = v.getID();
		xSecondDataset.setText(xSecondName);
		set.add(0);
		setBackground(1);
		Util.getRPCService().getGrid(xSecondID, xSecondVarID, gridCallback);

	} else if ( uo instanceof CategorySerializable) {
		CategorySerializable c = (CategorySerializable) uo;
		// Category children, open it up.
		
		// Variable children, dagnabit.  We need the variable, so let's go get it.
		Util.getRPCService().getCategories(c.getID(), null, categoryCallback);
	}
}
 
Example 9
Project: LAS   File: VariableMetadataActivity.java   View source code 6 votes vote down vote up
/**
 * @return view
 */
public VariableMetadataView init() {
    final VariableMetadataView view = clientFactory.getVariableMetadataView(name);
    view.setPresenter(this);

    // Listen to BreadcrumbValueChangeEvent events in order to update this
    // view's bread crumbs when the comparePanel's bread crumbs change
    updateBreadcrumbsTreeItemSelectionHandler = new UpdateBreadcrumbsTreeItemSelectionHandler(view);
    eventBus.addHandler(SelectionEvent.getType(), updateBreadcrumbsTreeItemSelectionHandler);

    BreadcrumbValueChangeEventHandler = new BreadcrumbValueChangeEvent.Handler() {
        @Override
        public void onValueChange(BreadcrumbValueChangeEvent event) {
            if ( !view.isOnComparePanel() ) {
                // Since this view is NOT on the comparePanel, it should
                // prepare to update its bread crumbs
                // TODO: set a potential new bread crumb value, instead of
                // changing it now
                view.getBreadcrumbs().setValue(event.getValue());
            }
        }
    };
    eventBus.addHandler(BreadcrumbValueChangeEvent.TYPE, BreadcrumbValueChangeEventHandler);
    return view;
}
 
Example 10
Project: Wiab.pro   File: EditorHarness.java   View source code 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example 11
Project: synergynet3.1   File: ExpressionView.java   View source code 6 votes vote down vote up
@Override
public void onSelection(SelectionEvent<TreeItem> event)
{
	TreeItem itemSelected = event.getSelectedItem();
	if (itemSelected.getUserObject() == null)
	{
		return;
	}
	String type = (String) itemSelected.getUserObject();
	if (type.equals("table"))
	{
		loadExpressionCollectionViewForTable(itemSelected.getText());
	}
	else if (type.equals("person"))
	{
		loadExpressionCollectionViewForPerson(itemSelected.getText());
	}
	else if (type.equals("target"))
	{
		loadExpressionCollectionViewForTarget(Double.parseDouble(itemSelected.getText()));
	}
}
 
Example 12
Project: dataworks-zeus   File: FileMenu.java   View source code 6 votes vote down vote up
private SelectionHandler<MenuItem> getDeleteSelectionHandler() {
  if (deleteSelectionHandler == null) {
    deleteSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
        getPresenter().onDelete();
      }
    };
  }
  return deleteSelectionHandler;
}
 
Example 13
Project: dataworks-zeus   File: TableInfoPanel.java   View source code 6 votes vote down vote up
public TableInfoPanel(TableManagerPresenter c) {
	this.presenter = c;
	this.context = presenter.getPlatformContext();
	setBodyBorder(false);
	add(getTableInfoTab(), new TabItemConfig("基本信息"));
	add(getColumnInfoTab(), new TabItemConfig("字段信息"));
	add(getPtTab(), new TabItemConfig("分区信息"));

	addSelectionHandler(new SelectionHandler<Widget>() {

		@Override
		public void onSelection(SelectionEvent<Widget> event) {
			if (getConfig(event.getSelectedItem()).getText().equals("分区信息")) {
				if (isPartitionLoaded() == false) {
					getPtTab().load(table);
					setPartitionLoaded(true);
				}
			}
		}
	});
}
 
Example 14
Project: gwt-material   File: MaterialNavSectionTest.java   View source code 6 votes vote down vote up
public void testSelectionEvent() {
    MaterialNavSection widget = new MaterialNavSection();

    final boolean[] isSelectionEventFired = {false};
    widget.addSelectionHandler(selectionEvent -> isSelectionEventFired[0] = true);
    widget.fireEvent(new GwtEvent<SelectionHandler<?>>() {
        @Override
        public Type<SelectionHandler<?>> getAssociatedType() {
            return SelectionEvent.getType();
        }

        @Override
        protected void dispatch(SelectionHandler eventHandler) {
            eventHandler.onSelection(null);
        }
    });

    assertTrue(isSelectionEventFired[0]);
}
 
Example 15
Project: gwtlib   File: ShowcaseEntryPoint.java   View source code 6 votes vote down vote up
private void init(RootPanel root) {
  _deckPanel = new DeckPanel();
  _tree = createTree();
  _tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
    public void onSelection(SelectionEvent<TreeItem> event) {
      TreeItem item = event.getSelectedItem();
      if(item.getUserObject() != null) {
        ContentWidget widget = (ContentWidget)item.getUserObject();
        widget.init();
        int i = _deckPanel.getWidgetIndex(widget);
        if(i != -1) _deckPanel.showWidget(i);
      }
    }
  });

  FlexTable table = new FlexTable();
  table.setWidget(0, 0, _tree);
  table.setWidget(0, 1, _deckPanel);
  table.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);

  root.add(table);
}
 
Example 16
Project: geowe-core   File: CopyElementDialog.java   View source code 6 votes vote down vote up
private ComboBox<VectorLayerInfo> initLayerCombo1() {
					
	VectorLayerProperties properties = GWT
			.create(VectorLayerProperties.class);

	layerStore1 = new ListStore<VectorLayerInfo>(properties.key());

	layerCombo1 = new ComboBox<VectorLayerInfo>(layerStore1,
			properties.name());
	layerCombo1.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText()));
	layerCombo1.setTypeAhead(true);
	layerCombo1.setTriggerAction(TriggerAction.ALL);
	layerCombo1.setForceSelection(true);
	layerCombo1.setEditable(false);
	layerCombo1.enableEvents();
	layerCombo1.setWidth(width);

	layerCombo1.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() {
		@Override
		public void onSelection(SelectionEvent<VectorLayerInfo> event) {
			layerCombo1.setValue(event.getSelectedItem(), true);
		}
	});

	return layerCombo1;
}
 
Example 17
Project: geowe-core   File: GeoDataImportDialog.java   View source code 6 votes vote down vote up
private SelectionHandler<Widget> getTabPanelSelectionHandler() {
	return new SelectionHandler<Widget>() {

		@Override
		public void onSelection(SelectionEvent<Widget> event) {
			if (UIMessages.INSTANCE.empty().equals(getActiveTab())) {
				dataFormatField.setVisible(false);
			} else {
				dataFormatField.setVisible(true);
			}
			if (UIMessages.INSTANCE.wfs().equals(getActiveTab())) {
				vectorFormatCombo.setValue(VectorFormat.GML_FORMAT);
			} else {
				vectorFormatCombo.setValue(null);
			}
			
			if (UIMessages.INSTANCE.gitHubResponseTitle().equals(getActiveTab())) {					
				layerName.setEnabled(false);
			} else {
				layerName.setEnabled(true);
			}
		}
	};
}
 
Example 18
Project: firefly   File: Toolbar.java   View source code 6 votes vote down vote up
public void onSelection(SelectionEvent<Integer> ise) {
    TabBar tb = (TabBar) ise.getSource();
    int idx = tb.getSelectedTab();
    if (idx == cSelIdx) {
        tb.selectTab(-1, false);
        dropdown.close();
    } else {
        if (!tb.equals(leftToolbar)) {
            leftToolbar.selectTab(-1, false);
        }
        if (!tb.equals(centerToolbar)) {
            centerToolbar.selectTab(-1, false);
        }
        if (!tb.equals(rightToolbar)) {
            rightToolbar.selectTab(-1, false);
        }

        TabHolder th = findTab(idx, tb);
        if (th != null) {
            th.button.activate();
        }
    }
    buttonClicked = false;
}
 
Example 19
Project: gerrit   File: AddMemberBox.java   View source code 6 votes vote down vote up
public AddMemberBox(final String buttonLabel, String hint, SuggestOracle suggestOracle) {
  addPanel = new FlowPanel();
  addMember = new Button(buttonLabel);

  suggestBox = new RemoteSuggestBox(suggestOracle);
  suggestBox.setStyleName(Gerrit.RESOURCES.css().addMemberTextBox());
  suggestBox.setVisibleLength(50);
  suggestBox.setHintText(hint);
  suggestBox.addSelectionHandler(
      new SelectionHandler<String>() {
        @Override
        public void onSelection(SelectionEvent<String> event) {
          addMember.fireEvent(new ClickEvent() {});
        }
      });

  addPanel.add(suggestBox);
  addPanel.add(addMember);

  initWidget(addPanel);
}
 
Example 20
Project: wbi   File: SeriesPanelHistory.java   View source code 6 votes vote down vote up
/**
 * Handle tab selection.
 */
@Override
public void onSelection(SelectionEvent<Integer> event) {
    String tabName = coordinator.getTabName(event.getSelectedItem());

    if (tabName != null) {
        HistoryState state = historyManager.getCurrentState();

        /*
         * Update the current {@code HistoryState} with the name of the
         * selected tab.
         */
        state.setSeriesTabName(tabName);
        historyManager.setState(state);
    }
}
 
Example 21
Project: daris   File: CTabPanel.java   View source code 6 votes vote down vote up
public void selectTab(int index, boolean fireEvents) {

        if (index < 0 || index >= _tabs.size()) {
            throw new AssertionError("Index out of bound.");
        }
        if (index == _selectedIndex) {
            return;
        }
        if (fireEvents) {
            BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index);
            if ((event != null) && event.isCanceled()) {
                return;
            }
        }
        _tabBar.selectTab(index);
        _contentPanel.setContent(_tabs.get(index).content());
        _selectedIndex = index;
        if (fireEvents) {
            SelectionEvent.fire(this, index);
        }
    }
 
Example 22
Project: appformer   File: LazyStackPanel.java   View source code 6 votes vote down vote up
public LazyStackPanel() {

        initWidget(flexTable);

        flexTable.setStyleName("guvnor-lazyStackPanel");

        addSelectionHandler(new SelectionHandler<LazyStackPanelRow>() {

            public void onSelection(SelectionEvent<LazyStackPanelRow> event) {
                LazyStackPanelRow row = event.getSelectedItem();
                if (row.isExpanded()) {
                    row.compress();
                } else {
                    row.expand();
                }
            }
        });
    }
 
Example 23
Project: mvp4g-examples   File: Mvp4gShowCase.java   View source code 6 votes vote down vote up
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
  HorizontalPanel mainPanel = new HorizontalPanel();

  final MiddlePanel mPanel = new MiddlePanel();

  Tree menu = new Tree();
  menu.addSelectionHandler(new SelectionHandler<TreeItem>() {
    public void onSelection(SelectionEvent<TreeItem> event) {
      mPanel.set((MenuItem) event.getSelectedItem());
    }
  });

  initMenu(menu);
  mainPanel.add(menu);
  mainPanel.add(mPanel);
  menu.setSelectedItem(menu.getItem(0));
  mainPanel.setStyleName("mvp4gshowcase");
  RootPanel.get()
           .add(mainPanel);
}
 
Example 24
Project: platypus-js   File: ButtonGroup.java   View source code 6 votes vote down vote up
public ButtonGroup() {
	super();
	addSelectionHandler(new SelectionHandler<UIObject>() {

		@Override
		public void onSelection(SelectionEvent<UIObject> event) {
			if (onItemSelected != null) {
				try {
					JavaScriptObject jsItem = event.getSelectedItem() instanceof HasPublished ? ((HasPublished)event.getSelectedItem()).getPublished() : null; 
					Utils.executeScriptEventVoid(published, onItemSelected, EventsPublisher.publishItemEvent(published, jsItem));
				} catch (Exception e) {
					Logger.getLogger(EventsExecutor.class.getName()).log(Level.SEVERE, null, e);
				}
			}
		}

	});
}
 
Example 25
Project: platypus-js   File: EventsExecutor.java   View source code 6 votes vote down vote up
public void setItemSelected(JavaScriptObject aValue) {
	if (itemSelected != aValue) {
		if (selectedItemReg != null) {
			selectedItemReg.removeHandler();
			selectedItemReg = null;
		}
		itemSelected = aValue;
		if (component instanceof HasSelectionHandlers<?>) {
			selectedItemReg = ((HasSelectionHandlers<Object>) component).addSelectionHandler(new SelectionHandler<Object>() {

				@Override
				public void onSelection(SelectionEvent<Object> event) {
					JavaScriptObject published = ((HasPublished) event.getSource()).getPublished();
					Object oItem = event.getSelectedItem();
					if (oItem instanceof HasPublished)
						oItem = ((HasPublished) oItem).getPublished();
					executeEvent(itemSelected, EventsPublisher.publishItemEvent(published, oItem instanceof JavaScriptObject ? (JavaScriptObject) oItem : null));
				}

			});
		}
	}
}
 
Example 26
Project: qafe-platform   File: QTree.java   View source code 6 votes vote down vote up
private void fireItemClickEvent(final SelectionEvent<TreeItem> event) {
	// When a qaml is listening to a tree with its id, and when clicks on parent tree , as the parent tree is also an item 
	// we dont have to do implicit click handling of item. otherwise 2 times the event will be executed.
	if (isRootItem(event.getSelectedItem())) {
		return;
	}
	
	if (rootItem instanceof QTreeItem) {
		final Label rootItemlabel =((QTreeItem)rootItem).getLabel();
		ClickEvent clickEvent = new ClickEvent() {
			// This is to make sure that we are making the item id and value available as src-id and src-value
			@Override
            public Object getSource() {
				if (event.getSelectedItem() instanceof QTreeItem) {
					return ((QTreeItem)event.getSelectedItem()).getLabel();
				}
                return rootItemlabel;
            }
		};
		rootItemlabel.fireEvent(clickEvent);
	}
}
 
Example 27
Project: zeus3   File: TableInfoPanel.java   View source code 6 votes vote down vote up
public TableInfoPanel(TableManagerPresenter c) {
	this.presenter = c;
	this.context = presenter.getPlatformContext();
	setBodyBorder(false);
	add(getTableInfoTab(), new TabItemConfig("基本信息"));
	add(getColumnInfoTab(), new TabItemConfig("字段信息"));
	add(getPtTab(), new TabItemConfig("分区信息"));

	addSelectionHandler(new SelectionHandler<Widget>() {

		@Override
		public void onSelection(SelectionEvent<Widget> event) {
			if (getConfig(event.getSelectedItem()).getText().equals("分区信息")) {
				if (isPartitionLoaded() == false) {
					getPtTab().load(table);
					setPartitionLoaded(true);
				}
			}
		}
	});
}
 
Example 28
Project: multipool-stats-backend   File: AbstractPoolView.java   View source code 6 votes vote down vote up
@Override
public void setExchangePlaces(List<ExchangePlaceDTO> places) {
	if (places != null && places.size() > 0) {
		for (final ExchangePlaceDTO place : places) {
			MenuItem placeItem = new MenuItem(place.getLabel());
			Menu subMenu = new Menu();
			placeItem.setSubMenu(subMenu);
			currencyMenu.add(placeItem);

			for (final String currencyCode : place.getCurrencyCodes()) {
				MenuItem currencyItem = new MenuItem(currencyCode);
				currencyItem.addSelectionHandler(new SelectionHandler<Item>() {
					public void onSelection(SelectionEvent<Item> event) {
						presenter.loadCurrencyDetails(place, currencyCode);
					}
				});
				subMenu.add(currencyItem);
			}
		}
		currencyButton.setEnabled(true);
	}
}
 
Example 29
Project: rva   File: PresentationManageWidget.java   View source code 6 votes vote down vote up
private void initSelection() {
    // Hook up a tab listener to do something when the user selects a tab.
	contentBar.addSelectionHandler(new SelectionHandler<Integer>() {
		public void onSelection(SelectionEvent<Integer> event) {
			if (presentationInfo != null) {
				updateData();
			}
			
			int selectedIndex = event.getSelectedItem();
			contentPanel.showWidget(selectedIndex);
			
			// fixes issues with the editor when instance is first shown
			if (contentPanel.getVisibleWidget() == HTML_INDEX){
				htmlArea.onShow();
			}
			
			// update the layout every time
			layoutWidget.initWidget(presentationInfo);
		}
	});
}
 
Example 30
Project: preferanser   File: TablePanel.java   View source code 6 votes vote down vote up
public TablePanel() {
    initWidget(uiBinder.createAndBindUi(this));

    locationPanelMap.put(EAST, eastCardsPanel);
    locationPanelMap.put(SOUTH, southCardsPanel);
    locationPanelMap.put(WEST, westCardsPanel);
    locationPanelMap.put(CENTER, centerCardsPanel);
    locationPanelMap.put(WIDOW, widowPanel);

    int cardWidth = resources.c7().getWidth() / 2;
    int cardHeight = resources.c7().getHeight() / 2;
    centerCardLayout = new CenterLayout(centerCardsPanel, cardWidth, cardHeight);
    locationLayoutMap.put(EAST, new EastLayout(eastCardsPanel, cardWidth, cardHeight));
    locationLayoutMap.put(SOUTH, new HorizontalLayout(southCardsPanel, cardWidth));
    locationLayoutMap.put(WEST, new WestLayout(westCardsPanel, cardWidth, cardHeight));
    locationLayoutMap.put(WIDOW, new WidowLayout(widowPanel, cardWidth, cardHeight));

    switchToTab(0);
    centerTabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            layoutLocation(TableLocation.CENTER);
            layoutLocation(TableLocation.WIDOW);
        }
    });
}
 
Example 31
Project: incubator-wave   File: EditorHarness.java   View source code 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example 32
Project: sig-seguimiento-vehiculos   File: GeoprocessDialog.java   View source code 5 votes vote down vote up
private void createComboLayer(final ComboBox<VectorLayerInfo> combo,
		final String numCombo, final TextButton validateButton) {
	clearLayerComboBox(combo);
	combo.setTypeAhead(true);
	combo.setTriggerAction(TriggerAction.ALL);
	combo.setForceSelection(true);
	combo.setEditable(false);
	combo.enableEvents();
	combo.setWidth(WIDTH_COMBO_LAYER);
	combo.setId(numCombo);

	combo.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() {
		@Override
		public void onSelection(SelectionEvent<VectorLayerInfo> event) {
			combo.setValue(event.getSelectedItem(), true);
			List<VectorLayerInfo> updatedLayers = removeLayer(event
					.getSelectedItem());
			if (COMBO1_ID.equals(combo.getId())) {
				updateCombo(LAYER_COMBO_2, LAYER_STORE_2, updatedLayers);
			} else {
				updateCombo(LAYER_COMBO_1, LAYER_STORE_1, updatedLayers);
			}
		}
	});
	
	validateButton.setToolTip(UIMessages.INSTANCE
			.descriptionValidationToolText());

	final HorizontalPanel horizontalGroup = getHorizontalPanel();
	horizontalGroup.add(combo);
	horizontalGroup.add(validateButton);

	panel.add(new Label(UIMessages.INSTANCE.layerLabelText(numCombo)));
	panel.add(horizontalGroup);
}
 
Example 33
Project: sig-seguimiento-vehiculos   File: GeoprocessDialog.java   View source code 5 votes vote down vote up
private void createGeoprocessAndDistanceField(final Geoprocesses spatialOperation) {
	spatialOperationComboBox = new GeoprocessComboBox(
			spatialOperation.getAll());
	spatialOperationComboBox.setWidth(WIDTH_SPATIAL_OPERATION_COMBO);
	clearSpatialOperationComboBox();				
	spatialOperationComboBox
			.addSelectionHandler(new SelectionHandler<Geoprocess>() {
				@Override
				public void onSelection(SelectionEvent<Geoprocess> event) {
					spatialOperationComboBox.setValue(
							event.getSelectedItem(), true);

					if (event.getSelectedItem() instanceof BufferGeoprocess) {
						LAYER_COMBO_2.setValue(null);
						LAYER_COMBO_2.setEnabled(false);
						distanceTextField.setText("0");
						distanceTextField.setEnabled(true);
						distanceTextField.setVisible(true);
					} else {							
						LAYER_COMBO_2.setEnabled(true);
						distanceTextField.setText("");
						distanceTextField.setEnabled(false);
						distanceTextField.setVisible(false);
					}
				}
			});

	initDistanceTextField();
	final HorizontalPanel horizontalGroup = getHorizontalPanel();
	horizontalGroup.add(spatialOperationComboBox);
	horizontalGroup.add(distanceTextField);
	panel.add(horizontalGroup);
}
 
Example 34
Project: sig-seguimiento-vehiculos   File: GeoprocessComboBox.java   View source code 5 votes vote down vote up
private void createSelectionHandler() {
	addSelectionHandler(new SelectionHandler<Geoprocess>() {
		@Override
		public void onSelection(SelectionEvent<Geoprocess> event) {
			setValue(event.getSelectedItem(), true);
		}
	});
}
 
Example 35
Project: sig-seguimiento-vehiculos   File: VectorFormatComboBox.java   View source code 5 votes vote down vote up
private void createSelectionHandler() {
	addSelectionHandler(new SelectionHandler<VectorFormat>() {
		@Override
		public void onSelection(SelectionEvent<VectorFormat> event) {
			setValue(event.getSelectedItem(), true);
		}
	});
}
 
Example 36
Project: sig-seguimiento-vehiculos   File: ExportDataDialog.java   View source code 5 votes vote down vote up
private SelectionHandler<VectorFormat> getVectorComboSelectionHandler() {
	return new SelectionHandler<VectorFormat>() {
		@Override
		public void onSelection(SelectionEvent<VectorFormat> event) {
				epsgCombo.enable();
		}
	};
}
 
Example 37
Project: LAS   File: OutputPanel.java   View source code 5 votes vote down vote up
@Override
public void onSelection(SelectionEvent<TreeItem> event) {

	TreeItem item = event.getSelectedItem();
	Object v = item.getUserObject();
	if (v instanceof VariableSerializable) {
		datasetButton.close();
	}
}
 
Example 38
Project: LAS   File: BaseUI.java   View source code 5 votes vote down vote up
/**
 * @param handler
 * @deprecated Currently there are no listeners for {@link SelectionHandler
 *             <TreeItem>} handlers in this class. TODO: Fix that
 */
@Deprecated
public void setDatasetSelectionHandler(SelectionHandler<TreeItem> handler) {
    xRegisterDatasetSelectionHandler.removeHandler();
    // xRegisterDatasetSelectionHandler = xDatasetButton
    // .addSelectionHandler(handler);
    xRegisterDatasetSelectionHandler = eventBus.addHandler(SelectionEvent.getType(), handler);
}
 
Example 39
Project: LAS   File: VariableMetadataActivity.java   View source code 5 votes vote down vote up
/**
 * @see com.google.gwt.event.logical.shared.SelectionHandler#onSelection(com.google.gwt.event.logical.shared.SelectionEvent)
 */
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    if ( (view != null) && (event != null) ) {
        Object source = event.getSource();
        // Only proceed if the source was from the same panel
        if ( (source != null) && (source instanceof HasName) ) {
            String sourceName = ((HasName) source).getName();
            if ( view.getName().equalsIgnoreCase(sourceName) ) {
                TextBox breadcrumbs = view.getBreadcrumbs();
                TreeItem selectedItem = event.getSelectedItem();
                if ( selectedItem != null ) {
                    String selectedItemText = selectedItem.getText();
                    // Only bother to update the bread crumbs if the
                    // user
                    // has
                    // selected an item that has actually loaded
                    if ( !selectedItemText.equalsIgnoreCase(DatasetWidget.LOADING) ) {
                        // Update bread crumbs by walking the meta data
                        // categories GUI tree already in memory
                        TreeItem parentItem = selectedItem.getParentItem();
                        if ( parentItem != null ) {
                            // First clear bread crumbs so events fire
                            // even
                            // when there is no change in
                            // breadcrumbsText
                            // characters, but set boolean fireEvents to
                            // false to avoid unnecessary event firing.
                            breadcrumbs.setValue("", false);
                            String breadcrumbsText = getBreadcrumbsText(parentItem);
                            breadcrumbs.setValue(breadcrumbsText, true);
                        }
                    }
                }
            }
        }
    }
}
 
Example 40
Project: LAS   File: MultiVariableSelectorActivity.java   View source code 5 votes vote down vote up
/**
 * @return view
 */
public MultiVariableSelector init() {
    MultiVariableSelector view = clientFactory.getMultiVariableSelector(name);
    view.setPresenter(this);

    updateVariablesTreeItemSelectionHandler = new UpdateVariablesTreeItemSelectionHandler(view);
    eventBus.addHandler(SelectionEvent.getType(), updateVariablesTreeItemSelectionHandler);

    return view;
}