DSTGu项目u WebKalkulator_
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DSTGu项目u WebKalkulator_相关的知识,希望对你有一定的参考价值。
Web aplikacija generira sluÄajne registracijske oznake za grad Zagreb u odabranom formatu. Ispisuje se i broj mogućih razliÄitih registracijskih tablica za taj format.
/////////////////////////////////// Klasa Kalkulator.java /////// /******************************************************************************* * Copyright 2011 Google Inc. All Rights Reserved. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package hr.foi.dstg.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class Kalkulator implements EntryPoint { public void onModuleLoad() { RootPanel rootPanel = RootPanel.get(); Calc calc = new Calc(); rootPanel.add(calc, 10, 10); calc.setSize("344px", "223px"); } } /////////////////////////////////// Klasa Calc.java /////// package hr.foi.dstg.client; import java.util.Random; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.NumberLabel; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.user.client.ui.HasHorizontalAlignment; RadioButton rdbtnOdabirFormata1 = new RadioButton("new name", "Grad - 3 brojke - 2 slova"); RadioButton rdbtnOdabirFormata2 = new RadioButton("new name", "Grad - 4 brojke - 2 slova"); RadioButton rdbtnOdabirFormata3 = new RadioButton("new name", "Grad - 3 brojke - 1 slovo"); RadioButton rdbtnOdabirFormata4 = new RadioButton("new name", "Grad - 4 brojke - 1 slovo"); NumberLabel<Integer> lblIspisBrojaPermutacija = new NumberLabel<Integer>(); { char[] text = new char[length]; for (int i = 0; i < length; i++) { text[i] = characters.charAt(rng.nextInt(characters.length())); } } public Calc() { VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setBorderWidth(0); initWidget(verticalPanel); lblNaslov.setStyleName("gwt-DialogBox"); verticalPanel.add(lblNaslov); lblNaslov.setWidth("449px"); FlexTable flexTable = new FlexTable(); flexTable.setBorderWidth(0); verticalPanel.add(flexTable); rdbtnOdabirFormata1.setValue(true); flexTable.setWidget(0, 0, rdbtnOdabirFormata1); flexTable.setWidget(1, 0, rdbtnOdabirFormata2); flexTable.setWidget(2, 0, rdbtnOdabirFormata3); flexTable.setWidget(3, 0, rdbtnOdabirFormata4); verticalPanel.add(btnIzracunaj); FlexTable flexTable_1 = new FlexTable(); flexTable_1.setBorderWidth(0); verticalPanel.add(flexTable_1); flexTable_1.setWidth("338px"); flexTable_1.setWidget(0, 0, lblBrojPermutacija); flexTable_1.setWidget(0, 1, lblIspisBrojaPermutacija); flexTable_1.setWidget(1, 0, lblSluajnoGeneriranaRegistracija); flexTable_1.setWidget(1, 1, lblIspisregistracije); flexTable_1.setWidget(2, 0, lblBrojSvihMoguih); NumberLabel<Integer> lblIspisUkupanBroj = new NumberLabel<Integer>(); flexTable_1.setWidget(2, 1, lblIspisUkupanBroj); flexTable_1.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT); flexTable_1.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); flexTable_1.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); flexTable_1.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); lblIspisUkupanBroj.setValue(5009400); btnIzracunaj.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int pom = 0; int broj = 0; if (rdbtnOdabirFormata1.getValue()) { pom = 9*10*10*22*22; lblIspisBrojaPermutacija.setValue(pom); broj = generator.nextInt(900) + 100; slova = generateString(generator, "ABCDEFGHIJKLMNOPRSTUVZ", 2); } else if (rdbtnOdabirFormata2.getValue()) { pom = 9*10*10*10*22*22; lblIspisBrojaPermutacija.setValue(pom); broj = generator.nextInt(900) * generator.nextInt(10) + 1100; slova = generateString(generator, "ABCDEFGHIJKLMNOPRSTUVZ", 2); } else if (rdbtnOdabirFormata3.getValue()) { pom = 9*10*10*22; lblIspisBrojaPermutacija.setValue(pom); broj = generator.nextInt(900) + 100; slova = generateString(generator, "ABCDEFGHIJKLMNOPRSTUVZ", 1); } else if (rdbtnOdabirFormata4.getValue()) { pom = 9*10*10*10*22; lblIspisBrojaPermutacija.setValue(pom); broj = generator.nextInt(900) * generator.nextInt(10) + 1100; slova = generateString(generator, "ABCDEFGHIJKLMNOPRSTUVZ", 1); } ; } }); } }
以上是关于DSTGu项目u WebKalkulator_的主要内容,如果未能解决你的问题,请参考以下文章
buildroot构建项目--- u-boot 2017.11 适配开发板修改 4 ---- 系统启动初始化之四
为啥 getItem 在我的代码中使用 asyncStorage 返回 'Promise "_U": 0, "_V": 0, "_W":