Skip to content

Commit

Permalink
Hello Coral
Browse files Browse the repository at this point in the history
* 3.0 Chalcedony is now 2.5 Coral
* Kotlin -> 1.3.30
* Gradle -> 5.3.1
* RSyntaxTextArea -> 3.0.3
* First pass for #159 - support for focus / keyboard traversal of command buttons
  • Loading branch information
kirill-grouchnikov committed Apr 12, 2019
1 parent cdc189d commit 277d649
Show file tree
Hide file tree
Showing 91 changed files with 646 additions and 497 deletions.
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
@@ -1,4 +1,4 @@
### Version of Radiance (current development is 3.0-SNAPSHOT)
### Version of Radiance (current development is 2.5-SNAPSHOT)

### Sub-project (Neon, Trident, Substance, Flamingo, ...)

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Expand Up @@ -28,13 +28,13 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

version = '3.0-SNAPSHOT'
ext.codename = 'Chalcedony'
version = '2.5-SNAPSHOT'
ext.codename = 'Coral'
ext.isRelease = false

buildscript {
ext {
kotlin_version = '1.3.21'
kotlin_version = '1.3.30'
kotlinx_coroutines_version = '1.1.1'
gradle_nexus_plugin_version = '2.3.1'
dokka_plugin_version = '0.9.18'
Expand Down Expand Up @@ -174,7 +174,7 @@ task getToolsDependencies(type: Copy) {
task getAllDependencies(type: Copy, dependsOn: [getCoreDependencies, getDemoDependencies, getToolsDependencies])

wrapper {
gradleVersion = "5.3"
gradleVersion = "5.3.1"
}

task printRuntimeDependencies {
Expand Down
2 changes: 1 addition & 1 deletion demos/rainbow/build.gradle
Expand Up @@ -36,7 +36,7 @@ dependencies {
compile "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlinx_coroutines_version"
compile ("com.jgoodies:jgoodies-common:${parent.ext.jgoodies_common_version}")
compile ("com.jgoodies:jgoodies-forms:${parent.ext.jgoodies_forms_version}")
compile ('com.fifesoft:rsyntaxtextarea:3.0.2')
compile ('com.fifesoft:rsyntaxtextarea:3.0.3')
compile ('org.swinglabs:jxlayer:3.0.4')
compile project(':photon')
compile project(':substance')
Expand Down
4 changes: 2 additions & 2 deletions docs/tools/lightbeam/lightbeam.md
Expand Up @@ -14,7 +14,7 @@ Now configure the specific version of Java runtime that you want to test under a

``` export JAVA_HOME=`/usr/libexec/java_home -v 9` ```

`RADIANCE_VERSION=3.0-SNAPSHOT`
`RADIANCE_VERSION=2.5-SNAPSHOT`
`CLASSPATH=./drop/$RADIANCE_VERSION/tools/radiance-lightbeam-$RADIANCE_VERSION.jar:./build/libs-tools/jgoodies-forms-1.9.0.jar:./build/libs-tools/jgoodies-common-1.8.1.jar`

To measure the performance of a specific core look-and-feel - in this case Nimbus - run the following command:
Expand Down Expand Up @@ -48,7 +48,7 @@ Here is the script used for tracking performance numbers for [Substance](../subs

``` export JAVA_HOME=`/usr/libexec/java_home -v 9` ```

`RADIANCE_VERSION=3.0-SNAPSHOT`
`RADIANCE_VERSION=2.5-SNAPSHOT`

`CLASSPATH=../../drop/$RADIANCE_VERSION/tools/radiance-lightbeam-$RADIANCE_VERSION.jar:../../build/libs-tools/jgoodies-forms-1.9.0.jar:../../build/libs-tools/jgoodies-common-1.8.1.jar`

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed drop/3.0-SNAPSHOT/demo/radiance-ion-3.0-SNAPSHOT.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed drop/archive/flamingo/flamingo-5.1.01.jar
Binary file not shown.
Binary file removed drop/archive/flamingo/flamingo-5.2.00.jar
Binary file not shown.
Binary file removed drop/archive/flamingo/flamingo-5.3.00.jar
Binary file not shown.
Binary file removed drop/archive/ibis/ibis-1.0.00.jar
Binary file not shown.
Binary file removed drop/archive/lightbeam/lightbeam-1.1.jar
Binary file not shown.
108 changes: 0 additions & 108 deletions drop/archive/older-releases.md

This file was deleted.

Binary file removed drop/archive/spoonbill/spoonbill-1.0.00.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed drop/archive/substance/substance-7.0.01.jar
Binary file not shown.
Binary file removed drop/archive/substance/substance-7.1.01.jar
Binary file not shown.
Binary file removed drop/archive/substance/substance-8.0.02.jar
Binary file not shown.
Binary file removed drop/archive/trident/trident-1.4.jar
Binary file not shown.
Binary file removed drop/archive/trident/trident-1.5.00.jar
Binary file not shown.
Expand Up @@ -43,6 +43,7 @@
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

/**
* Command button.
Expand Down Expand Up @@ -242,11 +243,14 @@ private static class DefaultPopupButtonModel extends DefaultButtonModel
*/
public final static int POPUP_SHOWING = 1 << 8;

private JCommandButton commandButton;

/**
* Creates a new default popup button model.
*/
public DefaultPopupButtonModel() {
public DefaultPopupButtonModel(JCommandButton commandButton) {
super();
this.commandButton = commandButton;
}

@Override
Expand Down Expand Up @@ -300,6 +304,7 @@ public void setPressed(boolean b) {
} else if (currentEvent instanceof ActionEvent) {
modifiers = ((ActionEvent) currentEvent).getModifiers();
}
this.commandButton.getUI().setInnerFocusOnAction(false);
firePopupActionPerformed(new ActionEvent(this,
ActionEvent.ACTION_PERFORMED, getActionCommand(),
EventQueue.getMostRecentEventTime(), modifiers));
Expand Down Expand Up @@ -342,7 +347,7 @@ public JCommandButton(Projection<AbstractCommandButton, ? extends Command,
// the popup model so that it can be registered to track the
// changes
this.popupHandler = new PopupHandler();
PopupButtonModel popupButtonModel = new DefaultPopupButtonModel();
PopupButtonModel popupButtonModel = new DefaultPopupButtonModel(this);
popupButtonModel.setEnabled(projection.getContentModel().isSecondaryEnabled());
this.setPopupModel(popupButtonModel);

Expand Down Expand Up @@ -443,6 +448,20 @@ public void stateChanged(ChangeEvent e) {
});
}

// this.setFocusCycleRoot(true);
//// this.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
// Set<KeyStroke> managingFocusForwardTraversalKeys = new HashSet<>(1);
// managingFocusForwardTraversalKeys.add(
// KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK));
//
// LookAndFeel.installProperty(this,
// "focusTraversalKeysForward",
// managingFocusForwardTraversalKeys);
// LookAndFeel.installProperty(this,
// "focusTraversalKeysBackward",
// JComponent.
// getManagingFocusBackwardTraversalKeys());

this.updateUI();
}

Expand Down
Expand Up @@ -111,6 +111,7 @@ public void setPressed(boolean b) {
}

if (toFireFirstAction) {
this.commandButton.getUI().setInnerFocusOnAction(true);
fireActionPerformed(new CommandActionEvent(this.commandButton,
ActionEvent.ACTION_PERFORMED,
this.commandButton.getProjection().getContentModel(), getActionCommand(),
Expand Down Expand Up @@ -159,6 +160,7 @@ public void setRollover(boolean b) {
modifiers = ((ActionEvent) currentEvent).getModifiers();
}

this.commandButton.getUI().setInnerFocusOnAction(true);
fireActionPerformed(new CommandActionEvent(this.commandButton,
ActionEvent.ACTION_PERFORMED,
this.commandButton.getProjection().getContentModel(), getActionCommand(),
Expand Down
Expand Up @@ -122,6 +122,7 @@ public void setPressed(boolean b) {
}
Command originalCommand = this.commandButton.getProjection().getContentModel();
originalCommand.setToggleSelected(!originalCommand.isToggleSelected());
this.commandButton.getUI().setInnerFocusOnAction(true);
fireActionPerformed(new CommandActionEvent(this.commandButton,
ActionEvent.ACTION_PERFORMED,
originalCommand, getActionCommand(),
Expand Down
Expand Up @@ -364,6 +364,7 @@ private void initRibbon() {
this.ribbon = new JRibbon(this);
this.add(this.ribbon, BorderLayout.NORTH);

final KeyTipManager keyTipManager = KeyTipManager.defaultManager();
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
private boolean prevAltModif = false;

Expand All @@ -390,7 +391,7 @@ public void eventDispatched(AWTEvent event) {
if (Character.isLetter(keyChar) || Character.isDigit(keyChar)) {
// System.out.println("Will handle key press "
// + keyChar);
KeyTipManager.defaultManager().handleKeyPress(keyChar);
keyTipManager.handleKeyPress(keyChar);
}
if ((keyEvent.getKeyCode() == KeyEvent.VK_ALT)
|| (keyEvent.getKeyCode() == KeyEvent.VK_F10)) {
Expand All @@ -400,22 +401,40 @@ public void eventDispatched(AWTEvent event) {
boolean hadPopups = !PopupPanelManager.defaultManager()
.getShownPath().isEmpty();
PopupPanelManager.defaultManager().hidePopups(null);
if (hadPopups || KeyTipManager.defaultManager()
.isShowingKeyTips()) {
KeyTipManager.defaultManager().hideAllKeyTips();
if (hadPopups || keyTipManager.isShowingKeyTips()) {
keyTipManager.hideAllKeyTips();
} else {
KeyTipManager.defaultManager()
.showRootKeyTipChain(JRibbonFrame.this);
keyTipManager.showRootKeyTipChain(JRibbonFrame.this);
}
}
if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) {
// Dismiss keytips if showing, and popups otherwise
if (KeyTipManager.defaultManager().isShowingKeyTips()) {
KeyTipManager.defaultManager().showPreviousChain();
if (keyTipManager.isShowingKeyTips()) {
keyTipManager.showPreviousChain();
} else {
PopupPanelManager.defaultManager().hidePopups(null);
}
}
if (keyTipManager.isShowingKeyTips()) {
// Traversal of ribbon content while keytips are showing
switch (keyEvent.getKeyCode()) {
case KeyEvent.VK_LEFT:
RibbonTask previous = getPreviousRibbonTask();
if (previous != null) {
ribbon.setSelectedTask(previous);
}
break;
case KeyEvent.VK_RIGHT:
RibbonTask next = getNextRibbonTask();
if (next != null) {
ribbon.setSelectedTask(next);
}
break;
case KeyEvent.VK_TAB:
System.out.println("TAB!" + keyEvent.isShiftDown());
break;
}
}
break;
}
}
Expand All @@ -424,12 +443,12 @@ public void eventDispatched(AWTEvent event) {
switch (mouseEvent.getID()) {
case MouseEvent.MOUSE_CLICKED:
case MouseEvent.MOUSE_DRAGGED: {
KeyTipManager.defaultManager().hideAllKeyTips();
keyTipManager.hideAllKeyTips();
break;
}
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED: {
KeyTipManager.defaultManager().hideAllKeyTips();
keyTipManager.hideAllKeyTips();
if (mouseEvent.isPopupTrigger()) {
// Note that we need to find the deepest component
// under the mouse event so that it is then routed
Expand Down Expand Up @@ -795,4 +814,45 @@ private static Image getImage(ResizableIcon.Factory iconFactory, int size) {
public boolean isShowingKeyTips() {
return KeyTipManager.defaultManager().isShowingKeyTips();
}

private List<RibbonTask> getAllShownRibbonTasks() {
List<RibbonTask> result = new ArrayList<>();
for (int i = 0; i < this.ribbon.getTaskCount(); i++) {
result.add(this.ribbon.getTask(i));
}
for (int i = 0; i < this.ribbon.getContextualTaskGroupCount(); i++) {
RibbonContextualTaskGroup curr = this.ribbon.getContextualTaskGroup(i);
if (this.ribbon.isVisible(curr)) {
for (int j = 0; j < curr.getTaskCount(); j++) {
result.add(curr.getTask(j));
}
}
}

return Collections.unmodifiableList(result);
}

private RibbonTask getNextRibbonTask() {
List<RibbonTask> all = getAllShownRibbonTasks();
int indexOfCurrent = all.indexOf(this.ribbon.getSelectedTask());
if (indexOfCurrent < 0) {
return null;
}
if (indexOfCurrent == (all.size() - 1)) {
return null;
}
return all.get(indexOfCurrent + 1);
}

private RibbonTask getPreviousRibbonTask() {
List<RibbonTask> all = getAllShownRibbonTasks();
int indexOfCurrent = all.indexOf(this.ribbon.getSelectedTask());
if (indexOfCurrent < 0) {
return null;
}
if (indexOfCurrent == 0) {
return null;
}
return all.get(indexOfCurrent - 1);
}
}

0 comments on commit 277d649

Please sign in to comment.