Skip to content

Commit

Permalink
DarkLAF, further steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisser committed Jun 24, 2024
1 parent 2f42e62 commit c0ad6b0
Show file tree
Hide file tree
Showing 37 changed files with 1,802 additions and 1,792 deletions.
6 changes: 3 additions & 3 deletions docs/installation-2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@
<td class="content" height="520" valign="top" width="100%">
<p>Use the installation file "Jailer-database-tools-n.n.n.msi" (for Windows) or "jailer-database-tools_n.n.n-x64.deb" (for Linux).
</p><p>
Unless you want to use your own Java installation. In this case unzip the file "jailer_n.n.n.zip". See also <a href="faq.html#multiuser">faq.html#multiuser</a>
Unless you want to use your own Java installation. Or also if you want to use the command line interface (CLI). In this cases unzip the file "jailer_n.n.n.zip". See also <a href="faq.html#multiuser">faq.html#multiuser</a>
</p>To start the tool from the unpacked zip:
<ul><li>On windows platform execute <i>&quot;Jailer.exe&quot;</i>. You can also start <i>&quot;jailerGUI.bat&quot;</i></li>
<li>On Unix/Linux platform execute the script <i>&quot;jailerGUI.sh&quot;</i> or use <i>&quot;java -jar jailer.jar&quot;</i>
<ul><li>On windows platform execute <i>&quot;Jailer.exe&quot;</i>. You can also start <i>&quot;jailerGUI.bat&quot;</i>.<br>Use <i>&quot;jailer.bat&quot;</i> for CLI calls.</li>
<li>On Unix/Linux platform execute the script <i>&quot;jailerGUI.sh&quot;</i> or use <i>&quot;java -jar jailer.jar&quot;</i>.<br>Use <i>&quot;jailer.sh&quot;</i> for CLI calls.
</li></ul>

<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>
Expand Down
4 changes: 0 additions & 4 deletions src/main/engine/net/sf/jailer/JailerVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,3 @@ public static void main(String[] args) {
}

}

//TODO
//TODO icons: black"-"plus" and "filter"-icon (GraphView) are too bright

8 changes: 4 additions & 4 deletions src/main/gui/net/sf/jailer/ui/Colors.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import javax.swing.Timer;

import net.sf.jailer.ui.UIUtil.PLAF;
import net.sf.jailer.ui.UIUtil.PlafAware;
import net.sf.jailer.ui.syntaxtextarea.RSyntaxTextAreaWithTheme;
import net.sf.jailer.ui.util.HSLColor;

