This commit is contained in:
Matthew Kennedy 2023-02-21 01:11:34 -08:00
parent 629f526d5e
commit d269139aa4
16 changed files with 0 additions and 1021 deletions

View File

@ -28,8 +28,6 @@
<option value="$PROJECT_DIR$/gcc_map_reader" />
<option value="$PROJECT_DIR$/logicdata2c" />
<option value="$PROJECT_DIR$/proxy_server" />
<option value="$PROJECT_DIR$/ts_plugin" />
<option value="$PROJECT_DIR$/ts_plugin_launcher" />
<option value="$PROJECT_DIR$/version2header" />
</set>
</option>

View File

@ -20,10 +20,6 @@ include ':config_definition_base'
project(':config_definition_base').projectDir = new File('configuration_definition_base')
include ':config_definition'
project(':config_definition').projectDir = new File('configuration_definition')
include ':ts_plugin_launcher'
project(':ts_plugin_launcher').projectDir = new File('ts_plugin_launcher')
include ':ts_plugin'
project(':ts_plugin').projectDir = new File('ts_plugin')
include ':autoupdate'
project(':autoupdate').projectDir = new File('../java_console/autoupdate')
include ':shared_ui'

View File

@ -1 +0,0 @@
*.jar

View File

@ -1,69 +0,0 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
defaultTasks 'shadowJar'
apply from: '../../java_tools/dependencies.gradle'
dependencies {
implementation global_libs.annotations
implementation ts_plugin_libs.httpcore
implementation ts_plugin_libs.httpmime
implementation project(':autoupdate')
implementation ts_plugin_libs.launcher_api
implementation global_libs.commons_logging
testImplementation global_libs.junit
}
def TODAY = new Date().format('yyyy-MM-dd HH:mm:ss')
def jarName = 'rusefi_ts_plugin_launcher'
def jarDir = 'jar'
def localPath = '.efianalytics/TunerStudio/plugins'
def userHome = System.properties['user.home']
jar {
archiveBaseName = jarName
manifest {
attributes(
'Built-Date': TODAY,
'Signature-Vendor': 'rusEFI LLC',
'ApplicationPlugin': 'com.rusefi.ts_plugin.TsPluginLauncher'
)
}
}
shadowJar {
/*
to exclude suffix '-all'
in resulting archive file name
*/
archiveBaseName = jarName
archiveClassifier = ''
destinationDirectory = file( 'build' + '/' + jarDir )
manifest {
inheritFrom project.tasks.jar.manifest
}
/*
to keep only required
dependencies in resulting jar
*/
dependencies {
exclude(dependency(global_libs.junit))
exclude(dependency(global_libs.annotations))
exclude(dependency(ts_plugin_libs.launcher_api))
}
}
// custom task from build.xml
tasks.register('launcher_local_install', Copy) {
dependsOn tasks.shadowJar
from layout.buildDirectory.dir( jarDir + '/' + jarName + '.jar')
into layout.buildDirectory.dir(userHome + '/' + localPath)
}

View File

@ -1,18 +0,0 @@
package com.rusefi.ts_plugin;
import javax.swing.*;
/**
* Sandbox for {@link TsPluginLauncher}
*/
public class PluginLauncherSandbox {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(800, 500);
frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
frame.add(new TsPluginLauncher().getPluginPanel());
frame.setVisible(true);
}
}

View File

@ -1,12 +0,0 @@
package com.rusefi.ts_plugin;
import javax.swing.*;
public interface TsPluginBody {
String GET_VERSION = "getVersion";
JComponent getContent();
/*
void close();
*/
}

View File

