Skip to content

Commit

Permalink
TabbedPane [ #35 ]
Browse files Browse the repository at this point in the history
- WTabbedPaneUI.java - Brand new basic `JTabbedPane` UI implementation based on components instead of workarounds
- WebTabbedPaneUI.java - Streamlined and simplified, all important elements are now defined in `WTabbedPaneUI`
- TabbedPaneLayout.java - New layout that aligns UI elements within `JTabbedPane` itself according to it's settings
- TabbedPaneInputListener.java - Base interface for custom `UIInputListener`s for `JTabbedPane`
- WTabbedPaneInputListener.java - Default `TabbedPaneInputListener` implementation
- TabArea.java - New component representing whole tab area in `JTabbedPane`
- TabAreaLayout.java - New layout that aligns UI elements in `TabArea` according to `JTabbedPane` settings
- TabViewport.java - New component representing tabs viewport in `JTabbedPane`
- TabContainer.java - New component representing tabs container in `JTabbedPane`
- TabContainerLayout.java - New layout that aligns UI elements in `TabContainer` according to `JTabbedPane` settings
- Tab.java - New component representing a single tab in `JTabbedPane`
- TabMenuButton.java - New component representing menu button for `JTabbedPane.SCROLL_TAB_LAYOUT`
- TabMenuItem.java - New component representing menu item for a single tab in `JTabbedPane`
- TabbedPanePainter.java - Added `tabContentPainter` for customizing content area background
- WebTabbedPane.java - Removed unnecessary forceful tab title translation
- WebLookAndFeel.java - Added new `Alt+Left`/`Alt+Right` key bindings for navigating to previous/next tabs
- tabbedpane.xml - Completely revamped to provide styles for all new UI elements in `JTabbedPane`
- language.xml - Added translation for the default fallback tab name in tabs menu
- WebTabbedPaneStyle.java, WebBasicTabbedPaneUI.java - Removed as deprecated and redundant
- NeoTabbedPaneUI.java - Removed as redundant, was only used as a UI test example before

DocumentPane
- TabTitleComponent.java - New custom `WebPanel`-based component that represents default `WebDocumentPane` tab title
- DefaultTabTitleComponentProvider.java, TabTitleComponent.java - Adjusted to provide better customization through styles
- DocumentData.java - Replaced list of `DocumentDataListener`s with a proper `EventListenerList` usage
- DocumentData.java - Made foreground and background `@Nullable` and `null` by default instead of fixed values

Popup [ #538 ]
- WebPopup.java - Fixed possible incorrect popup state, it will now always dispose properly upon window being closed
- WebPopup.java - Added `opaque` property change fix for some JDK versions

Label [ #542 ]
- WLabelInputListener.java, WLabelUI.java - Restored functionality of mnemonics on all label components
- LabelInputListener.java - Base interface for custom label `UIInputListener`s

ScrollPane
- ScrollPaneLayout.java, ViewportLayout.java - Renamed for consistency with other custom layout managers
- scrollpane.xml - Fixed `undecorated` style to properly hide corners decoration
- scrollpane.xml - Adjusted according to name changes

Tree
- WebTree.java - Fixed `getAvailableNodes(...)` method not using provided parent
- WebTree.java - Changed `private` modifier on a few older methods to `protected` to make them overridable

InterfaceTree
- InterfaceTreeDataProvider.java - Added fix for AWT components
- AWTComponentPreview.java, WComponentPreview.java - Added better name rendering solution for component classes

Styling
- AbstractDecorationPainter.java - Added new `has-children` and `has-no-children` states pointing at existence or absence of child components
- AbstractDecorationPainter.java - Fixed initial state of `in-focused-parent` and `in-hovered-parent` not being updated on component display
- AbstractSectionDecorationPainter.java - Disabled listeners for container states
- Icons.java, web.xml, dark.xml - Added `menu`, `menu-dimmed` and `menu-hover` general icons

Language
- UILanguageManager.java - Fixed dictionary listeners constant for component client properties
- UILanguageManager.java - Removed unnecessary language data size check

LookAndFeel
- WebLookAndFeel.java - Added key bindings for all fully revamped components with proper action name references
- NativeFonts.java - Added proper native fonts support for JDK7+ under Windows OS
- NativeFonts.java - Replaced global debug flag with a local configurable one, it is now also enabled by default
- LafLookup.java - Added support for RTL bindings for `getInputMap` method

Utilities
- SizeCache.java - New utility for `Component` sizes caching convenience for various layout calculations
- ProprietaryUtils.java - Fixed mixing cutout shape support for JDK9+
- DebugUtils.java - Removed mostly unused debug flag
- HtmlUtils.java - Removed all deprecated methods, HTML shouldn't be used for text highlight anymore
- JarStructure.java - Is now a self-sufficient class that can generate JAR structure
- JarUtils.java - Removed as redundant, `JarStructure` is now self-sufficient, a few useful methods moved to `FileUtils`
- ArrayUtils.java, CollectionUtils.java - Added method for round-robin element retrieval
- HoverAdapter.java - Removed as redundant for a single-method interface

DemoApplication
- JTabbedPaneExample.java - New example for `JTabbedPane` component
- WebDocumentPaneExample.java - New example for `WebDocumentPane` component

Other
- LibraryInfoDialog.java - Removed unnecessary custom tab separator component
- info-extension.xml - Updated according to `tabbedpane` style changes
- StyleEditor.java - Slightly improved used styles and UI elements, big revamp is coming in next updates
- styleeditor.xml - Adjusted styles according to UI changes

Project
- intellij-idea-inspections.xml - Updated inspection profile
  • Loading branch information
mgarin committed Sep 19, 2019
1 parent 3e3a3cd commit 6f751e7
Show file tree
Hide file tree
Showing 355 changed files with 11,504 additions and 11,470 deletions.
46 changes: 46 additions & 0 deletions ide/intellij-idea-inspections.xml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion modules/core/src/com/alee/api/clone/CloneBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.alee.api.clone;

import com.alee.api.annotations.NotNull;

/**
* Object clone behavior.
*
Expand All @@ -34,5 +36,6 @@ public interface CloneBehavior<T> extends Cloneable
* @param depth clone calls stack depth
* @return cloned instance of the object implementing {@link CloneBehavior}
*/
public T clone ( RecursiveClone clone, int depth );
@NotNull
public T clone ( @NotNull RecursiveClone clone, int depth );
}
20 changes: 15 additions & 5 deletions modules/core/src/com/alee/api/data/BoxOrientation.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.alee.api.data;

import com.alee.api.annotations.NotNull;

import javax.swing.*;

/**
Expand Down Expand Up @@ -114,27 +116,35 @@ public boolean isRight ()
* @param value constant value
* @return enumeration literal referencing constant value
*/
@NotNull
public static BoxOrientation get ( final int value )
{
final BoxOrientation orientation;
switch ( value )
{
case TOP:
return top;
orientation = top;
break;

case LEADING:
case LEFT:
return left;
orientation = left;
break;

case BOTTOM:
return bottom;
orientation = bottom;
break;

case TRAILING:
case RIGHT:
return right;
orientation = right;
break;

case CENTER:
default:
return center;
orientation = center;
break;
}
return orientation;
}
}
2 changes: 1 addition & 1 deletion modules/core/src/com/alee/managers/language/LM.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static int getMnemonic ( @Nullable final String key, @Nullable final Stri

/**
* Returns whether or not specified language key exists in default {@link Language}.
* This will basically check existance of at least single {@link Record} with the specified key in default {@link Language}.
* This will basically check existence of at least single {@link Record} with the specified key in default {@link Language}.
*
* @param key language key to check
* @return {@code true} if specified language key exists in default {@link Language}, {@code false} otherwise
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/com/alee/managers/language/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public int getMnemonic ( @Nullable final String key, @Nullable final String stat

/**
* Returns whether or not specified language key exists in this {@link Language}.
* This will basically check existance of at least single {@link Record} with the key.
* This will basically check existence of at least single {@link Record} with the key.
*
* @param key language key to check
* @return {@code true} if specified language key exists in this {@link Language}, {@code false} otherwise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public void actionPerformed ( final ActionEvent e )
/**
* Returns {@link SettingsGroupState} for the {@link SettingsGroup} with the specified name.
*
* @param group {@link SettingsGroup} name to retreive {@link SettingsGroupState} for
* @param group {@link SettingsGroup} name to retrieve {@link SettingsGroupState} for
* @return {@link SettingsGroupState} for the {@link SettingsGroup} with the specified name
*/
public SettingsGroupState getSettingsGroupState ( final String group )
Expand Down
15 changes: 15 additions & 0 deletions modules/core/src/com/alee/utils/ArrayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1049,4 +1049,19 @@ else if ( array1 == null || array2 == null || array1.length != array2.length )
}
return equals;
}

