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 18, 2015
1 parent 773e2a5 commit 5e632d5
Show file tree
Hide file tree
Showing 25 changed files with 69 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=Name
name=Name
lastName=Last Name
basicinfo=Basic Informations
age=Age
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
editMe=Edit Me
editMe=Edit Me
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addPerson=Add Person
addPerson=Add Person
updateList=Update List
editPerson=Edit Person
id=Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ public class ProgressBoxController
@Expose
public void showProgress()
{
progress = ProgressBox.show("");
progress = ProgressBox.show("");
progress.setMax(DURATION);
progress.setValue(DURATION);
updateTitle();

timer = new Timer()
{
@Override
public void run()
{
timeLeftToHide--;

progress.setValue(timeLeftToHide);
if(timeLeftToHide == 0)
{
hideProgress();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
connectionError=Connection error {0}
connectionError=Connection error {0}
id=Id
name=Name
lastName=Last Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
text=This is a panel
text=This is a panel
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
title=Simple View Container
title=Simple View Container
nextView=Next View
previousView=Previous View
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title=Sample View 1
title=Sample View 1
labelTextView=This is a simple view loaded by a Simple View Container
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title=Sample View 2
title=Sample View 2
labelTextView=This is a simple view loaded by a Simple View Container
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title=Sample View 3
title=Sample View 3
labelTextView=This is a simple view loaded by a Simple View Container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title=Tab Panel
title=Tab Panel
clickTab1=This tab contains only a button component.
clickTab2=Note that the page 2 is a image, but it could be any other HTML element
clickTab3=Note that this event was triggered by clicking in page 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
title=New View
title=New View
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title=View 1
title=View 1
labelText=Simple View loaded by a Tab View Container (Declarative)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title=View 2
title=View 2
labelText=This is a Simple View loaded by a Tab View Container (via Ccntroller)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


buttonDescription = <p>Buttons are elements that trigger actions when clicked on. These components were conceived also thinking of touch devices, handling events differently on a smartphone or tablet, for example.</p>

colorPickerDialogDescription = <p>The ColorPicker is a component that allows the user to select a color from a color spectrum and apply it to a given element. The functionality is similar to color pickers found in desktop software.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
shortWelcome = Welcome
shortWelcome = Welcome

site = Site

Expand All @@ -12,9 +12,9 @@ info2 = Every example shows the component itself, running in your screen that ca

info3 = This site is under construction, every day new examples are developed and added to the showcase. Right now we have a bunch of new components already developed but they might not be present here.

facesText = Componentes que exploram os novos padroes HTML5 e CSS3, disponiveis nos browsers mais modernos.
facesText = Components that uses HTML5 and CSS3. Available to modern browsers.

widgetText = Componentes que possuem implementaçoes compativeis com browsers antigos.
widgetText = Components that are compatible with old browsers.

library = Library:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@Path("/person")
public class PersonRestService
{
private static final int MAX_VALUE_ID = 1000;
private static ArrayList<PersonDTO> people = new ArrayList<PersonDTO>();
private static Random random = new Random();

Expand All @@ -24,12 +25,17 @@ public class PersonRestService
mockMapFill();
}

private static int getRandomId()
{
return Math.abs(random.nextInt(MAX_VALUE_ID));
}

private static void mockMapFill()
{
people = new ArrayList<PersonDTO>();
people.add(new PersonDTO(random.nextInt(), "John", "Nash"));
people.add(new PersonDTO(random.nextInt(), "Paul", "McCartney"));
people.add(new PersonDTO(random.nextInt(), "Ravi", "Shankar"));
people.add(new PersonDTO(getRandomId(), "John", "Nash"));
people.add(new PersonDTO(getRandomId(), "Paul", "McCartney"));
people.add(new PersonDTO(getRandomId(), "Ravi", "Shankar"));
}

@DELETE
Expand All @@ -44,7 +50,7 @@ public void remove(@PathParam("id") Integer id)
public Integer save(PersonDTO person)
{
//code your save person method
return random.nextInt();
return getRandomId();
}

@PUT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@external *;

.baseWrapper.sideMenuDisposal .simulate-screen
{
height: 670px;
}

.disposal-views-title
{
font-size:20px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
@external *;

.explanationMobile{
.baseWrapper.topMenuDisposal .simulate-screen
{
height: 709px;
}

.explanationMobile
{
display:none;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@

<widgets:menuSection label="${messages_showcase.menusAndLists}" />
<widgets:menuEntry label="Menu" targetView="menu"/>
<widgets:menuEntry label="SideMenuDisposal" targetView="sideMenuDisposal"/>
<widgets:menuEntry label="TopMenuDisposal" targetView="topMenuDisposal"/>
<widgets:menuEntry label="Filter" targetView="filter"/>
<widgets:menuEntry label="ListShuttle" targetView="listShuttle"/>
<widgets:menuEntry label="SortableList" targetView="sortableList"/>
Expand All @@ -85,8 +83,9 @@
<widgets:menuEntry label="Pagers" targetView="pagers"/>

<widgets:menuSection label="${messages_showcase.layoutsAndPanels}"/>
<widgets:menuEntry label="SideMenuDisposal" targetView="sideMenuDisposal"/>
<widgets:menuEntry label="TopMenuDisposal" targetView="topMenuDisposal"/>
<widgets:menuEntry label="FormDisplay" targetView="formDisplay" />
<widgets:menuEntry label="RollingPanel" targetView="rollingPanel"/>
<widgets:menuEntry label="StoryBoard" targetView="storyBoard"/>
<widgets:menuEntry label="StyledPanel" targetView="styledPanel"/>

Expand All @@ -98,6 +97,7 @@

<widgets:menuSection label="${messages_showcase.imagesAndOthers}"/>
<widgets:menuEntry label="Image" targetView="image"/>
<widgets:menuEntry label="RollingPanel" targetView="rollingPanel"/>
<widgets:menuEntry label="PromoBanner" targetView="promoBanner"/>
<widgets:menuEntry label="SlideShow" targetView="slideshow"/>
<widgets:menuEntry label="ScrollBanner" targetView="scrollBanner"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@
</widgets:anchor>

<div id="wrapper1" class="anchorWrapper">
<faces:label id="labelDeclarative" text="Link implemented declaratively."/>
<faces:label id="labelDeclarative" text="Link"/>
<br />
<widgets:anchor id="anchor" href="http://www.cruxframework.org" target="_self">
<button>Crux Framework</button>
</widgets:anchor>
</div>

<div id="wrapper2" class="anchorWrapper">
<faces:label id="labelProgramatic" text="Link implemented by a controller."/>
<br />
<gwt:textBox id="textBoxUrl" text="http://www.cruxframework.org" readOnly="true"/>
<faces:button id="buttonLink" text="Open page" onSelect="anchorController.openUrl"/>
</div>

<a id="end" style="color:#1c5994"></a>

<widgets:anchor id="anchorEnd" href="#home">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</gwt:listBox>
</gwt:flowPanel>

<gwt:flowPanel id="sideMenuDisposalPanel" visible="true" styleName="faces-SideMenuDisposal simulate-screen">
<gwt:flowPanel id="sideMenuDisposalPanel" visible="true" styleName="simulate-screen">
<faces:sideMenuDisposal id="sideMenuDisposal">
<faces:view name="animals" id="animals-side"/>
<faces:largeHeader>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
databaseNotSupportedError=Database not supported by your browser
databaseNotSupportedError=Database not supported by your browser
viewSourceCode=Source
loading=Loading
enableLog=Enable Log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.cruxframework.showcasecore.client.util;

import org.cruxframework.crux.core.client.Crux;
import org.cruxframework.crux.core.client.rest.Callback;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox.MessageType;
import org.cruxframework.crux.smartfaces.client.dialog.WaitBox;
import org.cruxframework.crux.smartfaces.client.dialog.animation.DialogAnimation;
import org.cruxframework.showcasecore.client.resource.ShowcaseCoreMessages;
Expand Down Expand Up @@ -113,7 +114,7 @@ public void onError(Exception e)
{
try
{
Crux.getErrorHandler().handleError(e.getLocalizedMessage(), e);
MessageBox.show(e.getMessage(), MessageType.ERROR);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import java.io.IOException;
import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cruxframework.crux.core.server.rest.annotation.RestService;
import org.cruxframework.crux.core.shared.rest.RestException;
import org.cruxframework.crux.core.shared.rest.annotation.GET;
import org.cruxframework.crux.core.shared.rest.annotation.Path;
import org.cruxframework.crux.core.shared.rest.annotation.PathParam;
Expand All @@ -14,33 +17,40 @@
@Path("source")
public class SourceCodeRestService
{
private static final Log LOG = LogFactory.getLog(SourceCodeRestService.class);

@GET
@Path("sourceFile/{path}")
public String getSourceFile(@PathParam("path") String path)
public String getSourceFile(@PathParam("path") String path) throws RestException
{
try
{
return GitExplorer.getSourceFile(path);
}
catch (IOException | JSONException e)
{
e.printStackTrace();
LOG.error(e);
throw new RestException(e);
}
return null;
}

@GET
@Path("listSourceFiles/{viewName}")
public ArrayList<String> listSourceFilesForView(@PathParam("viewName") String viewName)
public ArrayList<String> listSourceFilesForView(@PathParam("viewName") String viewName) throws RestException
{
try
{
return GitExplorer.getListSourceFilesForView(viewName.toLowerCase().trim());
ArrayList<String> listSourceFilesForView = GitExplorer.getListSourceFilesForView(viewName.toLowerCase().trim());
if(listSourceFilesForView == null || listSourceFilesForView.isEmpty())
{
throw new RestException("GitHub souce code server offline. Try again later.");
}
return listSourceFilesForView;
}
catch (IOException | JSONException e)
{
e.printStackTrace();
LOG.error(e);
throw new RestException(e);
}
return null;
}
}

0 comments on commit 5e632d5

Please sign in to comment.