Package org.compiere.model
Class MAssignmentSlot
- java.lang.Object
-
- org.compiere.model.MAssignmentSlot
-
- All Implemented Interfaces:
Comparator<Object>
public class MAssignmentSlot extends Object implements Comparator<Object>
Assignment Slot. Display Information about Assignment Slot- Version:
- $Id: MAssignmentSlot.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
- Author:
- Jorg Janke
-
-
Field Summary
Fields Modifier and Type Field Description static int
DISPLAY_ALL
toString displays everythingstatic int
DISPLAY_DATETIME_FROM_TO
toString displays formatted day time from-tostatic int
DISPLAY_FULL
toString displays formatted all infostatic int
DISPLAY_NAME
toString displays namestatic int
DISPLAY_NAME_DESCRIPTION
toString displays name and optional descriptionstatic int
DISPLAY_TIME_FROM
toString displays formatted time fromstatic int
DISPLAY_TIME_FROM_TO
toString displays formatted time from-tostatic int
STATUS_Confirmed
Assignment Codestatic int
STATUS_NonBusinessDay
Not Available Codestatic int
STATUS_NotAvailable
Not Available Codestatic int
STATUS_NotConfirmed
Assignment Codestatic int
STATUS_NotInSlotDay
Not Available Codestatic int
STATUS_NotInSlotTime
Not Available Codestatic int
STATUS_TimeSlot
Assignment Codestatic int
STATUS_UnAvailable
Not Available Code
-
Constructor Summary
Constructors Constructor Description MAssignmentSlot()
Comparator ConstructorMAssignmentSlot(long startTime, long endTime)
Timeslot ConstructorMAssignmentSlot(Timestamp startTime, Timestamp endTime)
Timeslot ConstructorMAssignmentSlot(Timestamp startTime, Timestamp endTime, String name, String description, int status)
Non Assignment ConstructorMAssignmentSlot(MResourceAssignment assignment)
Assignment Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Object o1, Object o2)
Compares its two arguments for order.boolean
equals(Object obj)
Indicates whether some other object is "equal to" this Comparator.Color
getColor(boolean background)
Get Color for StatusString
getDescription()
Get DescriptionTimestamp
getEndTime()
Get End timeString
getInfo()
Get Info with Date, Time From-To Name DescriptionString
getInfoDateTimeFromTo()
Get Info with Date and Time From-ToString
getInfoNameDescription()
Get Info with Name and optional DescriptionString
getInfoTimeFrom()
Get Info with Time FromString
getInfoTimeFromTo()
Get Info with Time From-ToMResourceAssignment
getMAssignment()
Get AssugnmentString
getName()
Get NameTimestamp
getStartTime()
Get Start timeint
getStatus()
Get Statusint
getXMax()
Get X columnsint
getXPos()
Get X positionint
getYEnd()
Get Y end positionint
getYStart()
Get Y start positionint
hashCode()
HashCode of MAssignmentSlotboolean
inSlot(Timestamp time, boolean endTime)
Returns true if time is between start and end Time.boolean
isAssignment()
Is the Slot an Assignment?void
setDescription(String description)
Set Descriptionvoid
setDisplay(int displayMode)
Set Display Mode of toString()void
setEndTime(Timestamp endTime)
Set End timevoid
setLanguage(Language language)
Set Languagevoid
setMAssignment(MResourceAssignment assignment)
Set Assignmentvoid
setName(String name)
Set Namevoid
setStartTime(Timestamp startTime)
Set Start timevoid
setStatus(int status)
Set Statusvoid
setX(int xPos, int xMax)
Set X positionvoid
setY(int yStart, int yEnd)
Set Y positionString
toString()
String representation-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
STATUS_NotAvailable
public static final int STATUS_NotAvailable
Not Available Code- See Also:
- Constant Field Values
-
STATUS_UnAvailable
public static final int STATUS_UnAvailable
Not Available Code- See Also:
- Constant Field Values
-
STATUS_NonBusinessDay
public static final int STATUS_NonBusinessDay
Not Available Code- See Also:
- Constant Field Values
-
STATUS_NotInSlotDay
public static final int STATUS_NotInSlotDay
Not Available Code- See Also:
- Constant Field Values
-
STATUS_NotInSlotTime
public static final int STATUS_NotInSlotTime
Not Available Code- See Also:
- Constant Field Values
-
STATUS_NotConfirmed
public static final int STATUS_NotConfirmed
Assignment Code- See Also:
- Constant Field Values
-
STATUS_Confirmed
public static final int STATUS_Confirmed
Assignment Code- See Also:
- Constant Field Values
-
STATUS_TimeSlot
public static final int STATUS_TimeSlot
Assignment Code- See Also:
- Constant Field Values
-
DISPLAY_ALL
public static final int DISPLAY_ALL
toString displays everything- See Also:
- Constant Field Values
-
DISPLAY_TIME_FROM
public static final int DISPLAY_TIME_FROM
toString displays formatted time from- See Also:
- Constant Field Values
-
DISPLAY_TIME_FROM_TO
public static final int DISPLAY_TIME_FROM_TO
toString displays formatted time from-to- See Also:
- Constant Field Values
-
DISPLAY_DATETIME_FROM_TO
public static final int DISPLAY_DATETIME_FROM_TO
toString displays formatted day time from-to- See Also:
- Constant Field Values
-
DISPLAY_NAME
public static final int DISPLAY_NAME
toString displays name- See Also:
- Constant Field Values
-
DISPLAY_NAME_DESCRIPTION
public static final int DISPLAY_NAME_DESCRIPTION
toString displays name and optional description- See Also:
- Constant Field Values
-
DISPLAY_FULL
public static final int DISPLAY_FULL
toString displays formatted all info- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MAssignmentSlot
public MAssignmentSlot()
Comparator Constructor
-
MAssignmentSlot
public MAssignmentSlot(Timestamp startTime, Timestamp endTime)
Timeslot Constructor- Parameters:
startTime
- start timeendTime
- end time
-
MAssignmentSlot
public MAssignmentSlot(long startTime, long endTime)
Timeslot Constructor- Parameters:
startTime
- start timeendTime
- end time
-
MAssignmentSlot
public MAssignmentSlot(Timestamp startTime, Timestamp endTime, String name, String description, int status)
Non Assignment Constructor- Parameters:
startTime
- start timeendTime
- end timename
- namedescription
- descriptionstatus
- status
-
MAssignmentSlot
public MAssignmentSlot(MResourceAssignment assignment)
Assignment Constructor- Parameters:
assignment
- MAssignment
-
-
Method Detail
-
setStatus
public void setStatus(int status)
Set Status- Parameters:
status
- STATUS_..
-
getStatus
public int getStatus()
Get Status- Returns:
- STATUS_..
-
isAssignment
public boolean isAssignment()
Is the Slot an Assignment?- Returns:
- true if slot is an assignment
-
getColor
public Color getColor(boolean background)
Get Color for Status- Parameters:
background
- true if background - or foreground- Returns:
- Color
-
getStartTime
public Timestamp getStartTime()
Get Start time- Returns:
- start time
-
setStartTime
public void setStartTime(Timestamp startTime)
Set Start time- Parameters:
startTime
- start time, if null use current time
-
getEndTime
public Timestamp getEndTime()
Get End time- Returns:
- end time
-
setEndTime
public void setEndTime(Timestamp endTime)
Set End time- Parameters:
endTime
- end time, if null use start time
-
setMAssignment
public void setMAssignment(MResourceAssignment assignment)
Set Assignment- Parameters:
assignment
- MAssignment
-
getMAssignment
public MResourceAssignment getMAssignment()
Get Assugnment- Returns:
- assignment
-
setName
public void setName(String name)
Set Name- Parameters:
name
- name
-
getName
public String getName()
Get Name- Returns:
- name
-
setDescription
public void setDescription(String description)
Set Description- Parameters:
description
- description
-
getDescription
public String getDescription()
Get Description- Returns:
- description
-
setY
public void setY(int yStart, int yEnd)
Set Y position- Parameters:
yStart
- zero based Y start indexyEnd
- zero based Y end index
-
getYStart
public int getYStart()
Get Y start position- Returns:
- zero based Y start index
-
getYEnd
public int getYEnd()
Get Y end position- Returns:
- zero based Y end index
-
setX
public void setX(int xPos, int xMax)
Set X position- Parameters:
xPos
- zero based X position indexxMax
- number of parallel columns
-
getXPos
public int getXPos()
Get X position- Returns:
- zero based X position index
-
getXMax
public int getXMax()
Get X columns- Returns:
- number of parallel columns
-
setLanguage
public void setLanguage(Language language)
Set Language- Parameters:
language
- language
-
setDisplay
public void setDisplay(int displayMode)
Set Display Mode of toString()- Parameters:
displayMode
- DISPLAY_
-
toString
public String toString()
String representation
-
getInfoTimeFrom
public String getInfoTimeFrom()
Get Info with Time From- Returns:
- info 00:00
-
getInfoTimeFromTo
public String getInfoTimeFromTo()
Get Info with Time From-To- Returns:
- info 00:00 - 01:00
-
getInfoDateTimeFromTo
public String getInfoDateTimeFromTo()
Get Info with Date and Time From-To- Returns:
- info 12/12/01 00:00 - 01:00 or 12/12/01 00:00 - 12/13/01 01:00
-
getInfoNameDescription
public String getInfoNameDescription()
Get Info with Name and optional Description- Returns:
- Name (Description)
-
getInfo
public String getInfo()
Get Info with Date, Time From-To Name Description- Returns:
- 12/12/01 00:00 - 01:00: Name (Description)
-
inSlot
public boolean inSlot(Timestamp time, boolean endTime)
Returns true if time is between start and end Time. Date part is ignored.Example: - Slots: 0:00-9:00 - 9:00-10:00 - 10:00-11:00 - ... - inSlot (9:00, false) -> 1 // start time - inSlot (10:00, true) -> 1 // end time
- Parameters:
time
- time of the dayendTime
- if true, the end time is included- Returns:
- true if within slot
-
compare
public int compare(Object o1, Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Specified by:
compare
in interfaceComparator<Object>
- Parameters:
o1
- the first object to be compared.o2
- the second object to be compared.- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
- Throws:
ClassCastException
- if the arguments' types prevent them from being compared by this Comparator.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this Comparator.- Specified by:
equals
in interfaceComparator<Object>
- Overrides:
equals
in classObject
- Parameters:
obj
- the reference object with which to compare.- Returns:
true
only if the specified object is also a comparator and it imposes the same ordering as this comparator.- See Also:
Object.equals(java.lang.Object)
,Object.hashCode()
-
-