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

The following are top voted examples for showing how to use com.google.gwt.event.logical.shared.SelectionHandler. 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: DocIT   File: TreePanel.java   Source Code and License 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 2
Project: EasyML   File: BaseTree.java   Source Code and License 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 3
Project: sig-seguimiento-vehiculos   File: CopyElementDialog.java   Source Code and License 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 4
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   Source Code and License 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 5
Project: Wiab.pro   File: EditorHarness.java   Source Code and License 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 6
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 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 7
Project: dataworks-zeus   File: TableInfoPanel.java   Source Code and License 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 8
Project: gwt-material   File: MaterialNavSectionTest.java   Source Code and License 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 9
Project: gwtlib   File: ShowcaseEntryPoint.java   Source Code and License 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 10
Project: geowe-core   File: CopyElementDialog.java   Source Code and License 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 11
Project: geowe-core   File: GeoDataImportDialog.java   Source Code and License 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 12
Project: gerrit   File: AddMemberBox.java   Source Code and License 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 13
Project: appformer   File: LazyStackPanel.java   Source Code and License 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 14
Project: mvp4g-examples   File: Mvp4gShowCase.java   Source Code and License 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 15
Project: platypus-js   File: ButtonGroup.java   Source Code and License 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 16
Project: platypus-js   File: EventsExecutor.java   Source Code and License 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 17
Project: zeus3   File: TableInfoPanel.java   Source Code and License 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 18
Project: multipool-stats-backend   File: AbstractPoolView.java   Source Code and License 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 19
Project: rva   File: PresentationManageWidget.java   Source Code and License 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 20
Project: preferanser   File: TablePanel.java   Source Code and License 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 21
Project: incubator-wave   File: EditorHarness.java   Source Code and License 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 22
Project: sig-seguimiento-vehiculos   File: GeoprocessDialog.java   Source Code and License 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 23
Project: sig-seguimiento-vehiculos   File: GeoprocessDialog.java   Source Code and License 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 24
Project: sig-seguimiento-vehiculos   File: GeoprocessComboBox.java   Source Code and License 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 25
Project: sig-seguimiento-vehiculos   File: VectorFormatComboBox.java   Source Code and License 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 26
Project: sig-seguimiento-vehiculos   File: ExportDataDialog.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<VectorFormat> getVectorComboSelectionHandler() {
	return new SelectionHandler<VectorFormat>() {
		@Override
		public void onSelection(SelectionEvent<VectorFormat> event) {
				epsgCombo.enable();
		}
	};
}
 
Example 27
Project: LAS   File: BaseUI.java   Source Code and License 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 28
Project: document-management-system   File: FolderSelectTree.java   Source Code and License 5 votes vote down vote up
/**
 * Folder Tree
 */
public FolderSelectTree() {
	tree = new Tree();
	rootItem.setStyleName("okm-TreeItem");
	rootItem.setUserObject(new GWTFolder());
	rootItem.setSelected(true);
	rootItem.setState(true);
	tree.setStyleName("okm-Tree");
	tree.addItem(rootItem);
	tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			boolean refresh = true;
			TreeItem item = event.getSelectedItem();

			// Case that not refreshing tree and file browser ( right click )
			if (actualItem.equals(item)) {
				refresh = false;
			} else {
				// Disables actual item because on changing active node by
				// application this it's not changed automatically
				if (!actualItem.equals(item)) {
					actualItem.setSelected(false);
					actualItem = item;
				} else {
					refresh = false;
				}
			}

			if (refresh) {
				refresh(true);
			}
		}
	});
	actualItem = tree.getItem(0);
	initWidget(tree);
}
 
Example 29
Project: document-management-system   File: FolderSelectTree.java   Source Code and License 5 votes vote down vote up
/**
 * Folder Tree
 */
public FolderSelectTree() {
	tree = new Tree();
	rootItem.setStyleName("okm-TreeItem");
	rootItem.setUserObject(new GWTFolder());
	rootItem.setSelected(true);
	rootItem.setState(true);
	tree.setStyleName("okm-Tree");
	tree.addItem(rootItem);
	tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			boolean refresh = true;
			TreeItem item = event.getSelectedItem();

			// Case that not refreshing tree and file browser ( right click )
			if (actualItem.equals(item)) {
				refresh = false;
			} else {
				// Disables actual item because on changing active node by
				// application this it's not changed automatically
				if (!actualItem.equals(item)) {
					actualItem.setSelected(false);
					actualItem = item;
				} else {
					refresh = false;
				}
			}

			if (refresh) {
				refresh(true);
			}
		}
	});
	actualItem = tree.getItem(0);
	initWidget(tree);
}
 
