Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.sleuthkit.autopsy.guiutils.WrapLayout Class Reference

Inherits LayoutManager, and Serializable.

Classes

class  ParentDimensions
 
class  WrapLayoutRow
 

Public Member Functions

 WrapLayout ()
 
 WrapLayout (int verticalGap, int horizontalGap)
 
void addLayoutComponent (String name, Component comp)
 
int getHorizontalGap ()
 
Collection< Component > getOppositeAlignedItems ()
 
int getVerticalGap ()
 
boolean isAlignOnBaseline ()
 
void layoutContainer (Container target)
 
Dimension minimumLayoutSize (Container target)
 
Dimension preferredLayoutSize (Container target)
 
void removeLayoutComponent (Component comp)
 
void setAlignOnBaseline (boolean alignOnBaseline)
 
void setHorizontalGap (int horizontalGap)
 
void setOppositeAligned (Collection< Component > oppAlignedComponents)
 
void setVerticalGap (int verticalGap)
 

Private Member Functions

List< WrapLayoutRowgetAllRows (List< Component > components, boolean preferred, int maxWidth)
 
int getComponentX (int leftX, int rightX, boolean ltr, int xPos, int componentWidth)
 
int getComponentY (int rowY, boolean alignBaseline, int rowHeight, int itemHeight)
 
List< WrapLayoutRowgetRowSet (List< Component > components, boolean preferred, int maxWidth)
 
ParentDimensions getTargetDimensions (Container target)
 
Dimension layoutSize (Container target, boolean preferred)
 
int setComponentDims (Component comp, boolean alignBaseline, boolean ltr, int rowY, int rowHeight, int leftX, int rightX, int xPos)
 

Private Attributes

boolean alignOnBaseline = false
 
int horizontalGap = 0
 
final Set< Component > oppositeAlignedItems = new HashSet<>()
 
int verticalGap = 0
 

Static Private Attributes

static final long serialVersionUID = 1L
 

Detailed Description

A wrap layout, similar to flow layout, orders subcomponents in a horizontal row similar to words in a paragraph. When subcomponents are moved to a new row, the height of the target component is expanded to accomodate. This layout also accomodates simultaneously left-aligned and right-aligned components.

Inspired by Rob Camick's WrapLayout https://tips4java.wordpress.com/2008/11/06/wrap-layout/ and FlowLayout https://raw.githubusercontent.com/mynawang/Java8-Source-Code/master/src/main/jdk8/java/awt/FlowLayout.java.

Definition at line 48 of file WrapLayout.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.guiutils.WrapLayout.WrapLayout ( )

Constructs a new WrapLayout with a default 5-unit horizontal and vertical gap.

Definition at line 88 of file WrapLayout.java.

org.sleuthkit.autopsy.guiutils.WrapLayout.WrapLayout ( int  verticalGap,
int  horizontalGap 
)

Constructs a new WrapLayout.

Parameters
verticalGapThe vertical gap spacing between rows of subcomponents as well as the spacing between the target component and rows.
horizontalGapThe horizontal gap spacing between neighboring subcomponents as well as the spacing between the subcomponents and the target component's border.

Definition at line 102 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.horizontalGap, and org.sleuthkit.autopsy.guiutils.WrapLayout.verticalGap.

Member Function Documentation

void org.sleuthkit.autopsy.guiutils.WrapLayout.addLayoutComponent ( String  name,
Component  comp 
)

Adds the specified component to the layout. Not used by this class. NOTE: This method is not used by this layout.

Parameters
nameThe name of the component.
compThe component to be added.

Definition at line 210 of file WrapLayout.java.

List<WrapLayoutRow> org.sleuthkit.autopsy.guiutils.WrapLayout.getAllRows ( List< Component >  components,
boolean  preferred,
int  maxWidth 
)
private

Retrieves the rows of wrap layout components.

Parameters
componentsThe components to be laid out.
preferredWhether or not to use preferred dimensions of subcomponents for determining rows.
maxWidthThe maximum width that a row can consume.
Returns
The list of rows ordered from top to bottom.

Definition at line 541 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap(), and org.sleuthkit.autopsy.guiutils.WrapLayout.getRowSet().

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer(), and org.sleuthkit.autopsy.guiutils.WrapLayout.layoutSize().

int org.sleuthkit.autopsy.guiutils.WrapLayout.getComponentX ( int  leftX,
int  rightX,
boolean  ltr,
int  xPos,
int  componentWidth 
)
private
  • Determines the subcomponent's x position.
