msg
Class ProteinMatrix

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by msg.ProteinMatrix
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ProteinMatrix
extends javax.swing.JPanel

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProteinMatrix(Msg_panel alles, int wWidth, int wHeight)
          Initializes a new ProteinMatrix.
 
Method Summary
 void addElement(ProteinElement newElement)
          Adds a ProteinElement.
 void calculateMatrixStartSize(int panelWidth, int panelHeight, int matrixWidth, int matrixHeight)
          Calculates the start size of the lipid matrix.
 int calculateProteinNumber()
          Calculates the number of Proteins.
 int calculateQuantityIntValue(int quantity, int sizeX, int sizeY)
          Calculates the quantity value of a ProteinElement in the lipid matrix.
 void calculateRatio(int wH, int wW, int mH, int mW)
          Calculates the ratio of a singe lipid according to the panel size.
 void changeBusyCords(int x1, int y1, int x2, int y2, int sizeX, int sizeY)
          Changes the busy coordinates in the lipid matrix.
 void changeElements()
          Change the properties of the component.
 void changeKey(java.lang.String oldKey, java.lang.String newKey)
          Change the key of all elements that belong to the old key.
 void changeResize()
          Changes the component if the window is resized.
 void changeZoomDefault()
          Change the size of the component to fit the size of the panel.
 void changeZoomIn()
          Change the size of the component to zoom in.
 void changeZoomOut()
          Change the size of the component to zoom out.
 boolean checkRotate(int angle)
          Checks if the ProteinElement is rotated with 90° or 270°.
 void clearCords()
          Clear the busy coordinates in the lipid matrix.
 boolean createElements()
          Creates the new ProteinElements components.
 void createProgBar()
          Creates and initializes a MatrixProgressBar.
 void deleteKey(java.lang.String key)
          Delete the key of an elements that had been deleted.
 void deleteProgBar()
          Deletes a MatrixProgressBar.
 int[] generateCoordinates(int sizeX, int sizeY)
          Generate the coordinates for the ProteinElement on the lipid matrix.
 void generateLoaded()
          Generates the ProteinElements loaded with an XML file.
 void generateMatrix(int wWidth, int wHeight)
          Generate the matrix of the lipids and executes the calculateRatio() function.
 void generateNew()
          Generates new ProteinElement objects and add them to this panel.
 Msg_panel getAlles()
           
 java.util.Hashtable getBusy()
           
 java.awt.Color getColorBackground()
           
 java.lang.String[] getElement(int i)
          Returns the element at index i.
 java.util.Vector getElementList()
           
 int getMatrixHeight()
           
 int getMatrixWidth()
           
 int getMaxTry()
           
 MembranModel getMembranModel()
           
 int getMHeight()
           
 int getMWidth()
           
 int getMZoom()
           
 int getMZoomFactor()
           
 MatrixProgressBar getProgbar()
           
 int getRatioHeight()
           
 int getRatioWidth()
           
 int getResizeValue()
           
 int getWHeight()
           
 int getWWidth()
           
 boolean isDebugModus()
           
 boolean loadElements()
          Creates the new ProteinElements components when an XML file is loaded.
 void paintComponent(java.awt.Graphics g)
          Paints the component.
 void printCords()
          Prints the lipid matrix to the STDOUT.
 void removeBusyCords(int x, int y, int sizeX, int sizeY)
          Removes the busy coordinates in the lipid matrix.
 void saveCurrentStatus()
          Save the current status with all its components and their properties.
 void setAlles(Msg_panel alles)
           
 void setBusy(java.util.Hashtable busy)
           
 void setBusyCords(int x, int y, int sizeX, int sizeY)
          Set the busy coordinates in the lipid matrix.
 void setColorBackground(java.awt.Color colorBackground)
           
 void setDebugModus(boolean debugModus)
           
 void setElementList(java.util.Vector elementList)
           
 void setMaxTry(int maxTry)
           
 void setMembranModel(MembranModel membranModel)
           
 void setMHeight(int height)
           
 void setMWidth(int width)
           
 void setMZoom(int zoom)
           
 void setMZoomFactor(int zoomFactor)
           
 void setProgbar(MatrixProgressBar progbar)
           
 void setRatioHeight(int ratioHeight)
           
 void setRatioWidth(int ratioWidth)
           
 void setResizeValue(int resizeValue)
           
 void setWHeight(int height)
           
 void setWWidth(int width)
           
 boolean testCords(int x, int y, int sizeX, int sizeY)
          Test if the protein do not overlap with the busy coordinates in the lipid matrix.
 boolean testSpace()
          Checks if the proteins could be placed all on the lipid matrix.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProteinMatrix

