Skip to content

Commit

Permalink
Issue CruxFramework#2 - Make Showcase project compatible with Crux 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Cardoso committed Dec 16, 2015
1 parent 7fb4f28 commit 07cf775
Show file tree
Hide file tree
Showing 45 changed files with 213 additions and 406 deletions.
1 change: 0 additions & 1 deletion cross-device-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cruxVersion>5.5-SNAPSHOT</cruxVersion>
<java.source.version>1.7</java.source.version>
<java.target.version>1.7</java.target.version>
<cruxVersion>5.5-SNAPSHOT</cruxVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
@DataObject("carCarousel")
public class Car
{
private static int idCounter = 0;
private int id;
private Integer id;
private String brand;
private String source;
private int year;
Expand All @@ -15,9 +14,9 @@ public Car()
{
}

public Car(String brand, String source, int year)
public Car(Integer id, String brand, String source, int year)
{
this.id = idCounter++;
this.id = id;
this.source = source;
this.brand = brand;
this.year = year;
Expand Down Expand Up @@ -53,12 +52,12 @@ public void setYear(int year)
this.year = year;
}

public int getId()
public Integer getId()
{
return id;
}

public void setId(int id)
public void setId(Integer id)
{
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ public class CarouselController
public void onLoadData(EagerLoadEvent<Car> event)
{
ArrayList<Car> cars = new ArrayList<Car>();
cars.add(new Car("Audi", "Germany", 1909));
cars.add(new Car("BMW", "Germany", 1916));
cars.add(new Car("Chevrolet", "EUA", 1911));
cars.add(new Car("Ford", "EUA", 1919));
cars.add(new Car("GMC", "EUA", 1908));
cars.add(new Car("Honda Cars", "Japan", 1948));
cars.add(new Car("Hyundai", "South Korea", 1967));
cars.add(new Car("Mercedes", "Germany", 1926));
cars.add(new Car("Peterbilt", "EUA", 1939));
cars.add(new Car("Scania", "Sweden", 1891));
cars.add(new Car("Volkswagen", "Germany", 1937));
cars.add(new Car("Volvo", "Sweden", 1927));
cars.add(new Car("Yamaha", "Japan", 1955));
cars.add(new Car("Honda", "Japan", 1948));
cars.add(new Car("Mitsubishi", "Japan", 1970));
cars.add(new Car(0, "Audi", "Germany", 1909));
cars.add(new Car(1, "BMW", "Germany", 1916));
cars.add(new Car(2, "Chevrolet", "EUA", 1911));
cars.add(new Car(3, "Ford", "EUA", 1919));
cars.add(new Car(4, "GMC", "EUA", 1908));
cars.add(new Car(5, "Honda Cars", "Japan", 1948));
cars.add(new Car(6, "Hyundai", "South Korea", 1967));
cars.add(new Car(7, "Mercedes", "Germany", 1926));
cars.add(new Car(8, "Mitsubishi", "Japan", 1970));
cars.add(new Car(9, "Peterbilt", "EUA", 1939));
cars.add(new Car(10, "Scania", "Sweden", 1891));
cars.add(new Car(11, "Volkswagen", "Germany", 1937));
cars.add(new Car(12, "Volvo", "Sweden", 1927));
cars.add(new Car(13, "Yamaha", "Japan", 1955));

event.getSource().setData(cars);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@ public class ComboBoxController
public void onLoadData(EagerLoadEvent<Country> event)
{
ArrayList<Country> countries = new ArrayList<Country>();
countries.add(new Country("Algeria", "Argel"));
countries.add(new Country("Argentina", "Buenos Aires"));
countries.add(new Country("Australia", "Camberra"));
countries.add(new Country("Brazil", "Brasília"));
countries.add(new Country("Canada", "Ottawa"));
countries.add(new Country("Chile", "Santiago"));
countries.add(new Country("China", "Pequim"));
countries.add(new Country("CostaRica", "San José"));
countries.add(new Country("France", "Paris"));
countries.add(new Country("Germany", "Berlim"));
countries.add(new Country("Italy", "Roma"));
countries.add(new Country("Japan", "Tóquio"));
countries.add(new Country("Mexico", "México"));
countries.add(new Country("Morocco", "Rabat"));
countries.add(new Country("South Africa", "Pretória, Cabo, Bloemfontein"));
countries.add(new Country("South Korea", "Seul"));
countries.add(new Country("USA", "Washington, D.C."));
countries.add(new Country(0, "Algeria", "Argel"));
countries.add(new Country(1, "Argentina", "Buenos Aires"));
countries.add(new Country(2, "Australia", "Camberra"));
countries.add(new Country(3, "Brazil", "Brasília"));
countries.add(new Country(4, "Canada", "Ottawa"));
countries.add(new Country(5, "Chile", "Santiago"));
countries.add(new Country(6, "China", "Pequim"));
countries.add(new Country(7, "CostaRica", "San José"));
countries.add(new Country(8, "France", "Paris"));
countries.add(new Country(9, "Germany", "Berlim"));
countries.add(new Country(10, "Italy", "Roma"));
countries.add(new Country(11, "Japan", "Tóquio"));
countries.add(new Country(12, "Mexico", "México"));
countries.add(new Country(13, "Morocco", "Rabat"));
countries.add(new Country(14, "South Africa", "Pretória, Cabo, Bloemfontein"));
countries.add(new Country(15, "South Korea", "Seul"));
countries.add(new Country(16, "Spain", "Madri"));
countries.add(new Country(17, "USA", "Washington, D.C."));
event.getSource().setData(countries);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
@DataObject("countryComboBox")
public class Country
{
private static int idCounter = 0;
private int id;
private Integer id;
private String name;
private String capital;

public Country()
{
}

public Country(String name, String capital)
public Country(Integer id, String name, String capital)
{
this.id = idCounter++;
this.id = id;
this.name = name;
this.capital = capital;
}
Expand All @@ -41,12 +40,12 @@ public void setCapital(String capital)
this.capital = capital;
}

public int getId()
public Integer getId()
{
return id;
}

public void setId(int id)
public void setId(Integer id)
{
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.cruxframework.crux.core.client.screen.views.BindView;
import org.cruxframework.crux.core.client.screen.views.WidgetAccessor;
import org.cruxframework.crux.smartfaces.client.input.NumberBox;
import org.cruxframework.crux.widgets.client.storyboard.Storyboard;

import com.google.gwt.user.client.ui.RadioButton;

Expand Down Expand Up @@ -53,7 +52,6 @@ else if(myWidgetAccessor.radioButton0999().getValue())
@BindView("numberTextBox")
public static interface MyWidgetAccessor extends WidgetAccessor
{
Storyboard radios();
NumberBox boxNumber();

RadioButton radioButton09();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ public void onDataSelection(DataSelectionEvent<PersonDTO> event)
@Override
public void onComplete(PersonDTO result)
{
View.of(RestController.this).write(result);
if(result == null)
{
MessageBox.show(messages.thisIsASample(), MessageType.INFO);
}
else
{
View.of(RestController.this).write(result);
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ public interface RestMessages extends Messages

@DefaultMessage("Por favor, selecione uma pessoa para continuar.")
String selectPerson();

@DefaultMessage("Este é um exemplo. Não existem dados reais salvos no servidor.")
String thisIsASample();
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.cruxframework.crux.smartfaces.client.swappanel.SwapPanel;
import org.cruxframework.crux.widgets.client.deviceadaptivegrid.DeviceAdaptiveGrid;
import org.cruxframework.crux.widgets.client.formdisplay.FormDisplay;
import org.cruxframework.crux.widgets.client.image.Image;
import org.cruxframework.crux.widgets.client.styledpanel.StyledPanel;

import com.google.gwt.user.client.ui.ListBox;

Expand Down Expand Up @@ -49,7 +49,8 @@ public void swapPanel()
{
switch (status) {
case 0:
myWidgetAccessor.swapPanel().transitTo(new Image(showcaseResourcesCommon.crux()), chooseAnimation());
myWidgetAccessor.messagePanel().setVisible(true);
myWidgetAccessor.swapPanel().transitTo(myWidgetAccessor.messagePanel(), chooseAnimation());
status = 1;
break;
case 1:
Expand Down Expand Up @@ -139,6 +140,7 @@ public void showMessage()
public static interface MyWidgetAccessor extends WidgetAccessor
{
DeviceAdaptiveGrid grid();
StyledPanel messagePanel();
FormDisplay form();
ListBox listAnimation();
SwapPanel swapPanel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void setState1()
myWidgetAccessor.viewContainer().setAnimationBackward(chooseAnimation());
myWidgetAccessor.viewContainer().showView("swapView1");
myWidgetAccessor.backButton().setVisible(false);
myWidgetAccessor.buyButton().setText("Buy Now");
myWidgetAccessor.buyButton().setText("Next");
count = 1;
}

Expand All @@ -69,7 +69,7 @@ private void setState2()
myWidgetAccessor.viewContainer().setAnimationBackward(chooseAnimation());
myWidgetAccessor.viewContainer().showView("swapView2");
myWidgetAccessor.backButton().setVisible(true);
myWidgetAccessor.buyButton().setText("Checkout");
myWidgetAccessor.buyButton().setText("Last");
count = 2;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.cruxframework.crux.core.client.screen.views.WidgetAccessor;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox.MessageType;
import org.cruxframework.crux.widgets.client.rollingtabs.RollingTabPanel;
import org.cruxframework.crux.smartfaces.client.tab.TabPanel;

@Controller("tabPanelController")
public class TabPanelController
Expand All @@ -18,6 +18,12 @@ public class TabPanelController
@Inject
private TabPanelMessages messages;

@Expose
public void onLoad()
{
myWidgetAccessor.tabPanel().selectTab(0);
}

@Expose
public void onClickButton()
{
Expand All @@ -39,7 +45,7 @@ public void onClickTab3()
@BindView("tabPanel")
public interface MyWidgetAccessor extends WidgetAccessor
{
RollingTabPanel rollingTabPanel();
TabPanel tabPanel();
}

public void setMyWidgetAccessor(MyWidgetAccessor myWidgetAccessor)
Expand Down
Loading

0 comments on commit 07cf775

Please sign in to comment.