This is an automated email from the ASF dual-hosted git repository.
aadamchik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new 90deccb50 removing unused Modeler classes
90deccb50 is described below
commit 90deccb50db8cae9e1b0d6b6d3efd954359d7ffc
Author: Andrus Adamchik <[email protected]>
AuthorDate: Sun Apr 12 13:29:21 2026 -0400
removing unused Modeler classes
---
.../apache/cayenne/swing/control/ActionLink.java | 87 --------
.../apache/cayenne/swing/control/FileChooser.java | 224 ---------------------
2 files changed, 311 deletions(-)
diff --git
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/ActionLink.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/ActionLink.java
deleted file mode 100644
index 020b7f489..000000000
---
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/ActionLink.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.swing.control;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.JLabel;
-
-/**
- * A label that works like an HTML hyperlink, generating ActionEvents on click.
- *
- */
-public class ActionLink extends JLabel {
-
- static final Color LINK_FONT_COLOR = Color.BLUE;
- static final Color LINK_MOUSEOVER_FONT_COLOR = Color.RED;
-
- public ActionLink(String text) {
- super(text);
-
- // due to this bug (that is marked as fixed, but stil doesn't work on
JDK
- // 1.4.2), we can't build underlined font:
- // http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4296952
-
- setForeground(LINK_FONT_COLOR);
- addMouseListener(new MouseAdapter() {
-
- public void mouseClicked(MouseEvent e) {
- fireActionPerformed();
- }
-
- public void mouseEntered(MouseEvent e) {
- setForeground(LINK_MOUSEOVER_FONT_COLOR);
- }
-
- public void mouseExited(MouseEvent e) {
- setForeground(LINK_FONT_COLOR);
- }
- });
- }
-
- protected void fireActionPerformed() {
-
- Object[] listeners = listenerList.getListenerList();
- ActionEvent e = null;
-
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == ActionListener.class) {
-
- if (e == null) {
- e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
null);
- }
-
- ((ActionListener) listeners[i + 1]).actionPerformed(e);
- }
- }
- }
-
- public void addActionListener(ActionListener l) {
- listenerList.add(ActionListener.class, l);
- }
-
- public void removeActionListener(ActionListener l) {
- listenerList.remove(ActionListener.class, l);
- }
-}
diff --git
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/FileChooser.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/FileChooser.java
deleted file mode 100644
index fb7086f1a..000000000
---
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/swing/control/FileChooser.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.swing.control;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.cayenne.util.Util;
-
-import com.jgoodies.forms.builder.DefaultFormBuilder;
-import com.jgoodies.forms.layout.FormLayout;
-
-/**
- * A control that renders as a text field and a button to choose a file. Fires
a property
- * change event when a current directory is changed, either explictly or
during a file
- * selection by the user.
- *
- */
-public class FileChooser extends JPanel {
-
- public static final String CURRENT_DIRECTORY_PROPERTY = "currentDirectory";
-
- protected boolean existingOnly;
- protected boolean allowFiles;
- protected boolean allowDirectories;
- protected FileFilter fileFilter;
- protected String title;
- protected File currentDirectory;
-
- protected JTextField fileName;
- protected JButton chooseButton;
-
- public FileChooser() {
- this.allowFiles = false;
- this.allowFiles = true;
-
- this.fileName = new JTextField();
- this.chooseButton = new JButton("...");
-
- FormLayout layout = new FormLayout("pref:grow, 3dlu, pref", "");
- DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
- builder.append(fileName, chooseButton);
-
- chooseButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- chooseFileAction();
- }
- });
- }
-
- public FileChooser(String title, boolean allowFiles, boolean
allowDirectories) {
- this();
-
- this.allowFiles = allowFiles;
- this.allowDirectories = allowDirectories;
- this.title = title;
- }
-
- public File getFile() {
- String value = fileName.getText();
- if (Util.isEmptyString(value)) {
- return null;
- }
-
- File file = new File(value);
- if (existingOnly && !file.exists()) {
- return null;
- }
-
- return file;
- }
-
- public void setFile(File file) {
- fileName.setText(file != null ? file.getAbsolutePath() : "");
- }
-
- protected void chooseFileAction() {
- int mode = getSelectionMode();
-
- JFileChooser chooser = new JFileChooser();
- chooser.setFileSelectionMode(mode);
- chooser.setDialogType(JFileChooser.OPEN_DIALOG);
- chooser.setAcceptAllFileFilterUsed(true);
-
- if (fileFilter != null) {
- chooser.setFileFilter(fileFilter);
- }
-
- if (currentDirectory != null) {
- chooser.setCurrentDirectory(currentDirectory);
- }
-
- chooser.setDialogTitle(makeTitle(mode));
-
- int result =
chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this));
- if (result == JFileChooser.APPROVE_OPTION) {
- File selected = chooser.getSelectedFile();
- fileName.setText(selected != null ? selected.getAbsolutePath() :
"");
- }
-
- setCurrentDirectory(chooser.getCurrentDirectory());
- }
-
- protected String makeTitle(int selectionMode) {
- if (title != null) {
- return title;
- }
-
- switch (selectionMode) {
- case JFileChooser.FILES_AND_DIRECTORIES:
- return "Choose a file or a directory";
- case JFileChooser.DIRECTORIES_ONLY:
- return "Choose a directory";
- default:
- return "Choose a file";
- }
- }
-
- protected int getSelectionMode() {
- if (allowFiles && allowDirectories) {
- return JFileChooser.FILES_AND_DIRECTORIES;
- }
- else if (allowFiles && !allowDirectories) {
- return JFileChooser.FILES_ONLY;
- }
- else if (!allowFiles && allowDirectories) {
- return JFileChooser.DIRECTORIES_ONLY;
- }
- else {
- // invalid combination... return files...
- return JFileChooser.FILES_ONLY;
- }
- }
-
- public boolean isAllowDirectories() {
- return allowDirectories;
- }
-
- public void setAllowDirectories(boolean allowDirectories) {
- this.allowDirectories = allowDirectories;
- }
-
- public boolean isAllowFiles() {
- return allowFiles;
- }
-
- public void setAllowFiles(boolean allowFiles) {
- this.allowFiles = allowFiles;
- }
-
- public FileFilter getFileFilter() {
- return fileFilter;
- }
-
- public void setFileFilter(FileFilter filteFiler) {
- this.fileFilter = filteFiler;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public boolean isExistingOnly() {
- return existingOnly;
- }
-
- public void setExistingOnly(boolean existingOnly) {
- this.existingOnly = existingOnly;
- }
-
- public void setColumns(int col) {
- fileName.setColumns(col);
- }
-
- public int getColumns() {
- return fileName.getColumns();
- }
-
- /**
- * Returns the last directory visited when picking a file.
- */
- public File getCurrentDirectory() {
- return currentDirectory;
- }
-
- public void setCurrentDirectory(File currentDirectory) {
- if (!Util.nullSafeEquals(this.currentDirectory, currentDirectory)) {
- File oldValue = this.currentDirectory;
- this.currentDirectory = currentDirectory;
- this.setFile(currentDirectory);
- firePropertyChange(CURRENT_DIRECTORY_PROPERTY, oldValue,
currentDirectory);
- }
- }
-}