/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
*/
/**
* The panel that allows the user to specify when a task will be launched.
*
*/
{
{
sunday =
monday =
tuesday =
thursday =
friday =
saturday =
}
{
};
/**
* Default constructor.
* @param taskName the name of the task to be scheduled.
*/
{
super();
createLayout();
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
cronPanel = createCronPanel();
{
{
boolean launchLaterVisible = false;
boolean launchDailyVisible = false;
boolean launchWeeklyVisible = false;
boolean launchMonthlyVisible = false;
boolean cronVisible = false;
{
if (element instanceof CategorizedComboBoxElement)
{
}
}
}
});
launchLaterPanel.setVisible(false);
dailyPanel.setVisible(false);
weeklyPanel.setVisible(false);
monthlyPanel.setVisible(false);
cronPanel.setVisible(false);
int width = 0;
int height = 0;
{
}
}
/**
* {@inheritDoc}
*/
{
// Reset the schedule and the labels
if (visible)
{
}
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
{
}
else
{
schedule = createSchedule();
}
}
/**
* Checks the validity of the provided information and updates the provided
* collection of messages with the errors that have been found.
* @param errorMessages the collection of messages to be updated.
*/
{
if (type == LAUNCH_LATER)
{
}
else if (type == LAUNCH_DAILY)
{
}
else if (type == LAUNCH_WEEKLY)
{
}
else if (type == LAUNCH_MONTHLY)
{
}
{
}
}
/**
* Checks the validity of the launch later information and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param errorMessages the collection of messages to be updated.
*/
{
int d = -1;
int m = month.getSelectedIndex();
int[] h = {-1};
int[] min = {-1};
try
{
if ((d < 0) || (d > 31))
{
}
}
{
}
{
// Check that the actual date's month date corresponds to a valid day
// (for instance if user specifies 30th of February, the resulting date
// is 2nd (or 1st depending of the year) of Mars.
{
}
{
}
}
}
/**
* Checks the validity of the launch daily information and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param errorMessages the collection of messages to be updated.
*/
{
int[] h = {-1};
int[] min = {-1};
}
/**
* Checks the validity of the launch weekly information and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param errorMessages the collection of messages to be updated.
*/
private void updateLaunchWeeklyErrorMessages(
{
int[] h = {-1};
int[] min = {-1};
boolean oneSelected = false;
{
if (cb.isSelected())
{
oneSelected = true;
break;
}
}
if (!oneSelected)
{
}
}
/**
* Checks the validity of the launch monthly information and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param errorMessages the collection of messages to be updated.
*/
private void updateLaunchMonthlyErrorMessages(
{
int[] h = {-1};
int[] min = {-1};
boolean oneSelected = false;
{
if (cb.isSelected())
{
oneSelected = true;
break;
}
}
if (!oneSelected)
{
}
}
/**
* Checks the validity of the cron schedule information and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param errorMessages the collection of messages to be updated.
*/
{
0, 59,
0, 23,
0, 6,
1, 31,
1, 12,
}
/**
* Checks the validity of the cron schedule information tab and updates
* the provided collection of messages with the errors that have been found.
* The associated labels are also updated.
* @param value the value of the cron schedule tab.
* @param label the label associated with the cron schedule tab.
* @param errorIfEmpty the message to be displayed if the value tab is empty.
* @param contentError the message to be displayed if the value tab is not
* valid.
* @param minValue the minimum value accepted.
* @param maxValue the maximum value accepted.
* @param errorMessages the collection of messages to be updated.
*/
{
{
}
else
{
try
{
}
{
}
}
}
/**
* Returns the schedule type corresponding to the input provided by user.
* This method assumes that all the date provided by the user has been
* validated.
* @return the schedule type corresponding to the input provided by user.
*/
{
if (type == LAUNCH_NOW)
{
}
else if (type == LAUNCH_LATER)
{
int m = month.getSelectedIndex();
}
else if (type == LAUNCH_DAILY)
{
}
else if (type == LAUNCH_WEEKLY)
{
boolean oneDayAdded = false;
{
if (weekDays[i].isSelected())
{
if (oneDayAdded)
{
}
oneDayAdded = true;
}
}
}
else if (type == LAUNCH_MONTHLY)
{
boolean oneDayAdded = false;
{
if (monthDays[i].isSelected())
{
if (oneDayAdded)
{
}
oneDayAdded = true;
}
}
}
{
}
else
{
}
return schedule;
}
/**
* Convenience method to retrieve the time specified by the user.
* @param time the text field where the user specifies time.
* @param lTime the label associated with the text field.
* @param h an integer array of size 1 where the value of the hour specified
* by the user will be set.
* @param m an integer array of size 1 where the value of the minute specified
* by the user will be set.
* @param errorMessages the collection of error messages that will be updated
* with the encountered problems.
*/
{
try
{
if (h[0] < 0 || h[0] > 23)
{
}
if (m[0] < 0 || m[0] > 59)
{
}
}
{
}
}
/**
* Tells whether the user chose to close the dialog discarding the provided
* input.
* @return <CODE>true</CODE> if the user chose to close the dialog discarding
* the provided input and <CODE>false</CODE> otherwise.
*/
public boolean isCanceled()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
return scheduleType;
}
/**
* Returns the schedule provided by the user.
* @return the schedule provided by the user.
*/
{
return schedule;
}
{
plainTextDocument = new PlainDocument();
int[][] maxMin =
{
};
{
};
int[] currentValues =
{
};
{
int selectedIndex = 0;
int index = 0;
{
String s;
if (j < 10)
{
s = "0"+j;
}
else
{
}
model.addElement(s);
if (j == currentValues[i])
{
}
index++;
}
if (selectedIndex != 0)
{
}
}
Message[] monthMessages =
{
};
{
}
Message[] inlineHelp =
{
null,
null,
};
{
if (inlineHelp[i] != null)
{
}
}
return panel;
}
{
return panel;
}
{
{
}
sunday.setSelected(true);
wednesday.setSelected(true);
{
}
return panel;
}
{
{
int x = i % 7;
if (x == 0 && i != 0)
{
}
if (x != 0)
{
}
else
{
}
}
return panel;
}
{
{
};
{
{
}
}
return panel;
}
/**
* The main method to test this panel.
* @param args the arguments.
*/
{
while (true)
{
dlg.setVisible(true);
}
}
}