@ -1,108 +0,0 @@
package com.rusefi.ts_plugin;
import com.efiAnalytics.plugin.ApplicationPlugin;
import com.efiAnalytics.plugin.ecu.ControllerAccess;
import org.putgemin.VerticalFlowLayout;
import javax.swing.*;
/**
* This class is the more permanent part of the plugin, it's responsible for refreshing and launcher PluginEntry via reflections.
* which downloads the main more volatile UI part (PluginEntry)
*
* by the way TS installs stuff into %user%\.efianalytics\TunerStudio\plugins folder
* @see PluginLauncherSandbox sandbox for this
* see PluginEntry
* @see Updater
*/
public class TsPluginLauncher implements ApplicationPlugin {
public static final int BUILD_VERSION = 4;
static final String VERSION = "2022.alpha." + BUILD_VERSION;
private static final String HELP_URL = "https://github.com/rusefi/rusefi/wiki/TS-Plugin";
private final JPanel content = new JPanel(new VerticalFlowLayout());
public TsPluginLauncher() {
System.out.println("init " + this);
}
@Override
public String getIdName() {
return "rusEFI_plugin";
}
@Override
public int getPluginType() {
return PERSISTENT_DIALOG_PANEL;
}
@Override
public String getDisplayName() {
return "rusEFI Plugin";
}
@Override
public String getDescription() {
return "A plugin for rusEFI integration";
}
@Override
public void initialize(ControllerAccess controllerAccess) {
}
@Override
public boolean displayPlugin(String signature) {
System.out.println("displayPlugin " + signature);
// todo: smarter implementation one day
return true;
}
@Override
public boolean isMenuEnabled() {
return true;
}
@Override
public String getAuthor() {
return "rusEFI LLC";
}
@Override
public JComponent getPluginPanel() {
synchronized (this) {
// lazy initialization since TunerStudio creates one instance only to get version information without any
// intentions to display the UI
if (content.getComponents().length == 0) {
System.out.println("Create Updater " + this);
Updater updater = new Updater();
content.add(updater.getContent());
}
}
return content;
}
@Override
public void close() {
System.out.println("TsPluginLauncher.close " + this);
}
@Override
public String getHelpUrl() {
return HELP_URL;
}
@Override
public String getVersion() {
return VERSION;
}
@Override
public double getRequiredPluginSpec() {
return PLUGIN_API_VERSION;
}
@Override
public String toString() {
return super.toString() + " " + getVersion();
}
}

View File

