Commit 9c95790c authored by iSergio's avatar iSergio
Browse files

Now support new examples in new release CesiumJS (they placed on top of list)

parent 35b69d53
Loading
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -19,17 +19,6 @@
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/version.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/version.txt</exclude>
                </excludes>
            </resource>
        </resources>

+15 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.*;
import org.cesiumjs.cs.Cesium;
import org.cleanlogic.cesiumjs4gwt.showcase.i18n.I18NMessages;

/**
@@ -64,9 +65,21 @@ public class ExamplePanel extends Composite {
        sp.setWidget(vp);

        final Label lblName = new Label(example.getName());

        HorizontalPanel hp = new HorizontalPanel();
        hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
        hp.setSpacing(2);
        if (example.getExample().isNew()) {
            Image img = new Image(Resources.INSTANCE.icon_new());
            img.setSize("24px", "24px");
            hp.add(img);
        }
        hp.add(lblName);

        final Image lblImage = new Image(GWT.getModuleBaseURL() + "examples/" + example.getName() + ".jpg");
        lblImage.setSize("225px", "150px");
        final Label lblDescription = new Label(example.getDescription());
        final StringBuffer sb = new StringBuffer();
        final StringBuilder sb = new StringBuilder();
        final String[] tags = example.getTags();
        for (String tag : tags) {
            sb.append(tag).append(", ");
@@ -75,7 +88,7 @@ public class ExamplePanel extends Composite {
        lblTags.setStyleName("exampletags");

        lblName.setStyleName("examplename");
        vp.add(lblName);
        vp.add(hp);
        vp.add(lblImage);
        vp.add(lblDescription);
        vp.add(lblTags);
+3 −0
Original line number Diff line number Diff line
@@ -46,4 +46,7 @@ public interface Resources extends ClientBundle {
     */
    @Source("resources/icon-info.png")
    ImageResource icon_info();

    @Source("resources/icon-new.png")
    ImageResource icon_new();
}
+22 −3
Original line number Diff line number Diff line
@@ -20,9 +20,12 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import org.cesiumjs.cs.Cesium;
import org.cleanlogic.cesiumjs4gwt.showcase.ExampleBean;
import org.cleanlogic.cesiumjs4gwt.showcase.Resources;
import org.cleanlogic.cesiumjs4gwt.showcase.components.store.ExampleStore;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
@@ -38,16 +41,23 @@ public abstract class AbstractExample extends Composite {
    protected VerticalPanel contentPanel = new VerticalPanel();
    protected HorizontalPanel horizontalPanel = new HorizontalPanel();
    protected ExampleBean example;
    protected final String version;

    public AbstractExample(String name, String description, String[] tags, ExampleStore store) {
        this(name, description, tags);
        this(name, description, tags, "");
        store.addExample(example);
    }

    public AbstractExample(String name, String description, String[] tags, ExampleStore store, String version) {
        this(name, description, tags, version);
        store.addExample(example);
    }

    /**
     * The constructor.
     */
    public AbstractExample(String name, String description, String[] tags) {
    public AbstractExample(String name, String description, String[] tags, String version) {
        this.version = version;
        for (String sourceCodeUrl : getSourceCodeURLs()) {
            ShowSourceButton butShowSource = new ShowSourceButton("");
            butShowSource.setSourceCodeURL(sourceCodeUrl);
@@ -73,13 +83,22 @@ public abstract class AbstractExample extends Composite {
        for (ShowSourceButton butShowSource : showSourceButtons) {
            horizontalPanel.add(butShowSource);
        }

        contentPanel.setSpacing(5);
        contentPanel.getElement().getStyle().setPadding(10, Unit.PX);
        contentPanel.setWidth("100%");
        contentPanel.add(new HTML("<H1>" + title + "</H1>"));
        contentPanel.add(new HTML("<H1>" + title + (isNew() ? " New" : "") + "</H1>"));
        contentPanel.add(horizontalPanel);
    }

    public boolean isNew() {
        return Cesium.version().equals(this.version);
    }

    public String getVersion() {
        return this.version;
    }

    /**
     * @return the example
     */
+4 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ import org.cleanlogic.cesiumjs4gwt.showcase.components.store.ShowcaseExampleStor
import org.cleanlogic.cesiumjs4gwt.showcase.puregwt.ShowcaseEventBus;
import org.cleanlogic.cesiumjs4gwt.showcase.puregwt.event.ExampleNumberEvent;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 *
 * @author Giuseppe La Scaleia - CNR IMAA geoSDI Group
Loading