Parameters
leftXThe leftmost position a component can be placed.
rightXThe rightmost position a component can be placed.
ltrIf the components should be laid out left to right.
xPosThe x position of the component (if left to right, how far from leftX; otherwise how far from rightX).
componentWidthThe component's width.
Returns
The component's left x position.

Definition at line 255 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.setComponentDims().

int org.sleuthkit.autopsy.guiutils.WrapLayout.getComponentY ( int  rowY,
boolean  alignBaseline,
int  rowHeight,
int  itemHeight 
)
private

Determines the subcomponent's y position.

Parameters
rowYThe top y position of the row.
alignBaselineWhether this component should be aligned on the baseline.
rowHeightThe height of the row.
itemHeightThe height of the item.
Returns
The top y position of the component.

Definition at line 236 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.setComponentDims().

int org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap ( )

Retrieves the horizontal gap between neighboring subcomponents as well as the spacing between subcomponents and the borders of the target component.

Returns
The horizontal gap between components and between the components and the borders of the Container.

Definition at line 139 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.horizontalGap.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.getAllRows(), org.sleuthkit.autopsy.guiutils.WrapLayout.getRowSet(), org.sleuthkit.autopsy.guiutils.WrapLayout.getTargetDimensions(), org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer(), org.sleuthkit.autopsy.guiutils.WrapLayout.layoutSize(), and org.sleuthkit.autopsy.guiutils.WrapLayout.minimumLayoutSize().

Collection<Component> org.sleuthkit.autopsy.guiutils.WrapLayout.getOppositeAlignedItems ( )

Retrieves the set of components that will be aligned on the opposite side. If the target component's orientation is left to right, this set of components will be right aligned.

Returns
The components that will be aligned on the opposite side.

Definition at line 127 of file WrapLayout.java.

List<WrapLayoutRow> org.sleuthkit.autopsy.guiutils.WrapLayout.getRowSet ( List< Component >  components,
boolean  preferred,
int  maxWidth 
)
private

Handles determining rows for a single set of similarly aligned components. Used once for normal alignment and once for opposite aligned components.

Parameters
componentsThe components in the set of similarly aligned items.
preferredWhether or not to use preferred dimensions for components.
maxWidthThe maximum width components can consume.
Returns
The list of rows determined.

Definition at line 605 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap().

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.getAllRows().

ParentDimensions org.sleuthkit.autopsy.guiutils.WrapLayout.getTargetDimensions ( Container  target)
private

Derives metrics on the space allowed within the parent container for rows of components.

Parameters
targetThe target container.
Returns
The dimensions for laying out components.

Definition at line 398 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap().

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer(), and org.sleuthkit.autopsy.guiutils.WrapLayout.layoutSize().

int org.sleuthkit.autopsy.guiutils.WrapLayout.getVerticalGap ( )

Retrieves the vertical gap between neighboring rows as well as the spacing between rows and the borders of the target component.

Returns
The vertical gap between components and between the components and the borders of the Container.

Definition at line 162 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.verticalGap.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer(), and org.sleuthkit.autopsy.guiutils.WrapLayout.layoutSize().

boolean org.sleuthkit.autopsy.guiutils.WrapLayout.isAlignOnBaseline ( )

Returns true if components are to be vertically aligned along their bottom edge. Otherwise, subcomponents are aligned on their top edge. The default is false.

Returns
If components are to be vertically aligned along their bottom edge.

Definition at line 198 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.alignOnBaseline.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer().

void org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer ( Container  target)
Dimension org.sleuthkit.autopsy.guiutils.WrapLayout.layoutSize ( Container  target,
boolean  preferred 
)
private

Returns the minimum or preferred dimension needed to layout the target container.

Parameters
targetTarget to get layout size for.
preferredShould preferred size be calculated.
Returns
The dimension to layout the target container.

Definition at line 427 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.getAllRows(), org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap(), org.sleuthkit.autopsy.guiutils.WrapLayout.getTargetDimensions(), and org.sleuthkit.autopsy.guiutils.WrapLayout.getVerticalGap().

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.minimumLayoutSize(), and org.sleuthkit.autopsy.guiutils.WrapLayout.preferredLayoutSize().

Dimension org.sleuthkit.autopsy.guiutils.WrapLayout.minimumLayoutSize ( Container  target)
Dimension org.sleuthkit.autopsy.guiutils.WrapLayout.preferredLayoutSize ( Container  target)
void org.sleuthkit.autopsy.guiutils.WrapLayout.removeLayoutComponent ( Component  comp)

Removes the specified component from the layout. Not used by this class. NOTE: This method is not used by this layout.

Parameters
compThe component to remove.

Definition at line 221 of file WrapLayout.java.

