Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
public class HelloWorldProjectModel extends AbstractProjectModel {

private String framework = "flow"; // flow or hilla
private String framework = "flow";
private String language = "java"; // java or kotlin
private String buildTool = "maven"; // maven or gradle
private String architecture = "springboot"; // springboot, quarkus, jakartaee, servlet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public class StarterProjectModel extends AbstractProjectModel {

private boolean prerelease = false;
private boolean includeFlow = true;
private boolean includeHilla = false;

@Override
public String getDownloadUrl() {
Expand All @@ -20,13 +19,9 @@ public String getDownloadUrl() {
url.append("&groupId=").append(encode(groupId));

// Add framework selection using the 'frameworks' parameter
if (includeFlow && includeHilla) {
url.append("&frameworks=flow,hilla");
} else if (includeHilla) {
url.append("&frameworks=hilla");
} else if (includeFlow) {
if (includeFlow) {
url.append("&frameworks=flow");
} // else: do not add frameworks parameter if both are false
}

// Add platform version selection (always include, defaults to "latest")
String platformVersion = prerelease ? "pre" : "latest";
Expand Down Expand Up @@ -58,12 +53,4 @@ public boolean isIncludeFlow() {
public void setIncludeFlow(boolean includeFlow) {
this.includeFlow = includeFlow;
}

public boolean isIncludeHilla() {
return includeHilla;
}

public void setIncludeHilla(boolean includeHilla) {
this.includeHilla = includeHilla;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ public class VaadinProjectWizardPage extends WizardPage {
private Button starterProjectRadio;
private Group starterGroup;
private Button flowCheckbox;
private Button hillaCheckbox;
private Combo vaadinVersionCombo;

// Hello World options
private Button helloWorldRadio;
private Group helloWorldGroup;
private Combo frameworkCombo;
private Combo languageCombo;
private Combo buildToolCombo;
private Combo architectureCombo;
Expand Down Expand Up @@ -182,23 +180,22 @@ private void createHelpSections(Composite parent) {
gd.widthHint = 500;
gettingStartedText.setLayoutData(gd);

// Flow and Hilla section
Label flowHillaLabel = new Label(parent, SWT.NONE);
flowHillaLabel.setText("Flow and Hilla");
flowHillaLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
// Flow section
Label flowLabel = new Label(parent, SWT.NONE);
flowLabel.setText("Flow");
flowLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
gd = new GridData();
gd.horizontalSpan = 3;
gd.verticalIndent = 10;
flowHillaLabel.setLayoutData(gd);
flowLabel.setLayoutData(gd);

Label flowHillaText = new Label(parent, SWT.WRAP);
flowHillaText.setText("Flow framework is the most productive choice, allowing 100% of the user interface to be "
+ "coded in server-side Java. Hilla framework, on the other hand, enables implementation of your user "
+ "interface with React while automatically connecting it to your Java backend.");
Label flowText = new Label(parent, SWT.WRAP);
flowText.setText("Flow framework is the most productive choice, allowing 100% of the user interface to be "
+ "coded in server-side Java.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.widthHint = 500;
flowHillaText.setLayoutData(gd);
flowText.setLayoutData(gd);
}

private void createProjectTypeSection(Composite parent) {
Expand Down Expand Up @@ -261,13 +258,6 @@ private void createProjectTypeSection(Composite parent) {
gd.horizontalSpan = 2;
flowCheckbox.setLayoutData(gd);

hillaCheckbox = new Button(starterGroup, SWT.CHECK);
hillaCheckbox.setText("Full-stack React with Vaadin Hilla");
hillaCheckbox.setSelection(false);
gd = new GridData();
gd.horizontalSpan = 2;
hillaCheckbox.setLayoutData(gd);

// Hello World Projects Section
helloWorldGroup = new Group(parent, SWT.NONE);
helloWorldGroup.setText("Hello World Project Options");
Expand All @@ -276,14 +266,6 @@ private void createProjectTypeSection(Composite parent) {
helloWorldGroup.setLayoutData(gd);
helloWorldGroup.setLayout(new GridLayout(2, false));

label = new Label(helloWorldGroup, SWT.NONE);
label.setText("Framework:");

frameworkCombo = new Combo(helloWorldGroup, SWT.READ_ONLY);
frameworkCombo.setItems("Flow / Java", "Hilla / React");
frameworkCombo.select(0);
frameworkCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

label = new Label(helloWorldGroup, SWT.NONE);
label.setText("Language:");

Expand Down Expand Up @@ -345,12 +327,10 @@ public void widgetSelected(SelectionEvent e) {
}
};

frameworkCombo.addSelectionListener(validationListener);
languageCombo.addSelectionListener(validationListener);
buildToolCombo.addSelectionListener(validationListener);
architectureCombo.addSelectionListener(validationListener);
flowCheckbox.addSelectionListener(validationListener);
hillaCheckbox.addSelectionListener(validationListener);

// Initial enablement
updateProjectTypeEnablement();
Expand Down Expand Up @@ -380,8 +360,6 @@ private void updateProjectTypeEnablement() {

private void validateAndUpdateOptions() {
if (helloWorldRadio.getSelection()) {
// Apply validation rules based on IntelliJ plugin's StarterSupport
boolean isHilla = frameworkCombo.getSelectionIndex() == 1;
boolean isKotlin = languageCombo.getSelectionIndex() == 1;
boolean isGradle = buildToolCombo.getSelectionIndex() == 1;
String architecture = architectureCombo.getText();
Expand All @@ -391,11 +369,6 @@ private void validateAndUpdateOptions() {
kotlinNote.setVisible(isKotlin);
}

// Hilla only supports Spring Boot
if (isHilla && !architecture.equals("Spring Boot")) {
architectureCombo.select(0); // Spring Boot
}

// Kotlin only supports Maven + Spring Boot
if (isKotlin) {
if (isGradle) {
Expand All @@ -412,14 +385,12 @@ private void validateAndUpdateOptions() {
}

// Disable invalid combinations
architectureCombo.setEnabled(!isHilla); // Only Spring Boot for Hilla

if (isKotlin) {
buildToolCombo.setEnabled(false); // Only Maven for Kotlin
architectureCombo.setEnabled(false); // Only Spring Boot for Kotlin
} else {
buildToolCombo.setEnabled(true);
architectureCombo.setEnabled(!isHilla);
architectureCombo.setEnabled(true);
}
}
}
Expand Down Expand Up @@ -504,12 +475,11 @@ public AbstractProjectModel getProjectModel() {
starterModel.setLocation(locationText.getText());
starterModel.setPrerelease(vaadinVersionCombo.getSelectionIndex() == 1);
starterModel.setIncludeFlow(flowCheckbox.getSelection());
starterModel.setIncludeHilla(hillaCheckbox.getSelection());
return starterModel;
} else {
helloWorldModel.setProjectName(projectNameText.getText());
helloWorldModel.setLocation(locationText.getText());
helloWorldModel.setFramework(frameworkCombo.getSelectionIndex() == 0 ? "flow" : "hilla");
helloWorldModel.setFramework("flow");
helloWorldModel.setLanguage(languageCombo.getSelectionIndex() == 0 ? "java" : "kotlin");
helloWorldModel.setBuildTool(buildToolCombo.getSelectionIndex() == 0 ? "maven" : "gradle");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testDefaultValues() {
@Test
public void testHelloWorldProjectUrlGeneration() throws MalformedURLException {
model.setProjectName("hello-world");
model.setFramework("hilla");
model.setFramework("flow");
model.setLanguage("kotlin");
model.setBuildTool("gradle");
model.setArchitecture("quarkus");
Expand All @@ -44,7 +44,7 @@ public void testHelloWorldProjectUrlGeneration() throws MalformedURLException {

// Verify URL contains correct parameters
assertTrue("URL should be for helloworld endpoint", urlString.contains("/helloworld?"));
assertTrue("URL should contain framework", urlString.contains("framework=hilla"));
assertTrue("URL should contain framework", urlString.contains("framework=flow"));
assertTrue("URL should contain language", urlString.contains("language=kotlin"));
assertTrue("URL should contain build tool", urlString.contains("buildtool=gradle"));
assertTrue("URL should contain stack", urlString.contains("stack=quarkus"));
Expand All @@ -53,7 +53,7 @@ public void testHelloWorldProjectUrlGeneration() throws MalformedURLException {
@Test
public void testAllHelloWorldParameters() {
model.setProjectName("hello-test");
model.setFramework("hilla");
model.setFramework("flow");
model.setLanguage("kotlin");
model.setBuildTool("gradle");
model.setArchitecture("jakartaee");
Expand Down Expand Up @@ -141,4 +141,4 @@ public void testCustomGroupIdInUrl() {
String encodedGroupId = java.net.URLEncoder.encode(customGroupId, java.nio.charset.StandardCharsets.UTF_8);
assertTrue("URL should contain the custom groupId", url.contains("groupId=" + encodedGroupId));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void setUp() {
public void testDefaultValues() {
assertNotNull("Model should be created", model);
assertTrue("Should include Flow by default", model.isIncludeFlow());
assertFalse("Should not include Hilla by default", model.isIncludeHilla());
assertFalse("Should not be prerelease by default", model.isPrerelease());
}

Expand Down Expand Up @@ -63,29 +62,15 @@ public void testPrereleaseSetting() {
public void testFrameworkSelection() {
model.setProjectName("framework-test");

// Test Empty selection (neither Flow nor Hilla)
model.setIncludeFlow(false);
model.setIncludeHilla(false);
String url = model.getDownloadUrl();
assertFalse("Shouldn't contain frameworks parameter", url.matches(".*frameworks=.*"));

// Test Flow only
model.setIncludeFlow(true);
model.setIncludeHilla(false);
url = model.getDownloadUrl();
String url = model.getDownloadUrl();
assertTrue("Should have frameworks=flow", url.contains("frameworks=flow"));

// Test Hilla only
// Test no frameworks selected
model.setIncludeFlow(false);
model.setIncludeHilla(true);
url = model.getDownloadUrl();
assertTrue("Should have frameworks=hilla", url.contains("frameworks=hilla"));

// Test both (Flow and Hilla)
model.setIncludeFlow(true);
model.setIncludeHilla(true);
url = model.getDownloadUrl();
assertTrue("Should have frameworks=flow,hilla", url.contains("frameworks=flow,hilla"));
assertFalse("Shouldn't contain frameworks parameter", url.matches(".*frameworks=.*"));
}

@Test
Expand Down Expand Up @@ -113,7 +98,6 @@ public void testAllStarterParameters() {
model.setProjectName("full-test");
model.setPrerelease(true);
model.setIncludeFlow(true);
model.setIncludeHilla(true);

String url = model.getDownloadUrl();

Expand Down Expand Up @@ -145,4 +129,4 @@ public void testCustomGroupIdInUrl() {
String encodedGroupId = java.net.URLEncoder.encode(customGroupId, java.nio.charset.StandardCharsets.UTF_8);
assertTrue("URL should contain the custom groupId", url.contains("groupId=" + encodedGroupId));
}
}
}
Loading