mirror of https://github.com/zlatinb/muwire
options dialog, wip
parent
b6f7f51476
commit
3642736cfe
|
@ -21,4 +21,9 @@ mvcGroups {
|
|||
view = 'com.muwire.gui.SearchTabView'
|
||||
controller = 'com.muwire.gui.SearchTabController'
|
||||
}
|
||||
}
|
||||
'Options' {
|
||||
model = 'com.muwire.gui.OptionsModel'
|
||||
view = 'com.muwire.gui.OptionsView'
|
||||
controller = 'com.muwire.gui.OptionsController'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import griffon.core.artifact.GriffonController
|
||||
import griffon.core.controller.ControllerAction
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
import javax.annotation.Nonnull
|
||||
|
||||
@ArtifactProviderFor(GriffonController)
|
||||
class OptionsController {
|
||||
@MVCMember @Nonnull
|
||||
OptionsModel model
|
||||
|
||||
@ControllerAction
|
||||
void click() {
|
||||
model.clickCount++
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import griffon.core.artifact.GriffonModel
|
||||
import griffon.transform.Observable
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
@ArtifactProviderFor(GriffonModel)
|
||||
class OptionsModel {
|
||||
@Observable int clickCount = 0
|
||||
}
|
|
@ -44,6 +44,11 @@ class MainFrameView {
|
|||
imageIcon('/griffon-icon-16x16.png').image],
|
||||
pack : false,
|
||||
visible : bind { model.coreInitialized }) {
|
||||
menuBar {
|
||||
menu (text : "Options") {
|
||||
menuItem("Configuration", actionPerformed : {mvcGroup.createMVCGroup("Options")})
|
||||
}
|
||||
}
|
||||
borderLayout()
|
||||
panel (border: etchedBorder(), constraints : BorderLayout.NORTH) {
|
||||
borderLayout()
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import griffon.core.artifact.GriffonView
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
import javax.swing.JDialog
|
||||
import javax.swing.SwingConstants
|
||||
import javax.annotation.Nonnull
|
||||
|
||||
@ArtifactProviderFor(GriffonView)
|
||||
class OptionsView {
|
||||
@MVCMember @Nonnull
|
||||
FactoryBuilderSupport builder
|
||||
@MVCMember @Nonnull
|
||||
OptionsModel model
|
||||
|
||||
def d
|
||||
def p
|
||||
|
||||
void initUI() {
|
||||
def mainFrame = application.windowManager.findWindow("main-frame")
|
||||
d = new JDialog(mainFrame, "Options", true)
|
||||
p = builder.panel {
|
||||
label(text : "Text")
|
||||
}
|
||||
}
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
d.getContentPane().add(p)
|
||||
d.pack()
|
||||
d.show()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import griffon.core.test.GriffonFestRule
|
||||
import org.fest.swing.fixture.FrameFixture
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
import static org.junit.Assert.fail
|
||||
|
||||
class OptionsIntegrationTest {
|
||||
static {
|
||||
System.setProperty('griffon.swing.edt.violations.check', 'true')
|
||||
System.setProperty('griffon.swing.edt.hang.monitor', 'true')
|
||||
}
|
||||
|
||||
@Rule
|
||||
public final GriffonFestRule fest = new GriffonFestRule()
|
||||
|
||||
private FrameFixture window
|
||||
|
||||
@Test
|
||||
void smokeTest() {
|
||||
fail('Not implemented yet!')
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import griffon.core.test.GriffonUnitRule
|
||||
import griffon.core.test.TestFor
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
import static org.junit.Assert.fail
|
||||
|
||||
@TestFor(OptionsController)
|
||||
class OptionsControllerTest {
|
||||
private OptionsController controller
|
||||
|
||||
@Rule
|
||||
public final GriffonUnitRule griffon = new GriffonUnitRule()
|
||||
|
||||
@Test
|
||||
void smokeTest() {
|
||||
fail('Not yet implemented!')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue