Git Product home page Git Product logo

commonsdemo's People

Contributors

federicoquarin avatar flang avatar flowingcodeci avatar javier-godoy avatar mlopezfc avatar ngonzalezpazfc avatar paodb avatar

Watchers

 avatar  avatar  avatar

Forkers

jpvelsamy

commonsdemo's Issues

Use local demo sources in development mode

The demo always loads code snippets from the configured github branch in the repository, even in development mode (when demos are being modified in IDE). Hence, demos do not reflect the modified sources.

Document code viewer features

Document the following code-viewer features

  • source cleanup (#37)
  • show-source and conditional code (#44)
  • code block highlighting (#62)
  • use of local demo sources in development mode (#46)
  • short license header
  • github branch selection

image

image

Problem with showing route in the sources view

Basically this is not being shown.

@Route(value = "extended-login/login-layout", layout = TestLoginLayout.class)
// show-source @Route("value = "extended-login/login-layout-demo", layout = ExtendedLoginDemoView.class)

Tabs should be bookmarkable

As a user, when I click a tab, I would expect that the URL changes so that I'm able to navigate using the back and forward buttons in the browser.

Add a help icon to tabs

It would be great to add some kind of support for describing the demos, maybe adding a question mark on each tab of each demo that when clicked it would show a popup explaining each demo

Branch is hardcoded

@GithubLink defaults to master branch. If the demo is based on another branhc, the code snippet is not aligned with the actual sources (which is important, in case the API has breaking changes).

if (sourceCodeUrl.equals(DemoSource.GITHUB_SOURCE)) {
sourceCodeUrl = Optional.ofNullable(this.getClass().getAnnotation(GithubLink.class))
.map(githubLink -> githubLink.value() + "/blob/master/src/test/java/"
+ demo.getClass().getName().replace('.', '/') + ".java")
.orElse(null);

Add support for conditional code

Lines with a // hide-source comment are not rendered in the code snippet (#37).
Lines with a // show-source comment are rendered in the code snippet (#42).

What we need now is a way to display "nice" code depending on the framework version.

For instance:

// #if vaadin ge 22
// show-source foo();
// #elif vaadin eq 23
// show-source bar();
// #else
// show-source baz();
// #endif

would be rendered as foo(); in Vaadin 14-22, bar in Vaadin 23 and baz() in Vaadin 24.

Add support for show-source

Lines with a // hide-source comment are not rendered in the code snippet (#37).

What we need now is a way to display "nice" code as replacement for ugly hacks, which would otherwise make the demo hard to understand.
This feature will be helpful in cases where we use reflection in order to circumvent binary compatibility issues.

For instance, if the demo source is

Method m = Foo.class.getMethod("bar");
m.invoke(foo);

I want to be able to write it as

// show-source foo.bar();
Method m = Foo.class.getMethod("bar"); // hide-source
m.invoke(foo); // hide-source

So that it will be displayed as:

foo.bar();

Allow more than one source to be rendered in SourceCodeViewer

The current implementation of the library allows to display only one source file per demo example. However, there are scenarios where our demo examples may require the inclusion of additional helper classes, such as JavaScript connectors, stylesheets, and other related files. So it would greatly improve the usability and completeness of the library if we could enhance it to support multiple source files within a single demo example.

This kind of enhancement would enable us to:

  1. Include essential auxiliary files that are crucial for understanding and running the example effectively.
  2. Provide a more comprehensive and informative demonstration of the example's functionality.
  3. Enhance the overall user experience by allowing users to access and review all related source files in one place.

[24.2] Cannot invoke "java.lang.Double.doubleValue()" because "this.splitterPosition" is null

Dragging the splitter causes the following error:

Cannot invoke "java.lang.Double.doubleValue()" because "this.splitterPosition" is null
image

java.lang.NullPointerException: Cannot invoke "java.lang.Double.doubleValue()" because "this.splitterPosition" is null
	at com.vaadin.flow.component.splitlayout.SplitLayout.calcNewSplitterPosition(SplitLayout.java:389)
	at com.vaadin.flow.component.splitlayout.SplitLayout.lambda$new$9b1b5227$2(SplitLayout.java:74)
	at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:233)
	at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:475)
	at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:292)
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:447)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:447)
	at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:62)
	at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:74)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:459)
	at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$2(ServerRpcHandler.java:440)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:440)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:323)
	at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:114)
	at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1529)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398)
	at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106)

Mobile access to the demo enhancements

A couple of suggestions:

  • The source code should be disabled by default in mobile devices
  • The source code divider should be horizontal in portrait devices by default

Reintroduce OpenGraph and Twitter Card support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.