@ -1,209 +0,0 @@
package com.rusefi.ts_plugin;
import com.rusefi.core.ui.AutoupdateUtil;
import com.rusefi.core.net.ConnectionAndMeta;
import com.rusefi.core.FileUtil;
import org.jetbrains.annotations.Nullable;
import org.putgemin.VerticalFlowLayout;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URLClassLoader;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
import static com.rusefi.ts_plugin.TsPluginLauncher.VERSION;
/**
* Download fresh copy of {@link #PLUGIN_BODY_JAR} and launch {@link #PLUGIN_ENTRY_CLASS} via reflection.
* @see ConnectionAndMeta#BASE_URL_LATEST
*/
public class Updater {
private static final String PLUGIN_ENTRY_CLASS = "com.rusefi.ts_plugin.PluginEntry";
private static final String PLUGIN_BODY_JAR = "rusefi_plugin_body.jar";
private static final String LOCAL_JAR_FILE_NAME = FileUtil.RUSEFI_SETTINGS_FOLDER + File.separator + PLUGIN_BODY_JAR;
private static final String TITLE = "rusEFI plugin installer " + VERSION;
private final JPanel content = new JPanel(new VerticalFlowLayout());
private static final ImageIcon LOGO = AutoupdateUtil.loadIcon("/rusefi_online_color_300.png");
private final JLabel countDownLabel = new JLabel();
private final AtomicInteger autoStartCounter = new AtomicInteger(4);
private TsPluginBody instance;
private final Timer timer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (autoStartCounter.decrementAndGet() == 0) {
timer.stop();
try {
if (shouldAutoStart) {
shouldAutoStart = false;
System.out.println("Auto-starting startPlugin");
startPlugin();
}
} catch (IllegalAccessException | MalformedURLException | ClassNotFoundException | InstantiationException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(content, "Error " + ex);
}
} else {
countDownLabel.setText("Will auto-start in " + autoStartCounter + " seconds");
}
}
});
private volatile boolean shouldAutoStart = true;
public Updater() {
content.add(new JLabel("" + VERSION));
content.add(new JLabel(LOGO));
String version = null;
File localFile = new File(LOCAL_JAR_FILE_NAME);
if (localFile.exists()) {
version = getVersion();
}
JButton download = new JButton("Update plugin");
JButton run = createRunThisVersionButton(version);
new Thread(new Runnable() {
@Override
public void run() {
ConnectionAndMeta connectionAndMeta;
try {
connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.BASE_URL_LATEST);
} catch (Exception e) {
e.printStackTrace();
return;
}
System.out.println("Server has " + connectionAndMeta.getCompleteFileSize() + " from " + new Date(connectionAndMeta.getLastModified()));
if (AutoupdateUtil.hasExistingFile(LOCAL_JAR_FILE_NAME, connectionAndMeta.getCompleteFileSize(), connectionAndMeta.getLastModified())) {
System.out.println("We already have latest update " + new Date(connectionAndMeta.getLastModified()));
SwingUtilities.invokeLater(() -> {
download.setText("We have latest plugin version");
download.setEnabled(false);
});
return;
}
}
}).start();
download.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if (run != null)
run.setEnabled(false);
cancelAutoStart();
new Thread(() -> startDownload(download)).start();
}
});
content.add(download);
}
@Nullable
private JButton createRunThisVersionButton(String version) {
if (version == null)
return null;
JButton run = new JButton("Run Version " + version);
run.setBackground(new Color(0x90EE90));
run.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
try {
cancelAutoStart();
System.out.println("run startPlugin");
startPlugin();
} catch (IllegalAccessException | MalformedURLException | ClassNotFoundException | InstantiationException ex) {
run.setText(e.toString());
}
}
});
content.add(run);
content.add(countDownLabel);
timer.start();
return run;
}
private void cancelAutoStart() {
timer.stop();
shouldAutoStart = false;
}
private String getVersion() {
try {
Class clazz = getPluginClass();
Method method = clazz.getMethod(TsPluginBody.GET_VERSION);
return (String) method.invoke(null);
} catch (NoSuchMethodException | MalformedURLException | ClassNotFoundException | IllegalAccessException | InvocationTargetException e) {
return null;
}
}
private void startDownload(JButton download) {
System.out.println("startDownload");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
download.setEnabled(false);
}
});
try {
ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(PLUGIN_BODY_JAR).invoke(ConnectionAndMeta.BASE_URL_LATEST);
AutoupdateUtil.downloadAutoupdateFile(LOCAL_JAR_FILE_NAME, connectionAndMeta,
TITLE);
System.out.println("Downloaded, now startPlugin");
startPlugin();
} catch (Exception e) {
e.printStackTrace();
download.setEnabled(true);
}
}
private void startPlugin() throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
System.out.println("Starting plugin " + this);
Class clazz = getPluginClass();
synchronized (this) {
if (instance != null) {
System.out.println("Not starting second instance");
return; // avoid having two instances running
}
instance = (TsPluginBody) clazz.newInstance();
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
replaceWith(instance);
}
});
}
private static Class getPluginClass() throws MalformedURLException, ClassNotFoundException {
URLClassLoader jarClassLoader = AutoupdateUtil.getClassLoaderByJar(LOCAL_JAR_FILE_NAME);
return Class.forName(PLUGIN_ENTRY_CLASS, true, jarClassLoader);
}
private void replaceWith(TsPluginBody instance) {
content.removeAll();
content.add(instance.getContent());
AutoupdateUtil.trueLayout(content.getParent());
Window windowAncestor = SwingUtilities.getWindowAncestor(content);
AutoupdateUtil.pack(windowAncestor);
}
public JPanel getContent() {
return content;
}
}

View File

