Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jessica Hawkwell
/
lang-toolkit
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 54367d6b
authored
Jul 15, 2017
by
Jessica Hawkwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor simplification, adding services support
1 parent
a08f4705
Pipeline
#195
passed
in 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
52 deletions
apps/langbuilder/src/main/java/me/felinewith/lang_toolkit/apps/langbuilder/LangBuilder.java
library/liblangbuilder/src/main/java/me/felinewith/lang_toolkit/library/ILangPlugin.java
library/libservices/src/main/java/me/felinewith/lang_toolkit/library/ILangService.java
apps/langbuilder/src/main/java/me/felinewith/lang_toolkit/apps/langbuilder/LangBuilder.java
View file @
54367d6
...
...
@@ -219,61 +219,65 @@ public final class LangBuilder implements IStrappedApp {
plugins
.
put
(
plugin
.
getName
(),
plugin
);
boolean
needShowWindow
=
true
;
if
(
plugin
.
hasButton
()
)
{
JButton
button
=
plugin
.
getButton
();
button
.
addActionListener
(
new
UnifiedListener
()
{
@Override
public
void
handleEvent
(
ActionHandle
action
)
{
int
a
=
0
;
String
t
=
"plugin."
.
concat
(
plugin
.
getName
());
Component
c
;
JPanel
jp
;
for
(
a
=
0
;
a
<
desktop
.
getTabCount
();
a
++
)
{
log
.
debug
(
"Tab Index: "
.
concat
(
String
.
valueOf
(
a
)));
c
=
desktop
.
getComponentAt
(
a
);
if
(
c
==
null
)
{
log
.
error
(
"Component at "
.
concat
(
String
.
valueOf
(
a
)).
concat
(
" does not exist!"
));
}
else
if
(
c
instanceof
JPanel
)
{
jp
=
(
JPanel
)
c
;
log
.
debug
(
jp
.
getName
());
if
(
t
.
equals
(
jp
.
getName
())
)
{
desktop
.
setSelectedIndex
(
a
);
return
;
}
@Override
public
void
start
()
{
plugins
.
forEach
((
name
,
plugin
)
->
{
final
String
t
=
"plugin."
.
concat
(
name
);
boolean
needShowWindow
=
true
;
if
(
plugin
.
hasButton
()
)
{
JButton
button
=
plugin
.
getButton
();
button
.
addActionListener
(
new
UnifiedListener
()
{
@Override
public
void
handleEvent
(
ActionHandle
action
)
{
int
a
=
0
;
String
t
=
"plugin."
.
concat
(
plugin
.
getName
());
Component
c
;
JPanel
jp
;
for
(
a
=
0
;
a
<
desktop
.
getTabCount
();
a
++
)
{
log
.
debug
(
"Tab Index: "
.
concat
(
String
.
valueOf
(
a
)));
c
=
desktop
.
getComponentAt
(
a
);
if
(
c
==
null
)
{
log
.
error
(
"Component at "
.
concat
(
String
.
valueOf
(
a
)).
concat
(
" does not exist!"
));
}
else
if
(
c
instanceof
JPanel
)
{
jp
=
(
JPanel
)
c
;
log
.
debug
(
jp
.
getName
());
if
(
t
.
equals
(
jp
.
getName
())
)
{
desktop
.
setSelectedIndex
(
a
);
return
;
}
}
}
}
if
(
plugin
.
hasWindow
()
)
{
jp
=
plugin
.
getPanel
();
jp
.
setName
(
t
);
desktop
.
addTab
(
plugin
.
getDisplayName
(),
jp
);
if
(
plugin
.
hasWindow
()
)
{
jp
=
plugin
.
getPanel
();
jp
.
setName
(
t
);
desktop
.
addTab
(
plugin
.
getDisplayName
(),
jp
);
}
}
}
});
});
desktopMenu
.
addButton
(
button
);
needShowWindow
=
false
;
}
if
(
plugin
.
hasToolBar
()
)
{
JToolBar
jt
=
plugin
.
getToolBar
();
jt
.
setName
(
t
);
jTabbedPane
.
addTab
(
plugin
.
getDisplayName
(),
jt
);
needShowWindow
=
false
;
}
if
(
needShowWindow
&&
plugin
.
hasWindow
()
)
{
JPanel
jp
=
plugin
.
getPanel
();
jp
.
setName
(
t
);
desktop
.
addTab
(
plugin
.
getDisplayName
(),
jp
);
}
});
desktopMenu
.
addButton
(
button
);
needShowWindow
=
false
;
}
if
(
plugin
.
hasToolBar
()
)
{
JToolBar
jt
=
plugin
.
getToolBar
();
jt
.
setName
(
"plugin."
.
concat
(
plugin
.
getName
()));
jTabbedPane
.
addTab
(
plugin
.
getDisplayName
(),
jt
);
needShowWindow
=
false
;
}
if
(
needShowWindow
&&
plugin
.
hasWindow
()
)
{
JPanel
jp
=
plugin
.
getPanel
();
jp
.
setName
(
"plugin."
.
concat
(
plugin
.
getName
()));
desktop
.
addTab
(
plugin
.
getDisplayName
(),
jp
);
}
}
@Override
public
void
start
()
{
jFrame
.
pack
();
jFrame
.
setVisible
(
true
);
}
}
library/liblangbuilder/src/main/java/me/felinewith/lang_toolkit/library/ILangPlugin.java
View file @
54367d6
package
me
.
felinewith
.
lang_toolkit
.
library
;
import
org.apache.commons.configuration2.Configuration
;
/**
*
* @author jlhawkwell
*/
public
interface
ILangPlugin
{
public
abstract
class
ILangPlugin
{
protected
Configuration
project
;
public
abstract
int
hasFile
();
public
abstract
String
getFileName
();
}
library/libservices/src/main/java/me/felinewith/lang_toolkit/library/ILangService.java
View file @
54367d6
package
me
.
felinewith
.
lang_toolkit
.
library
;
import
javax.swing.JComponent
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
/**
*
* @author jlhawkwell
*/
public
interface
ILangService
<
T
>
{
public
abstract
void
serviceInit
();
public
abstract
class
ILangService
<
T
>
{
protected
Logger
log
;
public
void
serviceInit
()
{
log
=
LogManager
.
getLogger
();
}
public
abstract
void
serviceInit
(
T
t
);
public
abstract
boolean
canAttach
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment