Skip to content

Commit

Permalink
Last fixes before 1.0.0.5 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Exslims committed Mar 12, 2017
1 parent 1ba9988 commit 0dcedc8
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public abstract class MovableComponentFrame extends ComponentFrame {
protected Container mainContainer;
private FrameConstraints prevConstraints;
protected UndecoratedFrameState moveState = UndecoratedFrameState.DEFAULT;
protected boolean locationWasChanged = false;
protected boolean sizeWasChanged = false;
protected boolean inMoveMode = false;
Expand All @@ -32,6 +33,7 @@ protected void onLock(){
public void setState(UndecoratedFrameState state){
switch (state){
case MOVING:{
this.moveState = UndecoratedFrameState.MOVING;
inMoveMode = true;
this.prevConstraints = new FrameConstraints(
this.processSEResize,
Expand All @@ -57,6 +59,7 @@ public void setState(UndecoratedFrameState state){
break;
}
case DEFAULT: {
this.moveState = UndecoratedFrameState.DEFAULT;
this.setContentPane(mainContainer);
this.processSEResize = prevConstraints.processSEResize;
this.processEResize = prevConstraints.processEResize;
Expand Down Expand Up @@ -110,6 +113,11 @@ public void mouseExited(MouseEvent e) {
}
return panel;
}

public UndecoratedFrameState getMoveState() {
return moveState;
}

protected class FrameConstraints {
private boolean processSEResize;
private boolean processEResize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,28 @@ private JPanel getTaskBarPanel(){
true
);

JButton itemGrid = componentsFactory.getIconButton("app/item-grid-disable.png",24,AppThemeColor.FRAME_ALPHA, TooltipConstants.VISIBLE_MODE);
componentsFactory.setUpToggleCallbacks(itemGrid,
() -> {
itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-enable.png", 24));
TaskBarFrame.this.repaint();
FramesManager.INSTANCE.enableMovementDirect("ItemsGridFrame");
},
() -> {
itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-disable.png", 24));
TaskBarFrame.this.repaint();
FramesManager.INSTANCE.disableMovement("ItemsGridFrame");
},
true
);
JButton itemGrid = componentsFactory.getIconButton("app/item-grid-enable.png",24,AppThemeColor.FRAME_ALPHA, TooltipConstants.VISIBLE_MODE);
itemGrid.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if(SwingUtilities.isLeftMouseButton(e)) {
FramesManager.INSTANCE.enableOrDisableMovementDirect("ItemsGridFrame");
}
}
});
// componentsFactory.setUpToggleCallbacks(itemGrid,
// () -> {
// itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-enable.png", 24));
// TaskBarFrame.this.repaint();
// FramesManager.INSTANCE.enableMovementDirect("ItemsGridFrame");
// },
// () -> {
// itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-disable.png", 24));
// TaskBarFrame.this.repaint();
// FramesManager.INSTANCE.disableMovement("ItemsGridFrame");
// },
// true
// );

JButton toHideOut = componentsFactory.getIconButton("app/hideout.png",24,AppThemeColor.FRAME_ALPHA,TooltipConstants.HIDEOUT);
toHideOut.addActionListener(action -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public void setUp(String frameClass, boolean showingSetUpFrame){
enableMovement(frame,showingSetUpFrame);
activeFrames.add(frame);
}
public void enableOrDisableMovement(String frameClass, boolean showingSetUpFrame) {
MovableComponentFrame frame = movableFrames.get(frameClass);
if(frame.getMoveState().equals(UndecoratedFrameState.DEFAULT)){
enableMovement(frame,showingSetUpFrame);
activeFrames.add(frame);
}else {
disableMovement(frame);
activeFrames.remove(frame);
}
}

public void disableAll() {
activeFrames.forEach(this::disableMovement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public void enableMovementExclude(String... frames){
public void enableMovementDirect(String frameClass){
locationCommander.setUp(frameClass,false);
}
public void enableOrDisableMovementDirect(String frameClass){
locationCommander.enableOrDisableMovement(frameClass,false);
}
public void disableMovement(){
locationCommander.disableAll();
}
Expand Down
2 changes: 1 addition & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>com.home.mercury</groupId>
<artifactId>app-shared</artifactId>
<version>1.0.0.1</version>
<version>1.0.0.4</version>
</dependency>
<!--external-->
<!--<dependency>-->
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<module>app</module>
<module>app-ui</module>
<module>app-core</module>
<module>app-shared</module>
<!--<module>app-shared</module>-->
<module>app-local-updater</module>
</modules>
<packaging>pom</packaging>
Expand Down

0 comments on commit 0dcedc8

Please sign in to comment.