@ -1,589 +0,0 @@
package org.putgemin;
/*
* @(#)VerticalFlowLayout.java 1.52 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.io.ObjectInputStream;
import java.io.IOException;
/**
* A flow layout arranges components in a directional flow, much
* like lines of text in a paragraph. The flow direction is
* determined by the container's <code>componentOrientation</code>
* property and may be one of two values:
* <ul>
* <li><code>ComponentOrientation.TOP_TO_BOTTOM</code>
* <li><code>ComponentOrientation.BOTTOM_TO_TOP</code>
* </ul>
* VerticalFlow layouts are typically used
* to arrange buttons in a panel. It arranges buttons
* horizontally until no more buttons fit on the same line.
* The line alignment is determined by the <code>align</code>
* property. The possible values are:
* <ul>
* <li>{@link #TOP TOP}
* <li>{@link #BOTTOM BOTTOM}
* <li>{@link #CENTER CENTER}
* <li>{@link #LEADING LEADING}
* <li>{@link #TRAILING TRAILING}
* </ul>
* <p/>
* For example, the following picture shows an applet using the flow
* layout manager (its default layout manager) to position three buttons:
* <p/>
* <img src="doc-files/VerticalFlowLayout-1.gif"
* ALT="Graphic of Layout for Three Buttons"
* ALIGN=center HSPACE=10 VSPACE=7>
* <p/>
* Here is the code for this applet:
* <p/>
* <hr><blockquote><pre>
* import java.awt.*;
* import java.applet.Applet;
* <p/>
* public class myButtons extends Applet {
* Button button1, button2, button3;
* public void init() {
* button1 = new Button("Ok");
* button2 = new Button("Open");
* button3 = new Button("Close");
* add(button1);
* add(button2);
* add(button3);
* }
* }
* </pre></blockquote><hr>
* <p/>
* A flow layout lets each component assume its natural (preferred) size.
*
* @author Arthur van Hoff
* @author Sami Shaio
* @version 1.52, 12/19/03
* @see java.awt.ComponentOrientation
* @since JDK1.0
*/
public class VerticalFlowLayout implements LayoutManager, java.io.Serializable {
private boolean maximizeOtherDimension = false;
public void setMaximizeOtherDimension(boolean max) {
maximizeOtherDimension = max;
}
public boolean isMaximizeOtherDimension() {
return maximizeOtherDimension;
}
/**
* This value indicates that each row of components
* should be left-justified.
*/
public static final int TOP = 0;
/**
* This value indicates that each row of components
* should be centered.
*/
public static final int CENTER = 1;
/**
* This value indicates that each row of components
* should be right-justified.
*/
public static final int BOTTOM = 2;
/**
* This value indicates that each row of components
* should be justified to the leading edge of the container's
* orientation, for example, to the left in left-to-right orientations.
*
* @see java.awt.Component#getComponentOrientation
* @see java.awt.ComponentOrientation
* @since 1.2
* Package-private pending API change approval
*/
public static final int LEADING = 3;
/**
* This value indicates that each row of components
* should be justified to the trailing edge of the container's
* orientation, for example, to the right in left-to-right orientations.
*
* @see java.awt.Component#getComponentOrientation
* @see java.awt.ComponentOrientation
* @since 1.2
* Package-private pending API change approval
*/
public static final int TRAILING = 4;
/**
* <code>align</code> is the property that determines
* how each row distributes empty space.
* It can be one of the following values:
* <ul>
* <code>TOP</code>
* <code>BOTTOM</code>
* <code>CENTER</code>
* <code>LEADING</code>
* <code>TRAILING</code>
* </ul>
*
* @serial
* @see #getAlignment
* @see #setAlignment
*/
int align; // This is for 1.1 serialization compatibility
/**
* <code>newAlign</code> is the property that determines
* how each row distributes empty space for the Java 2 platform,
* v1.2 and greater.
* It can be one of the following three values:
* <ul>
* <code>TOP</code>
* <code>BOTTOM</code>
* <code>CENTER</code>
* <code>LEADING</code>
* <code>TRAILING</code>
* </ul>
*
* @serial
* @see #getAlignment
* @see #setAlignment
* @since 1.2
*/
int newAlign; // This is the one we actually use
/**
* The flow layout manager allows a seperation of
* components with gaps. The horizontal gap will
* specify the space between components and between
* the components and the borders of the
* <code>Container</code>.
*
* @serial
* @see #getHgap()
* @see #setHgap(int)
*/
int hgap;
/**
* The flow layout manager allows a seperation of
* components with gaps. The vertical gap will
* specify the space between rows and between the
* the rows and the borders of the <code>Container</code>.
*
* @serial
* @see #getHgap()
* @see #setHgap(int)
*/
int vgap;
/*
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = -7262534875583282631L;
/**
* Constructs a new <code>VerticalFlowLayout</code> with a centered alignment and a
* default 5-unit horizontal and vertical gap.
*/
public VerticalFlowLayout() {
this(CENTER, 5, 5);
}
/**
* Constructs a new <code>VerticalFlowLayout</code> with the specified
* alignment and a default 5-unit horizontal and vertical gap.
* The value of the alignment argument must be one of
* <code>VerticalFlowLayout.TOP</code>, <code>VerticalFlowLayout.BOTTOM</code>,
* <code>VerticalFlowLayout.CENTER</code>, <code>VerticalFlowLayout.LEADING</code>,
* or <code>VerticalFlowLayout.TRAILING</code>.
*
* @param align the alignment value
*/
public VerticalFlowLayout(int align) {
this(align, 5, 5);
}
/**
* Creates a new flow layout manager with the indicated alignment
* and the indicated horizontal and vertical gaps.
* <p/>
* The value of the alignment argument must be one of
* <code>VerticalFlowLayout.TOP</code>, <code>VerticalFlowLayout.BOTTOM</code>,
* <code>VerticalFlowLayout.CENTER</code>, <code>VerticalFlowLayout.LEADING</code>,
* or <code>VerticalFlowLayout.TRAILING</code>.
*
* @param align the alignment value
* @param hgap the horizontal gap between components
* and between the components and the
* borders of the <code>Container</code>
* @param vgap the vertical gap between components
* and between the components and the
* borders of the <code>Container</code>
*/
public VerticalFlowLayout(int align, int hgap, int vgap) {
this.hgap = hgap;
this.vgap = vgap;
setAlignment(align);
}
/**
* Gets the alignment for this layout.
* Possible values are <code>VerticalFlowLayout.TOP</code>,
* <code>VerticalFlowLayout.BOTTOM</code>, <code>VerticalFlowLayout.CENTER</code>,
* <code>VerticalFlowLayout.LEADING</code>,
* or <code>VerticalFlowLayout.TRAILING</code>.
*
* @return the alignment value for this layout
* @since JDK1.1
*/
public int getAlignment() {
return newAlign;
}
/**
* Sets the alignment for this layout.
* Possible values are
* <ul>
* <li><code>VerticalFlowLayout.TOP</code>
* <li><code>VerticalFlowLayout.BOTTOM</code>
* <li><code>VerticalFlowLayout.CENTER</code>
* <li><code>VerticalFlowLayout.LEADING</code>
* <li><code>VerticalFlowLayout.TRAILING</code>
* </ul>
*
* @param align one of the alignment values shown above
* @see #getAlignment()
* @since JDK1.1
*/
public void setAlignment(int align) {
this.newAlign = align;
// this.align is used only for serialization compatibility,
// so set it to a value compatible with the 1.1 version
// of the class
switch (align) {
case LEADING:
this.align = TOP;
break;
case TRAILING:
this.align = BOTTOM;
break;
default:
this.align = align;
break;
}
}
/**
* Gets the horizontal gap between components
* and between the components and the borders
* of the <code>Container</code>
*
* @return the horizontal gap between components
* and between the components and the borders
* of the <code>Container</code>
*/
public int getHgap() {
return hgap;
}
/**
* Sets the horizontal gap between components and
* between the components and the borders of the
* <code>Container</code>.
*
* @param hgap the horizontal gap between components
* and between the components and the borders
* of the <code>Container</code>
*/
public void setHgap(int hgap) {
this.hgap = hgap;
}
/**
* Gets the vertical gap between components and
* between the components and the borders of the
* <code>Container</code>.
*
* @return the vertical gap between components
* and between the components and the borders
* of the <code>Container</code>
*/
public int getVgap() {
return vgap;
}
/**
* Sets the vertical gap between components and between
* the components and the borders of the <code>Container</code>.
*
* @param vgap the vertical gap between components
* and between the components and the borders
* of the <code>Container</code>
*/
public void setVgap(int vgap) {
this.vgap = vgap;
}
/**
* Adds the specified component to the layout.
* Not used by this class.
*
* @param name the name of the component
* @param comp the component to be added
*/
public void addLayoutComponent(String name, Component comp) {
}
/**
* Removes the specified component from the layout.
* Not used by this class.
*
* @param comp the component to remove
* @see java.awt.Container#removeAll
*/
public void removeLayoutComponent(Component comp) {
}
/**
* Returns the preferred dimensions for this layout given the
* <i>visible</i> components in the specified target container.
*
* @param target the container that needs to be laid out
* @return the preferred dimensions to lay out the
* subcomponents of the specified container
* @see Container
* @see #minimumLayoutSize
* @see java.awt.Container#getPreferredSize
*/
public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
int nmembers = target.getComponentCount();
boolean firstVisibleComponent = true;
for (int i = 0; i < nmembers; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
dim.width = Math.max(dim.width, d.width);
if (firstVisibleComponent) {
firstVisibleComponent = false;
} else {
dim.height += vgap;
}
dim.height += d.height;
}
}
Insets insets = target.getInsets();
dim.width += insets.left + insets.right + hgap * 2;
dim.height += insets.top + insets.bottom + vgap * 2;
return dim;
}
}
/**
* Returns the minimum dimensions needed to layout the <i>visible</i>
* components contained in the specified target container.
*
* @param target the container that needs to be laid out
* @return the minimum dimensions to lay out the
* subcomponents of the specified container
* @see #preferredLayoutSize
* @see java.awt.Container
* @see java.awt.Container#doLayout
*/
public Dimension minimumLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
int nmembers = target.getComponentCount();
for (int i = 0; i < nmembers; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getMinimumSize();
dim.width = Math.max(dim.width, d.width);
if (i > 0) {
dim.height += vgap;
}
dim.height += d.height;
}
}
Insets insets = target.getInsets();
dim.width += insets.left + insets.right + hgap * 2;
dim.height += insets.top + insets.bottom + vgap * 2;
return dim;
}
}
/**
* Centers the elements in the specified row, if there is any slack.
*
* @param target the component which needs to be moved
* @param x the x coordinate
* @param y the y coordinate
* @param width the width dimensions
* @param height the height dimensions
* @param colStart the beginning of the row
* @param colEnd the the ending of the row
*/
private void moveComponents(Container target, int x, int y, int width, int height,
int colStart, int colEnd, boolean ltr) {
synchronized (target.getTreeLock()) {
switch (newAlign) {
case TOP:
y += ltr ? 0 : height;
break;
case CENTER:
y += height / 2;
break;
case BOTTOM:
y += ltr ? height : 0;
break;
case LEADING:
break;
case TRAILING:
y += height;
break;
}
for (int i = colStart; i < colEnd; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
if (ltr) {
m.setLocation(x + (width - m.getWidth()) / 2, y);
} else {
m.setLocation(x + (width - m.getWidth()) / 2, target.getHeight() - y - m.getHeight());
}
y += m.getHeight() + vgap;
}
}
}
}
/**
* Lays out the container. This method lets each
* <i>visible</i> component take
* its preferred size by reshaping the components in the
* target container in order to satisfy the alignment of
* this <code>VerticalFlowLayout</code> object.
*
* @param target the specified component being laid out
* @see Container
* @see java.awt.Container#doLayout
*/
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
Insets insets = target.getInsets();
int maxwidth = target.getWidth() - (insets.left + insets.right + hgap * 2);
int maxheight = target.getHeight() - (insets.top + insets.bottom + vgap * 2);
int nmembers = target.getComponentCount();
int x = insets.left + hgap, y = 0;
int colw = 0, start = 0;
boolean ltr = target.getComponentOrientation().isLeftToRight();
for (int i = 0; i < nmembers; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
if (maximizeOtherDimension) {
d.width = maxwidth;
}
m.setSize(d.width, d.height);
if ((y == 0) || ((y + d.height) <= maxheight)) {
if (y > 0) {
y += vgap;
}
y += d.height;
colw = Math.max(colw, d.width);
} else {
moveComponents(target, insets.left + hgap, y, maxheight - x, colw, start, i, ltr);
moveComponents(target, x, insets.top + vgap, colw, maxheight - y, start, i, ltr);
y = d.height;
x += hgap + colw;
colw = d.width;
start = i;
}
}
}
moveComponents(target, x, insets.top + vgap, colw, maxheight - y, start, nmembers, ltr);
}
}
//
// the internal serial version which says which version was written
// - 0 (default) for versions before the Java 2 platform, v1.2
// - 1 for version >= Java 2 platform v1.2, which includes "newAlign" field
//
private static final int currentSerialVersion = 1;
/**
* This represent the <code>currentSerialVersion</code>
* which is bein used. It will be one of two values :
* <code>0</code> versions before Java 2 platform v1.2..
* <code>1</code> versions after Java 2 platform v1.2..
*
* @serial
* @since 1.2
*/
private int serialVersionOnStream = currentSerialVersion;
/**
* Reads this object out of a serialization stream, handling
* objects written by older versions of the class that didn't contain all
* of the fields we use now..
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if (serialVersionOnStream < 1) {
// "newAlign" field wasn't present, so use the old "align" field.
setAlignment(this.align);
}
serialVersionOnStream = currentSerialVersion;
}
/**
* Returns a string representation of this <code>VerticalFlowLayout</code>
* object and its values.
*
* @return a string representation of this layout
*/
public String toString() {
String str = "";
switch (align) {
case TOP:
str = ",align=top";
break;
case CENTER:
str = ",align=center";
break;
case BOTTOM:
str = ",align=bottom";
break;
case LEADING:
str = ",align=leading";
break;
case TRAILING:
str = ",align=trailing";
break;
}
return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + str + "]";
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -16,11 +16,3 @@ cd ..
[ -e java_console_binary/rusefi_console.jar ] || { echo "CONSOLE COMPILATION FAILED"; exit 1; }
echo "java console looks good"
echo "Building TS plugin"
cd java_tools
./gradlew :ts_plugin_launcher:shadowJar
cd ..
[ -e java_tools/ts_plugin_launcher/build/jar/rusefi_ts_plugin_launcher.jar ] || { echo "PLUGIN COMPILATION FAILED"; exit 1; }
echo "TS plugin looks good"

View File

@ -48,7 +48,6 @@ fi
cp java_console_binary/rusefi_autoupdate.jar $CONSOLE_FOLDER
cp java_console_binary/rusefi_console.jar $CONSOLE_FOLDER
cp java_tools/ts_plugin_launcher/build/jar/rusefi_ts_plugin_launcher.jar $FOLDER
cp simulator/build/rusefi_simulator.exe $CONSOLE_FOLDER
cp misc/console_launcher/rusefi_*.exe $CONSOLE_FOLDER
cp java_console/*.dll $CONSOLE_FOLDER

0
misc/jenkins/compile_other_versions/prepare_bundle.sh Normal file → Executable file
View File