void org.sleuthkit.autopsy.guiutils.WrapLayout.setAlignOnBaseline ( boolean  alignOnBaseline)

Sets whether or not subcomponents should be vertically aligned along their bottom edge. Otherwise, subcomponents are aligned on their top edge. The default is false.

Parameters
alignOnBaselineWhether or not components should be vertically aligned on their bottom edge.

Definition at line 186 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.alignOnBaseline.

int org.sleuthkit.autopsy.guiutils.WrapLayout.setComponentDims ( Component  comp,
boolean  alignBaseline,
boolean  ltr,
int  rowY,
int  rowHeight,
int  leftX,
int  rightX,
int  xPos 
)
private

Sets a subcomponent's size to preferred size and sets the (x,y) position for the component.

Parameters
compThe component.
alignBaselineWhether this component should be aligned on the baseline.
ltrIf the components should be laid out left to right.
rowYThe top y position of the row.
rowHeightThe height of the row.
leftXThe leftmost position a component can be placed.
rightXThe rightmost position a component can be placed.
xPosThe x position of the component (if left to right, how far from leftX; otherwise how far from rightX).
Returns
The width of the component.

Definition at line 277 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.getComponentX(), and org.sleuthkit.autopsy.guiutils.WrapLayout.getComponentY().

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.layoutContainer().

void org.sleuthkit.autopsy.guiutils.WrapLayout.setHorizontalGap ( int  horizontalGap)

Sets the horizontal gap between neighboring subcomponents as well as the spacing between subcomponents and the borders of the target component.

Parameters
horizontalGapThe horizontal gap between components and between the components and the borders of the Container.

Definition at line 151 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.horizontalGap.

void org.sleuthkit.autopsy.guiutils.WrapLayout.setOppositeAligned ( Collection< Component >  oppAlignedComponents)

Sets the set of components that will be aligned on the opposite side. If the target component's orientation is left to right, this set of components will be right aligned.

Parameters
oppAlignedComponentsThe components that will be aligned on the opposite side.

Definition at line 115 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.texttranslation.ui.TranslationContentPanel.additionalInitComponents(), and org.sleuthkit.autopsy.contentviewers.textcontentviewer.StringsContentPanel.customizeComponents().

void org.sleuthkit.autopsy.guiutils.WrapLayout.setVerticalGap ( int  verticalGap)

Sets the vertical gap between neighboring rows as well as the spacing between rows and the borders of the target component.

Parameters
verticalGapThe vertical gap between components and between the components and the borders of the Container.

Definition at line 174 of file WrapLayout.java.

References org.sleuthkit.autopsy.guiutils.WrapLayout.verticalGap.

Member Data Documentation

boolean org.sleuthkit.autopsy.guiutils.WrapLayout.alignOnBaseline = false
private

If true, subcomponents will be aligned on their bottom edge. Otherwise, subcomponents are aligned on their top edge.

Definition at line 75 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.isAlignOnBaseline(), and org.sleuthkit.autopsy.guiutils.WrapLayout.setAlignOnBaseline().

int org.sleuthkit.autopsy.guiutils.WrapLayout.horizontalGap = 0
private

The horizontal gap will specify the spacing between neighboring subcomponents as well as the spacing between subcomponents and the borders of the target component.

See also
getHorizontalGap()
setHorizontalGap(int)

Definition at line 60 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.getHorizontalGap(), org.sleuthkit.autopsy.guiutils.WrapLayout.setHorizontalGap(), and org.sleuthkit.autopsy.guiutils.WrapLayout.WrapLayout().

final Set<Component> org.sleuthkit.autopsy.guiutils.WrapLayout.oppositeAlignedItems = new HashSet<>()
private

The set of components that will be aligned on the opposite side. If the target component's orientation is left to right, this set of components will be right aligned.

Definition at line 82 of file WrapLayout.java.

final long org.sleuthkit.autopsy.guiutils.WrapLayout.serialVersionUID = 1L
staticprivate

Definition at line 50 of file WrapLayout.java.

int org.sleuthkit.autopsy.guiutils.WrapLayout.verticalGap = 0
private

The vertical gap between neighboring rows as well as the spacing between rows and the borders of the target component.

See also
getVerticalGap()
setVerticalGap(int)

Definition at line 69 of file WrapLayout.java.

Referenced by org.sleuthkit.autopsy.guiutils.WrapLayout.getVerticalGap(), org.sleuthkit.autopsy.guiutils.WrapLayout.setVerticalGap(), and org.sleuthkit.autopsy.guiutils.WrapLayout.WrapLayout().


The documentation for this class was generated from the following file:

Copyright © 2012-2022 Basis Technology. Generated on: Tue Jun 27 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.