Skip to content

Commit

Permalink
feat: added and edited several getting started and installation pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mhawkinsbasis committed Aug 22, 2023
1 parent bac1cc7 commit 13b4dce
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 15 deletions.
5 changes: 5 additions & 0 deletions docs/getting_started/Templates/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 3,

}

5 changes: 5 additions & 0 deletions docs/getting_started/Templates/app_layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 2
title: App Layout
sidebar_class_name: sidebar--item__hidden
---
46 changes: 46 additions & 0 deletions docs/getting_started/Templates/hello_world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
sidebar_position: 1
title: Hello World
---

To start a simple application, it is recommended to use the DWCJ's [HelloWorldJava repository](https://github.com/DwcJava/HelloWorldJava) as a template. This can be done using any of the [installation methods](../../installation/installation.md).

Once you have cloned the repository and can see the application, modifying the following sections will allow you to start building your own simple application:

### The `run()` method
```java {1}
public void run() throws DwcjException {

Frame frame = new Frame();
frame.addClassName("frame");

Label label = new Label("Hello World!");

Button btn = new Button("Say Hello");
btn.setTheme(ButtonTheme.SUCCESS)
.setExpanse(Expanse.XLARGE)
.onClick(e -> msgbox("Hello World!"));

frame.add(label, btn);
}
```

This is the method that will be executed when your application is rendered. Here, since the sample program is quite small, the entirety of the program's functionality has been built into this singular method.

Feel free to follow this pattern for exploration purposes or simple applications. For more complex applications, it is advised to split functionality into additional methods and classes.

### CSS

```java
@InlineStyleSheet(/* css */"""
.frame {
display: inline-grid;
gap: 20px;
margin: 20px;
padding: 20px;
border: 1px dotted;
}
""")
```

This is the inline CSS that will be applied to your application. Feel free to continue adding to this section, or create a separate stylesheet using [this page](../../styling/getting_started.md) as a reference.
51 changes: 43 additions & 8 deletions docs/getting_started/configuration.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
---
sidebar_position: 1
sidebar_position: 2
displayed_sidebar: documentationSidebar
---

# Configuration

Options exist to configure the DWCJ in order to load a default class or enable debug mode.

### Default Class

It is possible to configure the DWCJ to automatically load an application from the list of available applications that extend the `App` class.
## Using the Install Plugin

:::success Tip!
For most users, especially those who have followed one of the installation guides on this site, this will be the best option.
:::

In a project using the install plugin, there are various tags that can be changed which will help configure your application's URL. The following lines in the default POM file that comes with the `HelloWorldJava` starting repository can be configured:

```xml {14,17,18}
<plugin>
<groupId>org.dwcj</groupId>
<artifactId>dwcj-install-maven-plugin</artifactId>
<version>0.1.0</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<deployurl>http://localhost:8888/dwcj-install</deployurl>
<classname>samples.HelloWorldJava</classname>
<username>admin</username>
<password>admin123</password>
<publishname>hworld</publishname>
<debug>true</debug>
</configuration>
</plugin>
```

1. The `<classname>` tag should contain the name of package and classname of the application you wish to run. This is helpful for projects which may contain multiple classes which extend the App class, and allows you to choose which program should run when the URL is navigated to.

2. The `<publishname>` tag specifies what name the program will take in the final URL. Generally, to run your program, you'll enter a URL similar to `http://localhost:8888/webapp/<publishname>`, where the value within the `<publishname>` tag is entered. When this is done, the class extending application specified in the `<classname>` tag is run.

3. The `<debug>` tag can be set to true or false, and will determine whether or not error messages thrown by your program will be displayed in the browser's console or not.

It is also possible to start a different class which extends App within your project by modifying the URL in the following format - replace <b>your.class.name.here</b> with the full classname:

#### Changing the URL
`http://localhost:8888/webapp/yourAppName?class=your.class.name.here`

The first option to do this is to modify the URL in the browser to include the classname of the application you want to run and replace <b>your.class.name.here</b> with the full classname as it appears on the list of classes:
## Without the Install Plugin

`http://localhost:8888/webapp/yourAppName?class=your.class.name.here`
### Default Class

In the above URL,
It is possible to configure the DWCJ to automatically load an application from the list of available applications that extend the `App` class.

#### Editing the BBj config file
The second option is to open your config.bbx file, and set the classname within the file itself. This file is found in the cfg directory of your BBj installation, `C:\bbx\cfg\config.bbx` for example. To do so, add the following line and replace <b>your.class.name.here</b> with the full classname as it appears on the list of classes:
Expand Down
6 changes: 3 additions & 3 deletions docs/getting_started/creating_an_application.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 2
sidebar_position: 1
displayed_sidebar: documentationSidebar
---

Expand Down Expand Up @@ -67,7 +67,7 @@ import org.dwcj.controls.button.Button;
public class ExampleClass extends App{

@Override
public void run() throws DwcException {
public void run() throws DwcjException {
Frame page = new Frame();
Button myButton = new Button();
page.add(myButton);
Expand All @@ -76,7 +76,7 @@ public class ExampleClass extends App{
```
Once this has been done, compile or package your program using Maven, and then navigate to
the appropriate URL. If done correctly, you should see the entry in your list of available
applications.
applications. To configure a specific class to load, see [this page](../getting_started/configuration.md).

:::info

Expand Down
2 changes: 1 addition & 1 deletion docs/installation/github_codespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To compile a program, open the terminal in VS Code and run the `mvn install` com

![Maven Install](./_images/github/2.png)

If everything completes successfully, you should se the `BUILD SUCCESS` message.
If everything completes successfully, you should see the `BUILD SUCCESS` message.

:::danger WARNING
Make sure to use the `mvn install` command instead of VS Code's built-in Maven interface for installing your program.
Expand Down
7 changes: 4 additions & 3 deletions docs/installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ sidebar_position: 1
<h3 style={{"justify-self" : "end"}}> Current BBj Version Required: 23.00 or newer </h3>
</div>

- For those who want to develop applications or web tools using the DWCJ,
follow the [Users installation page](/docs/installation/local_install).
The DWCJ is best run with one of three methods, each of which will allow the developer to create DWCJ applications quickly and easily. The following three sections outline the processes for each method:

- Developers who want to also make changes to the DWCJ itself can go to the DWCJ's engine repository and clone it to begin making changes to the API.
- [Local Installation](./local_install.md)
- [Developing with Docker](./docker_user.md)
- [Using Github Codespaces ](./github_codespaces.md)

0 comments on commit 13b4dce

Please sign in to comment.