Example 30
Project: ephesoft   File: ReviewPanel.java   Source Code and License 5 votes vote down vote up
private void setHandlerForSuggestBox(final SuggestBox suggestBox) {
	suggestBox.addSelectionHandler(new SelectionHandler<Suggestion>() {

		@Override
		public void onSelection(SelectionEvent<Suggestion> arg0) {
			String value = suggestBox.getText();
			for (int i = 0; i < documentTypes.getItemCount(); i++) {
				if (documentTypes.getItemText(i).equalsIgnoreCase(value)) {
					ScreenMaskUtility.maskScreen();
					onDocumentTypeChange(documentTypes.getValue(i));
					break;
				}
			}
		}
	});
	validatableSuggestBox = new ValidatableWidget<SuggestBox>(suggestBox);

	validatableSuggestBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

		@Override
		public void onValueChange(ValueChangeEvent<String> event) {
			validatableSuggestBox.toggleValidDateBox();
		}
	});

	List<String> altValues = new ArrayList<String>();
	for (int i = 0; i < documentTypes.getItemCount(); i++) {
		altValues.add(documentTypes.getItemText(i));
	}
	validatableSuggestBox.addValidator(new SuggestBoxValidator(suggestBox, altValues));
	validatableSuggestBox.toggleValidDateBox();
}
 
Example 31
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<MenuItem> getCollapseSelectionHandler() {
  if (collapseSelectionHandler == null) {
    collapseSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
        getPresenter().onCollapse();
      }
    };
  }
  return collapseSelectionHandler;
}
 
Example 32
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<MenuItem> getCreateSelectionHandler() {
  if (createSelectionHandler == null) {
    createSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
      	Boolean folder = event.getSelectedItem().<Boolean> getData(FILE_TYPE);
        String suffix=event.getSelectedItem().getData(FILE_SUFFIX);
        getPresenter().onCreate(folder,suffix);
      }
    };
  }
  return createSelectionHandler;
}
 
Example 33
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<MenuItem> getEditNameSelectionHandler() {
  if (editNameSelectionHandler == null) {
    editNameSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
        getPresenter().onEditName();
      }
    };
  }
  return editNameSelectionHandler;
}
 
Example 34
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<MenuItem> getExpandSelectionHandler() {
  if (expandSelectionHandler == null) {
    expandSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
        getPresenter().onExpand();
      }
    };
  }
  return expandSelectionHandler;
}
 
Example 35
Project: dataworks-zeus   File: FileMenu.java   Source Code and License 5 votes vote down vote up
private SelectionHandler<MenuItem> getOpenSelectionHandler() {
  if (openSelectionHandler == null) {
    openSelectionHandler = new SelectionHandler<MenuItem>() {
      @Override
      public void onSelection(SelectionEvent<MenuItem> event) {
        getPresenter().onOpen();
      }
    };
  }
  return openSelectionHandler;
}
 
Example 36
Project: dataworks-zeus   File: DependencyConfigWindow.java   Source Code and License 5 votes vote down vote up
private void Init() {
	setHeight(600);
	setWidth(500);
	setModal(true);
	tabPanel = new TabPanel();
	tabPanel.addSelectionHandler(new SelectionHandler<Widget>() {
        @Override
        public void onSelection(SelectionEvent<Widget> event) {
        	Widget selectedItem = event.getSelectedItem();
        	if (selectedItem instanceof JobTreePanel) {
				JobTreePanel panel = (JobTreePanel)selectedItem;
				if (panel==copyPanel && !panel.isHasData()) {
					copyPanel.loadDataOfOtherDependentJob(jobId);
				}
			}
        }
      });
	checkablePanel = new JobTreePanel();
	checkablePanel.setHeadingText("选择依赖任务(可以多选)");
	copyPanel = new JobTreePanel();
	copyPanel.setHeadingText("复制所选依赖任务的依赖到本任务");
	copyPanel.getTree().setCheckable(false);
	copyPanel.getTree().getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
	tabPanel.add(checkablePanel,new TabItemConfig("选择依赖任务",false));
	tabPanel.add(copyPanel,new TabItemConfig("复制依赖到本任务",false));
	add(tabPanel);
}
 
Example 37
Project: gwt-material   File: MaterialDropDown.java   Source Code and License 5 votes vote down vote up
@Override
public HandlerRegistration addSelectionHandler(final SelectionHandler<Widget> handler) {
    return addHandler((SelectionHandler<Widget>) event -> {
        Widget widget = event.getSelectedItem();
        if (widget instanceof HasEnabled && ((HasEnabled) widget).isEnabled() && isEnabled()) {
            handler.onSelection(event);
        }
    }, SelectionEvent.getType());
}
 
Example 38
Project: sc2gears   File: Menu.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new Menu.
 */
public Menu( final MenuItem[] menuItems, final Panel pageContainer ) {
	this.menuItems     = menuItems;
	this.pageContainer = pageContainer;
	
	for ( final MenuItem mi : menuItems )
		addTab( mi.getLabel() );
	
	addSelectionHandler( new SelectionHandler< Integer >() {
		@Override
		public void onSelection( final SelectionEvent< Integer > event ) {
			menuItems[ event.getSelectedItem() ].onActivate( Menu.this );
		}
	} );
}
 
Example 39
Project: riscoss-corporate   File: IndexedTab.java   Source Code and License 5 votes vote down vote up
public IndexedTab() {
	tab.addSelectionHandler( new SelectionHandler<Integer>() {
		@Override
		public void onSelection(SelectionEvent<Integer> event) {
			onTabActivated( event );
		}
	});
	tab.setStyleName("tab");
}
 
Example 40
Project: geowe-core   File: GeoprocessDialog.java   Source Code and License 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);
}