Expand Down Expand Up @@ -68,9 +69,6 @@ private static void initColors() {
Color_0_0_220.init(new Color(0, 0, 220), Color_0_100_255.dark);
Color_255_255_230.init(new Color(255, 255, 200), new Color(11, 44, 44));

// TODO
// TODO ext. copy: "maximize"-button icon recoloring

HTMLColor_000000 = UIUtil.plaf != PLAF.FLATDARK? "\"#000000\"" : "\"#dddddd\"";
HTMLColor_006600 = UIUtil.plaf != PLAF.FLATDARK? "\"#006600\"" : "\"#00c000\"";
HTMLColor_0000B0 = UIUtil.plaf != PLAF.FLATDARK? "\"#0000B0\"" : "\"#00B0FF\"";
Expand Down Expand Up @@ -515,7 +513,9 @@ public static void init() {
for (Window w : Window.getWindows()) {
w.repaint();
UIUtil.traverse(w, null, c-> null, (c, o) -> null, (t, c) -> {
if (c instanceof RSyntaxTextAreaWithTheme) {
if (c instanceof PlafAware) {
((PlafAware) c).onNewPlaf();
} else if (c instanceof RSyntaxTextAreaWithTheme) {
((RSyntaxTextAreaWithTheme) c).initTheme();
}
});
Expand Down
4 changes: 0 additions & 4 deletions src/main/gui/net/sf/jailer/ui/ExportDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3173,10 +3173,6 @@ public boolean hasDeleteScript() {

}


// TODO
// TODO hint if state != 0 that an installation via jailer_version.jar is needed for CLI

// TODO 1 test: cycle in aggregations
// TODO 1 user option: include (or not) any non-subject top-level object

11 changes: 8 additions & 3 deletions src/main/gui/net/sf/jailer/ui/ExtendetCopyPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;

import net.sf.jailer.ui.UIUtil.PLAF;
import net.sf.jailer.ui.databrowser.sqlconsole.TabContentPanel;
import net.sf.jailer.util.LogUtil;
import net.sf.jailer.util.Pair;
Expand Down Expand Up @@ -496,7 +497,7 @@ private void updatePreview() {
private ExtendetCopyPanel(boolean columnNamesInFirstRow) {
initComponents(); UIUtil.initComponents(this);
jToolBar1.setFloatable(false);
maximizeButton.setIcon(maximizeIcon);
maximizeButton.setIcon(UIUtil.plaf == PLAF.FLATDARK? maximizeDarkIcon : maximizeIcon);
selectAllButton.setIcon(selectIcon);
copyButton.setIcon(copyIcon);
closeCloseButton.setIcon(cancelIcon);
Expand Down Expand Up @@ -847,7 +848,7 @@ private void maximizeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GE
dialog.setSize(oldSize);
oldLoc = null;
oldSize = null;
maximizeButton.setIcon(maximizeIcon);
maximizeButton.setIcon(UIUtil.plaf == PLAF.FLATDARK? maximizeDarkIcon : maximizeIcon);
} else {
oldLoc = dialog.getLocation();
oldSize = dialog.getSize();
Expand All @@ -859,7 +860,7 @@ private void maximizeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GE
insets.right += b;
dialog.setLocation(owner.getLocation().x + insets.left, owner.getLocation().y + insets.top - 1);
dialog.setSize(owner.getSize().width - insets.left - insets.right + 1, owner.getSize().height - insets.top - insets.bottom);
maximizeButton.setIcon(unmaximizeIcon);
maximizeButton.setIcon(UIUtil.plaf == PLAF.FLATDARK? unmaximizeDarkIcon : unmaximizeIcon);
}
}
}
Expand Down Expand Up @@ -1011,7 +1012,9 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) {
// End of variables declaration//GEN-END:variables

private static ImageIcon maximizeIcon;
private static ImageIcon maximizeDarkIcon;
private static ImageIcon unmaximizeIcon;
private static ImageIcon unmaximizeDarkIcon;
private static ImageIcon selectIcon;
private static ImageIcon copyIcon;
private static ImageIcon cancelIcon;
Expand All @@ -1021,6 +1024,8 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) {
// load images
maximizeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximizec.png"));
unmaximizeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/unmaximize.png"));
maximizeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximizec_dark.png"));
unmaximizeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/unmaximize_dark.png"));
selectIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/select.png"));
copyIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/copy.png"));
copyCloseIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/copyclose.png"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/gui/net/sf/jailer/ui/ExtractionModelFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
</MenuItem>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Look and Feel (Theme)"/>
<Property name="text" type="java.lang.String" value="Themes (Look and Feel)"/>
</Properties>
</Menu>
</SubComponents>
Expand Down
2 changes: 1 addition & 1 deletion src/main/gui/net/sf/jailer/ui/ExtractionModelFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu5.add(jMenu4);
jMenu5.add(jSeparator6);

plafMenu.setText("Look and Feel (Theme)");
plafMenu.setText("Themes (Look and Feel)");
jMenu5.add(plafMenu);

jMenuBar2.add(jMenu5);
Expand Down
53 changes: 32 additions & 21 deletions src/main/gui/net/sf/jailer/ui/UIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
*/
public class UIUtil {

/**
/**
* The logger.
*/
private static final Logger _log = LoggerFactory.getLogger(UIUtil.class);
Expand Down Expand Up @@ -1662,6 +1662,9 @@ public void run() {

public static boolean validatePrimaryKeysPending = false;

private abstract static class PlafAwareJRadioButtonMenuItem extends JRadioButtonMenuItem implements PlafAware {
}

/**
* Initializes the "Native L&F" menu items.
*
Expand All @@ -1670,7 +1673,14 @@ public void run() {
public static void initPLAFMenuItem(final JMenu plafMenu, final Component parentComponent) {
ButtonGroup buttonGroup = new ButtonGroup();
for (PLAF p: UIUtil.availablePlafs) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem();
JRadioButtonMenuItem item = new PlafAwareJRadioButtonMenuItem() {
@Override
public void onNewPlaf() {
if (plaf == p) {
setSelected(true);
}
}
};
buttonGroup.add(item);
if (p == plaf) {
item.setSelected(true);
Expand All @@ -1679,11 +1689,13 @@ public static void initPLAFMenuItem(final JMenu plafMenu, final Component parent
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UISettings.store(UISettings.USE_NATIVE_PLAF, p.name());
plaf = p;
p.install();
initPLAF();
// JOptionPane.showMessageDialog(parentComponent, "The \"look and feel\" has been changed.\n(Will be effective after restart)", "Look&Feel", JOptionPane.INFORMATION_MESSAGE);
invokeLater(() -> {
UISettings.store(UISettings.USE_NATIVE_PLAF, p.name());
plaf = p;
p.install();
initPLAF();
// JOptionPane.showMessageDialog(parentComponent, "The \"look and feel\" has been changed.\n(Will be effective after restart)", "Look&Feel", JOptionPane.INFORMATION_MESSAGE);
});
}
});
plafMenu.add(item);
Expand Down Expand Up @@ -2186,6 +2198,10 @@ public static void checkPLAF(Component parentComponent) {
UISettings.store("OLD_PLAF", plaf.name());
}

public interface PlafAware {
void onNewPlaf();
}

public static void readAndInitPLAF() {
FlatLaf.registerCustomDefaultsSource("net.sf.jailer.ui.resource");

Expand All @@ -2211,22 +2227,14 @@ public static void readAndInitPLAF() {
}
}

try {
// TODO
// TODO remove
if (System.getProperty("darkLAF").equalsIgnoreCase("true")) {
// plaf = PLAF.FLATDARK;
}
} catch (Exception e) {
// ignore
}

if (plaf == PLAF.NIMBUS) {
plaf = PLAF.FLAT;
}
initPLAF();
}

private static boolean flatLafInitialized = false;

public static void initPLAF() {
switch (plaf) {
case NATIVE:
Expand Down Expand Up @@ -2261,10 +2269,13 @@ public static void initPLAF() {

// UIManager.put( "TextArea.background", Colors.Color_white);

if (plaf == PLAF.FLATDARK) {
FlatDarkLaf.setup();
} else {
FlatLightLaf.setup();
if (!flatLafInitialized) {
if (plaf == PLAF.FLATDARK) {
FlatDarkLaf.setup();
} else {
FlatLightLaf.setup();
}
flatLafInitialized = true;
}
break;
} catch (Exception x) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/gui/net/sf/jailer/ui/databrowser/DataBrowser.form
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@
</MenuItem>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Look and Feel (Theme)"/>
<Property name="text" type="java.lang.String" value="Themes (Look and Feel)"/>
</Properties>
</Menu>
</SubComponents>
Expand Down
Loading

0 comments on commit c0ad6b0

Please sign in to comment.