-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DJ-Raven/drawer
Add Drawer
- Loading branch information
Showing
37 changed files
with
1,405 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package raven.drawer; | ||
|
||
import raven.drawer.component.DrawerBuilder; | ||
import raven.drawer.component.DrawerPanel; | ||
import raven.popup.GlassPanePopup; | ||
|
||
public class Drawer { | ||
|
||
private static Drawer instance; | ||
private DrawerPanel drawerPanel; | ||
private DrawerOption option; | ||
|
||
public static Drawer getInstance() { | ||
if (instance == null) { | ||
instance = new Drawer(); | ||
} | ||
return instance; | ||
} | ||
|
||
public static Drawer newInstance() { | ||
return new Drawer(); | ||
} | ||
|
||
private Drawer() { | ||
option = new DrawerOption(); | ||
} | ||
|
||
public void setDrawerBuilder(DrawerBuilder drawerBuilder) { | ||
drawerPanel = new DrawerPanel(drawerBuilder); | ||
drawerBuilder.build(drawerPanel); | ||
} | ||
|
||
public void showDrawer() { | ||
if (drawerPanel == null) { | ||
throw new NullPointerException("Drawer builder has not initialize"); | ||
} | ||
GlassPanePopup.showPopup(drawerPanel, option, "drawer"); | ||
} | ||
|
||
public void closeDrawer() { | ||
GlassPanePopup.closePopup("drawer"); | ||
} | ||
|
||
public DrawerPanel getDrawerPanel() { | ||
return drawerPanel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package raven.drawer; | ||
|
||
import raven.popup.DefaultOption; | ||
|
||
import java.awt.*; | ||
|
||
public class DrawerOption extends DefaultOption { | ||
|
||
private final int width = 275; | ||
|
||
@Override | ||
public String getLayout(Component parent, float animate) { | ||
String l; | ||
if (parent.getComponentOrientation().isLeftToRight()) { | ||
float x = (animate * width) - width; | ||
l = "pos " + x + " 0,height 100%,width " + width; | ||
} else { | ||
float x = (animate * width); | ||
l = "pos 100%-" + x + " 0,height 100%,width " + width; | ||
} | ||
return l; | ||
} | ||
|
||
@Override | ||
public boolean closeWhenClickOutside() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean closeWhenPressedEsc() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package raven.drawer.component; | ||
|
||
import java.awt.*; | ||
|
||
public interface DrawerBuilder { | ||
|
||
public void build(DrawerPanel drawerPanel); | ||
|
||
public Component getHeader(); | ||
|
||
public Component getHeaderSeparator(); | ||
|
||
public Component getMenu(); | ||
|
||
public Component getFooter(); | ||
} |
Oops, something went wrong.