/**
* Returns item from the array at the specified index.
* Index can be larger than array size, allowing round robin item selection.
*
* @param index index in the array or a number larger than array size, cannot be less than zero
* @param items array items
* @param <T> item type
* @return item from the array at the specified index
*/
@Nullable
public static <T> T roundRobin ( final int index, @NotNull final T... items )
{
return items.length > 0 ? items[ index % items.length ] : null;
}
}
15 changes: 15 additions & 0 deletions modules/core/src/com/alee/utils/CollectionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1156,4 +1156,19 @@ public static <T extends Collection<?>> T requireNotEmpty ( @Nullable final T co
}
return collection;
}

/**
* Returns item from the {@link List} at the specified index.
* Index can be larger than {@link List} size, allowing round robin item selection.
*
* @param index index in the {@link List} or a number larger than {@link List} size, cannot be less than zero
* @param items {@link List}
* @param <T> item type
* @return item from the {@link List} at the specified index
*/
@Nullable
public static <T> T roundRobin ( final int index, @NotNull final List<T> items )
{
return items.size () > 0 ? items.get ( index % items.size () ) : null;
}
}
94 changes: 73 additions & 21 deletions modules/core/src/com/alee/utils/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.alee.utils;

import com.alee.api.annotations.NotNull;
import com.alee.api.annotations.Nullable;
import com.alee.managers.language.LM;
import com.alee.managers.proxy.ProxyManager;
import com.alee.utils.compare.Filter;
Expand All @@ -38,9 +40,12 @@
import java.awt.event.ActionListener;
import java.io.*;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.FileChannel;
import java.security.CodeSource;
import java.security.MessageDigest;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -211,6 +216,50 @@ private FileUtils ()
throw new UtilityException ( "Utility classes are not meant to be instantiated" );
}

