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 intDISPLAY_ALLtoString displays everythingstatic intDISPLAY_DATETIME_FROM_TOtoString displays formatted day time from-tostatic intDISPLAY_FULLtoString displays formatted all infostatic intDISPLAY_NAMEtoString displays namestatic intDISPLAY_NAME_DESCRIPTIONtoString displays name and optional descriptionstatic intDISPLAY_TIME_FROMtoString displays formatted time fromstatic intDISPLAY_TIME_FROM_TOtoString displays formatted time from-tostatic intSTATUS_ConfirmedAssignment Codestatic intSTATUS_NonBusinessDayNot Available Codestatic intSTATUS_NotAvailableNot Available Codestatic intSTATUS_NotConfirmedAssignment Codestatic intSTATUS_NotInSlotDayNot Available Codestatic intSTATUS_NotInSlotTimeNot Available Codestatic intSTATUS_TimeSlotAssignment Codestatic intSTATUS_UnAvailableNot 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 intcompare(Object o1, Object o2)Compares its two arguments for order.booleanequals(Object obj)Indicates whether some other object is "equal to" this Comparator.ColorgetColor(boolean background)Get Color for StatusStringgetDescription()Get DescriptionTimestampgetEndTime()Get End timeStringgetInfo()Get Info with Date, Time From-To Name DescriptionStringgetInfoDateTimeFromTo()Get Info with Date and Time From-ToStringgetInfoNameDescription()Get Info with Name and optional DescriptionStringgetInfoTimeFrom()Get Info with Time FromStringgetInfoTimeFromTo()Get Info with Time From-ToMResourceAssignmentgetMAssignment()Get AssugnmentStringgetName()Get NameTimestampgetStartTime()Get Start timeintgetStatus()Get StatusintgetXMax()Get X columnsintgetXPos()Get X positionintgetYEnd()Get Y end positionintgetYStart()Get Y start positioninthashCode()HashCode of MAssignmentSlotbooleaninSlot(Timestamp time, boolean endTime)Returns true if time is between start and end Time.booleanisAssignment()Is the Slot an Assignment?voidsetDescription(String description)Set DescriptionvoidsetDisplay(int displayMode)Set Display Mode of toString()voidsetEndTime(Timestamp endTime)Set End timevoidsetLanguage(Language language)Set LanguagevoidsetMAssignment(MResourceAssignment assignment)Set AssignmentvoidsetName(String name)Set NamevoidsetStartTime(Timestamp startTime)Set Start timevoidsetStatus(int status)Set StatusvoidsetX(int xPos, int xMax)Set X positionvoidsetY(int yStart, int yEnd)Set Y positionStringtoString()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:
comparein 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:
equalsin interfaceComparator<Object>- Overrides:
equalsin classObject- Parameters:
obj- the reference object with which to compare.- Returns:
trueonly 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()
-
-