Skip to content

Commit

Permalink
Commit works.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheroliv committed Nov 13, 2024
1 parent 8ea5cc9 commit d8f1382
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
31 changes: 18 additions & 13 deletions api/src/main/kotlin/school/base/installer/Setup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import java.nio.file.Path
import java.nio.file.Paths
import javax.swing.*
import javax.swing.BorderFactory.createTitledBorder
import javax.swing.GroupLayout.Alignment.BASELINE
import javax.swing.GroupLayout.Alignment.LEADING
import javax.swing.GroupLayout.Alignment.*
import javax.swing.GroupLayout.DEFAULT_SIZE
import javax.swing.GroupLayout.PREFERRED_SIZE
import javax.swing.JFileChooser.APPROVE_OPTION
import javax.swing.JFileChooser.DIRECTORIES_ONLY
import javax.swing.JOptionPane.ERROR_MESSAGE
import javax.swing.JOptionPane.showMessageDialog
import javax.swing.LayoutStyle.ComponentPlacement.RELATED
Expand Down Expand Up @@ -133,9 +134,9 @@ class Setup(
pathKey: String,
textField: JTextField
) = JFileChooser().run {
fileSelectionMode = JFileChooser.DIRECTORIES_ONLY
fileSelectionMode = DIRECTORIES_ONLY
dialogTitle = "Select Directory"
when (JFileChooser.APPROVE_OPTION) {
when (APPROVE_OPTION) {
showOpenDialog(this) -> selectedFile.toPath().run {
selectedPaths[pathKey] = this
textField.text = toString()
Expand Down Expand Up @@ -179,6 +180,9 @@ class Setup(
browseOfficePathButton.addActionListener { selectDirectory("office", officePathTextField) }
browseWorkspacePathButton.addActionListener { selectDirectory("workspace", workspacePathTextField) }
browsejobPathButton.addActionListener { selectDirectory("job", jobPathTextField) }
/*
action sur bouton create workspace
*/
createWorkspaceButton.addActionListener { handleCreateWorkspace() }
installationTypeGroup.selection.addActionListener {
}
Expand Down Expand Up @@ -225,7 +229,7 @@ class Setup(
.addGroup(
createParallelGroup(LEADING)
.addGroup(
GroupLayout.Alignment.TRAILING, createSequentialGroup()
TRAILING, createSequentialGroup()
.addContainerGap()
.addComponent(
workspaceTypeSelectorPanel,
Expand Down Expand Up @@ -271,7 +275,7 @@ class Setup(
.addGroup(
createParallelGroup(LEADING)
.addGroup(
GroupLayout.Alignment.TRAILING, createSequentialGroup()
TRAILING, createSequentialGroup()
.addContainerGap(69, MAX_VALUE.toInt())
.addComponent(
workspaceEntriesPanel,
Expand Down Expand Up @@ -393,7 +397,8 @@ class Setup(
createParallelGroup(BASELINE)
.addComponent(
titleLabel,
PREFERRED_SIZE, 43,
PREFERRED_SIZE,
43,
PREFERRED_SIZE
)
.addComponent(createWorkspaceButton)
Expand Down Expand Up @@ -466,28 +471,28 @@ class Setup(
)
.addComponent(
educationPathLabel,
GroupLayout.Alignment.TRAILING,
TRAILING,
DEFAULT_SIZE,
DEFAULT_SIZE,
MAX_VALUE.toInt()
)
.addComponent(
communicationPathLabel,
GroupLayout.Alignment.TRAILING,
TRAILING,
DEFAULT_SIZE,
DEFAULT_SIZE,
MAX_VALUE.toInt()
)
.addComponent(
configurationPathLabel,
GroupLayout.Alignment.TRAILING,
TRAILING,
DEFAULT_SIZE,
DEFAULT_SIZE,
MAX_VALUE.toInt()
)
.addComponent(
jobPathLabel,
GroupLayout.Alignment.TRAILING,
TRAILING,
PREFERRED_SIZE,
190,
PREFERRED_SIZE
Expand All @@ -498,7 +503,7 @@ class Setup(
createParallelGroup(LEADING)
.addComponent(
officePathTextField,
GroupLayout.Alignment.TRAILING,
TRAILING,
DEFAULT_SIZE,
475,
MAX_VALUE.toInt()
Expand All @@ -512,7 +517,7 @@ class Setup(
.addGroup(
createParallelGroup(LEADING)
.addComponent(browseEducationPathButton)
.addComponent(browseOfficePathButton, GroupLayout.Alignment.TRAILING)
.addComponent(browseOfficePathButton, TRAILING)
.addComponent(browseCommunicationPathButton)
.addComponent(browseConfigurationPathButton)
.addComponent(browsejobPathButton)
Expand Down
6 changes: 4 additions & 2 deletions api/src/main/kotlin/school/base/installer/WorkspaceService.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package school.base.installer

import school.base.installer.WorkspaceService.InstallationType.ALL_IN_ONE
import school.base.installer.WorkspaceService.InstallationType.SEPARATED_FOLDERS
import java.io.File
import java.nio.file.Path

// Service class for workspace operations
class WorkspaceService {
fun createWorkspace(config: WorkspaceConfig) {
when (config.type) {
InstallationType.ALL_IN_ONE -> createAllInOneWorkspace(config.basePath)
InstallationType.SEPARATED_FOLDERS -> createSeparatedFoldersWorkspace(config.basePath, config.subPaths)
ALL_IN_ONE -> createAllInOneWorkspace(config.basePath)
SEPARATED_FOLDERS -> createSeparatedFoldersWorkspace(config.basePath, config.subPaths)
}
}

Expand Down

0 comments on commit d8f1382

Please sign in to comment.