/**
* Returns JAR location URL for the specified class.
*
* @param jarClass any class from that JAR
* @return JAR location URL
*/
@Nullable
public static URL getJarLocationURL ( @NotNull final Class jarClass )
{
final CodeSource src = jarClass.getProtectionDomain ().getCodeSource ();
return src != null ? src.getLocation () : null;
}

/**
* Returns JAR location File for the specified class.
*
* @param jarClass any class from that JAR
* @return JAR location File
*/
@Nullable
public static File getJarLocationFile ( @NotNull final Class jarClass )
{
File file = null;
try
{
final CodeSource src = jarClass.getProtectionDomain ().getCodeSource ();
if ( src != null )
{
final URL jarUrl = src.getLocation ();
final URI uri = jarUrl.toURI ();
final String scheme = uri.getScheme ();
if ( scheme != null && scheme.equalsIgnoreCase ( "file" ) )
{
file = new File ( uri );
}
}
}
catch ( final URISyntaxException e )
{
LoggerFactory.getLogger ( FileUtils.class ).error ( e.toString (), e );
}
return file;
}

/**
* Clears all caches for specified files.
*
Expand Down Expand Up @@ -917,7 +966,8 @@ public static boolean isParent ( final File parent, File child )
* @param file file to process
* @return file name without extension
*/
public static String getFileNamePart ( final File file )
@NotNull
public static String getFileNamePart ( @Nullable final File file )
{
return file != null ? getFileNamePart ( file.getName () ) : "";
}
Expand All @@ -928,18 +978,21 @@ public static String getFileNamePart ( final File file )
* @param name file name to trim
* @return file name without extension
*/
public static String getFileNamePart ( final String name )
@NotNull
public static String getFileNamePart ( @Nullable final String name )
{
final String namePart;
if ( !TextUtils.isEmpty ( name ) )
{
final int first = name.indexOf ( "." );
final int last = name.lastIndexOf ( "." );
return last == -1 || first == 0 && first == last ? name : name.substring ( 0, last );
namePart = last == -1 || first == 0 && first == last ? name : name.substring ( 0, last );
}
else
{
return "";
namePart = "";
}
return namePart;
}

/**
Expand All @@ -949,7 +1002,8 @@ public static String getFileNamePart ( final String name )
* @param withDot whether return the extension with dot, or not
* @return file extension
*/
public static String getFileExtPart ( final File file, final boolean withDot )
@NotNull
public static String getFileExtPart ( @Nullable final File file, final boolean withDot )
{
return file != null ? getFileExtPart ( file.getName (), withDot ) : "";
}
Expand All @@ -961,17 +1015,20 @@ public static String getFileExtPart ( final File file, final boolean withDot )
* @param withDot whether return the extension with dot, or not
* @return file extension
*/
public static String getFileExtPart ( final String name, final boolean withDot )
@NotNull
public static String getFileExtPart ( @Nullable final String name, final boolean withDot )
{
final String ext;
if ( !TextUtils.isEmpty ( name ) )
{
final int i = name.lastIndexOf ( "." );
return i == -1 ? "" : withDot ? name.substring ( i ) : name.substring ( i + 1 );
ext = i == -1 ? "" : withDot ? name.substring ( i ) : name.substring ( i + 1 );
}
else
{
return "";
ext = "";
}
return ext;
}

/**
Expand All @@ -980,7 +1037,8 @@ public static String getFileExtPart ( final String name, final boolean withDot )
* @param name file name to shorten
* @return shortened file name
*/
public static String getShortFileName ( final String name )
@NotNull
public static String getShortFileName ( @Nullable final String name )
{
return getShortFileName ( name, 30 );
}
Expand All @@ -993,25 +1051,19 @@ public static String getShortFileName ( final String name )
* @param length maximum allowed file name length
* @return shortened file name
*/
public static String getShortFileName ( final String name, final int length )
@NotNull
public static String getShortFileName ( @Nullable final String name, final int length )
{
if ( length < 2 )
{
return name;
}
else
String shortName = name != null ? name : "";
if ( length >= 2 )
{
final String newName = getFileNamePart ( name );
if ( newName.length () > length )
{
// 2 symbols taken by dots
return newName.substring ( 0, length - 2 ) + "..." + getFileExtPart ( name, false );
}
else
{
return name;
shortName = newName.substring ( 0, length - 2 ) + "..." + getFileExtPart ( name, false );
}
}
return shortName;
}

/**
Expand Down
Loading

0 comments on commit 6f751e7

Please sign in to comment.