com.google.gwt.user.client.Random Java Examples
The following examples show how to use
com.google.gwt.user.client.Random.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockComponent.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * Sets the components widget representation and initializes its properties. * * <p>To be called from implementing constructor. * * @param widget components visual representation in designer */ void initComponent(Widget widget) { // Widget needs to be initialized before the component itself so that the component properties // can be reflected by the widget initWidget(widget); // Capture mouse and click events in onBrowserEvent(Event) sinkEvents(Event.MOUSEEVENTS | Event.ONCLICK | Event.TOUCHEVENTS); // Add the special name property and set the tooltip String name = componentName(); setTitle(name); addProperty(PROPERTY_NAME_NAME, name, null, new TextPropertyEditor()); // TODO(user): Ensure this value is unique within the project using a list of // already used UUIDs // Set the component's UUID // The default value here can be anything except 0, because YoungAndroidProjectServce // creates forms with an initial Uuid of 0, and Properties.java doesn't encode // default values when it generates JSON for a component. addProperty(PROPERTY_NAME_UUID, "-1", null, new TextPropertyEditor()); changeProperty(PROPERTY_NAME_UUID, "" + Random.nextInt()); editor.getComponentPalettePanel().configureComponent(this); }
Example #2
Source File: ImageButton.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
private void init() { setStyleName("n52_sensorweb_client_imagebutton"); // int length = this.size + 2 * this.margin; // this.setWidth(length); // this.setHeight(length); String loaderId = "loader_" + (LoaderManager.getInstance().getCount() + Random.nextInt(10000)); this.loader = new LoaderImage(loaderId, "../img/mini_loader_bright.gif", this); this.setID(this.id); this.setSrc(this.icon); this.setShowHover(true); this.setShowRollOver(this.showRollOver); this.setShowDownIcon(this.showDown); this.setShowFocusedAsOver(false); this.setCursor(Cursor.POINTER); if (View.getView().isShowExtendedTooltip()) { this.setTooltip(this.extendedTooltip); } else { this.setTooltip(this.shortToolTip); } }
Example #3
Source File: DiagramController.java From EasyML with Apache License 2.0 | 5 votes |
/** * Place a new widget to paint panel * * @param widget */ public void addWidget(final BaseWidget widget) { int h = this.scrollPanel.getOffsetHeight(); int w = this.scrollPanel.getOffsetWidth(); int offsetx = this.scrollPanel.getHorizontalScrollPosition(); int offsety = this.scrollPanel.getVerticalScrollPosition(); int x = offsetx + 4 * w / 9 + Random.nextInt(100); int y = offsety + 2 * h / 7 + Random.nextInt(100); addWidget(widget, x, y); }
Example #4
Source File: FillStyle.java From geowe-core with GNU General Public License v3.0 | 5 votes |
public FillStyle() { this.normalColor = StyleFactory.stringToColour( String.valueOf(Random.nextInt())); this.hoverColor = DEFAULT_HOVER_COLOR; this.selectedColor = DEFAULT_SELECTED_COLOR; this.fillOpacity = DEFAULT_OPACITY; }
Example #5
Source File: StyleFactory.java From geowe-core with GNU General Public License v3.0 | 5 votes |
/** * Crea un mapa de estilos por defecto, aplicando color normal * uno obtenido de manera aleatoria. * * @return */ public static StyleMap createDefaultStyleMap() { String default_normal_color = String.valueOf(Random.nextInt()); return createStyleMap( StyleFactory.stringToColour(default_normal_color), FillStyle.DEFAULT_SELECTED_COLOR, FillStyle.DEFAULT_HOVER_COLOR, null, null); }
Example #6
Source File: FakePersonService.java From gwt-material-demo with Apache License 2.0 | 5 votes |
@Override public void getCategories(AsyncCallback<List<String>> async) { // Fake a delay for the demo new Timer() { @Override public void run() { async.onSuccess(categories); } }.schedule(Math.min(200, Random.nextInt(500))); }
Example #7
Source File: GadgetWidget.java From swellrt with Apache License 2.0 | 5 votes |
/** * Constructs GadgetWidget for testing. */ private GadgetWidget() { clientInstanceId = nextClientInstanceId++; clientInstanceLogLabel = "[" + clientInstanceId + "]"; prefElements = CollectionUtils.createStringMap(); stateElements = CollectionUtils.createStringMap(); rpcToken = "" + ((Long.valueOf(Random.nextInt()) << 32) | (Long.valueOf(Random.nextInt()) & 0xFFFFFFFFL)); }
Example #8
Source File: GadgetWidget.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Constructs GadgetWidget for testing. */ private GadgetWidget() { clientInstanceId = nextClientInstanceId++; clientInstanceLogLabel = "[" + clientInstanceId + "]"; prefElements = CollectionUtils.createStringMap(); stateElements = CollectionUtils.createStringMap(); rpcToken = "" + ((Long.valueOf(Random.nextInt()) << 32) | (Long.valueOf(Random.nextInt()) & 0xFFFFFFFFL)); }
Example #9
Source File: TopologyPresenter.java From core with GNU Lesser General Public License v2.1 | 5 votes |
private List<HostInfo> generateFakeDomain() { String[] hostNames = new String[]{"lightning", "eeak-a-mouse", "dirty-harry"}; String[] groupNames = new String[]{"staging", "production", "messaging-back-server-test", "uat", "messaging", "backoffice", "starlight"}; int numHosts = 13; final List<HostInfo> hostInfos = new ArrayList<HostInfo>(); for (int i = 0; i < numHosts; i++) { // host info String name = hostNames[Random.nextInt(2)] + "-" + i; boolean isController = (i < 1); HostInfo host = new HostInfo(name, isController); host.setServerInstances(new ArrayList<ServerInstance>()); // server instances for (int x = 0; x < (Random.nextInt(5) + 1); x++) { int groupIndex = Random.nextInt(groupNames.length - 1); ServerInstance serverInstance = beanFactory.serverInstance().as(); serverInstance.setGroup(groupNames[groupIndex]); serverInstance.setRunning((groupIndex % 2 == 0)); if (serverInstance.isRunning()) { if (Random.nextBoolean()) { serverInstance.setFlag(Random.nextBoolean() ? RESTART_REQUIRED : RELOAD_REQUIRED); } else { serverInstance.setFlag(null); } } serverInstance.setName(groupNames[groupIndex] + "-" + x); serverInstance.setSocketBindings(Collections.<String, String>emptyMap()); serverInstance.setInterfaces(Collections.<String, String>emptyMap()); host.getServerInstances().add(serverInstance); } hostInfos.add(host); } return hostInfos; }
Example #10
Source File: ClientUtils.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private static String getNextFormattedRandomNumber() { String randomHex = Integer.toHexString(Random.nextInt(256)); if (randomHex.length() == 1) { // ensure two digits randomHex = "0" + randomHex; } return randomHex; }
Example #11
Source File: UserCard.java From gwt-material-demo with Apache License 2.0 | 4 votes |
public int getRandomHeight(){ return items[Random.nextInt(items.length)]; }
Example #12
Source File: FlowDemo.java From core with GNU Lesser General Public License v2.1 | 4 votes |
RandomTimedFunction(String name, boolean shouldFail) { this.name = name; this.delayMillis = Random.nextInt(20) * 100; this.shouldFail = shouldFail; }