public ProteinMatrix(Msg_panel alles,
                     int wWidth,
                     int wHeight)
Initializes a new ProteinMatrix. Execute the calculateMatrixStartSize() and the generateMatrix() functions.

Parameters:
alles - Msg_panel
wWidth - int (panel width)
wHeight - int (panel height)
Method Detail

generateMatrix

public void generateMatrix(int wWidth,
                           int wHeight)
Generate the matrix of the lipids and executes the calculateRatio() function.

Parameters:
wWidth - int (panel width)
wHeight - int (panel height)

changeElements

public void changeElements()
Change the properties of the component. These properties are the size, location and ratio.


changeResize

public void changeResize()
Changes the component if the window is resized.


changeZoomIn

public void changeZoomIn()
Change the size of the component to zoom in.


changeZoomOut

public void changeZoomOut()
Change the size of the component to zoom out.


changeZoomDefault

public void changeZoomDefault()
Change the size of the component to fit the size of the panel.


saveCurrentStatus

public void saveCurrentStatus()
Save the current status with all its components and their properties.


changeKey

public void changeKey(java.lang.String oldKey,
                      java.lang.String newKey)
Change the key of all elements that belong to the old key.

Parameters:
oldKey - String
newKey - String

deleteKey

public void deleteKey(java.lang.String key)
Delete the key of an elements that had been deleted.

Parameters:
key - String

calculateMatrixStartSize

public void calculateMatrixStartSize(int panelWidth,
                                     int panelHeight,
                                     int matrixWidth,
                                     int matrixHeight)
Calculates the start size of the lipid matrix.

Parameters:
panelWidth - int (panel width)
panelHeight - int (panel height)
matrixWidth - int (lipid matrix width)
matrixHeight - int (lipid matrix height)

generateNew

public void generateNew()
Generates new ProteinElement objects and add them to this panel.


generateLoaded

public void generateLoaded()
Generates the ProteinElements loaded with an XML file.


calculateProteinNumber

public int calculateProteinNumber()
Calculates the number of Proteins.

Returns:
int (number of proteins)

createElements

public boolean createElements()
Creates the new ProteinElements components.

Returns:
boolean (true, if no errors occur)

loadElements

public boolean loadElements()
Creates the new ProteinElements components when an XML file is loaded.

Returns:
boolean (true, if no errors occur)

checkRotate

public boolean checkRotate(int angle)
Checks if the ProteinElement is rotated with 90° or 270°.

Parameters:
angle - int
Returns:
boolean

calculateQuantityIntValue

public int calculateQuantityIntValue(int quantity,
                                     int sizeX,
                                     int sizeY)
Calculates the quantity value of a ProteinElement in the lipid matrix.

Parameters:
quantity - int
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)
Returns:
int

createProgBar

public void createProgBar()
Creates and initializes a MatrixProgressBar.


deleteProgBar

public void deleteProgBar()
Deletes a MatrixProgressBar.


paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the component.

Overrides:
paintComponent in class javax.swing.JComponent

testSpace

public boolean testSpace()
Checks if the proteins could be placed all on the lipid matrix.

Returns:
boolean (true, if the proteins use less than 70% of the matrix)

generateCoordinates

public int[] generateCoordinates(int sizeX,
                                 int sizeY)
Generate the coordinates for the ProteinElement on the lipid matrix.

Parameters:
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)
Returns:
int[]

setBusyCords

public void setBusyCords(int x,
                         int y,
                         int sizeX,
                         int sizeY)
Set the busy coordinates in the lipid matrix.

Parameters:
x - int (x position in lipid matrix)
y - int (y position in lipid matrix)
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)

removeBusyCords

public void removeBusyCords(int x,
                            int y,
                            int sizeX,
                            int sizeY)
Removes the busy coordinates in the lipid matrix.

Parameters:
x - int (x position in lipid matrix)
y - int (y position in lipid matrix)
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)

changeBusyCords

public void changeBusyCords(int x1,
                            int y1,
                            int x2,
                            int y2,
                            int sizeX,
                            int sizeY)
Changes the busy coordinates in the lipid matrix.

Parameters:
x1 - int (old x position in lipid matrix)
y1 - int (old y position in lipid matrix)
x2 - int (new x position in lipid matrix)
y2 - int (new y position in lipid matrix)
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)

printCords

public void printCords()
Prints the lipid matrix to the STDOUT.


testCords

public boolean testCords(int x,
                         int y,
                         int sizeX,
                         int sizeY)
Test if the protein do not overlap with the busy coordinates in the lipid matrix.

Parameters:
x - int (x position in lipid matrix)
y - int (y position in lipid matrix)
sizeX - int (width of the protein in lipids)
sizeY - int (height of the protein in lipids)
Returns:
boolean

clearCords

public void clearCords()
Clear the busy coordinates in the lipid matrix.


calculateRatio

public void calculateRatio(int wH,
                           int wW,
                           int mH,
                           int mW)
Calculates the ratio of a singe lipid according to the panel size.

Parameters:
wH - int (window height)
wW - int (window width)
mH - int (matrix height)
mW - int (matrix width)

getMatrixHeight

public int getMatrixHeight()
Returns:
Returns the matrix height.

getMatrixWidth

public int getMatrixWidth()
Returns:
Returns the matrix width.

addElement

public void addElement(ProteinElement newElement)
Adds a ProteinElement.

Parameters:
newElement - ProteinElement

getElement

public java.lang.String[] getElement(int i)
Returns the element at index i.

Parameters:
i - int
Returns:
String[]

getRatioWidth

public int getRatioWidth()
Returns:
Returns the ratioWidth.

getAlles

public Msg_panel getAlles()
Returns:
Returns the alles.

setAlles

public void setAlles(Msg_panel alles)
Parameters:
alles - The alles to set.

getBusy

public java.util.Hashtable getBusy()
Returns:
Returns the busy.

setBusy

public void setBusy(java.util.Hashtable busy)
Parameters:
busy - The busy to set.

getColorBackground

public java.awt.Color getColorBackground()
Returns:
Returns the colorBackground.

setColorBackground

public void setColorBackground(java.awt.Color colorBackground)
Parameters:
colorBackground - The colorBackground to set.

isDebugModus

public boolean isDebugModus()
Returns:
Returns the debugModus.

setDebugModus

public void setDebugModus(boolean debugModus)
Parameters:
debugModus - The debugModus to set.

getElementList

public java.util.Vector getElementList()
Returns:
Returns the elementList.

setElementList

public void setElementList(java.util.Vector elementList)
Parameters:
elementList - The elementList to set.

getMaxTry

public int getMaxTry()
Returns:
Returns the maxTry.

setMaxTry

public void setMaxTry(int maxTry)
Parameters:
maxTry - The maxTry to set.

getMembranModel

public MembranModel getMembranModel()
Returns:
Returns the membranModel.

setMembranModel

public void setMembranModel(MembranModel membranModel)
Parameters:
membranModel - The membranModel to set.

getMHeight

public int getMHeight()
Returns:
Returns the mHeight.

setMHeight

public void setMHeight(int height)
Parameters:
height - The mHeight to set.

getMWidth

public int getMWidth()
Returns:
Returns the mWidth.

setMWidth

public void setMWidth(int width)
Parameters:
width - The mWidth to set.

getMZoom

public int getMZoom()
Returns:
Returns the mZoom.

setMZoom

public void setMZoom(int zoom)
Parameters:
zoom - The mZoom to set.

getMZoomFactor

public int getMZoomFactor()
Returns:
Returns the mZoomFactor.

setMZoomFactor

public void setMZoomFactor(int zoomFactor)
Parameters:
zoomFactor - The mZoomFactor to set.

getProgbar

public MatrixProgressBar getProgbar()
Returns:
Returns the progbar.

setProgbar

public void setProgbar(MatrixProgressBar progbar)
Parameters:
progbar - The progbar to set.

getRatioHeight

public int getRatioHeight()
Returns:
Returns the ratioHeight.

setRatioHeight

public void setRatioHeight(int ratioHeight)
Parameters:
ratioHeight - The ratioHeight to set.

setRatioWidth

public void setRatioWidth(int ratioWidth)
Parameters:
ratioWidth - The ratioWidth to set.

getResizeValue

public int getResizeValue()
Returns:
Returns the resizeValue.

setResizeValue

public void setResizeValue(int resizeValue)
Parameters:
resizeValue - The resizeValue to set.

getWHeight

public int getWHeight()
Returns:
Returns the wHeight.

setWHeight

public void setWHeight(int height)
Parameters:
height - The wHeight to set.

getWWidth

public int getWWidth()
Returns:
Returns the wWidth.

setWWidth

public void setWWidth(int width)
Parameters:
width - The wWidth to set.