Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to save AwtCalendar (Read 1005 times)
applerugsack
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Feb 27th, 2023
How to save AwtCalendar
Feb 27th, 2023 at 12:54pm
Print Post  
Hi I'm using the AwtCalendar function from the CourseSchedule\JPlanner.jar that I watched from this MindFusion youtube video (https://youtu.be/Pz0CF3DMNec) and I was just wondering how to save any changes made to the calendar. For example the boxes created for users to view on a different Jframe.

And if it's possible, I would also like to know how to repeat/reoccur the set boxes as the days go by, your help is very much appreciated!

I'm no java expert so please bare with any informalities I have made. Cry

Sample of my code so far:

package clinic.appointment.management.system;

import com.mindfusion.common.DateTime;
import com.mindfusion.common.Duration;
import com.mindfusion.scheduling.*;
import com.mindfusion.scheduling.awt.AwtCalendar;
import java.awt.BorderLayout;
import java.awt.Container;

public class StaffTimetableSlots extends javax.swing.JFrame {

    private final AwtCalendar calendar;
   
    public StaffTimetableSlots() {
        initComponents();
        setLocationRelativeTo(null);
        calendar = new AwtCalendar();
        calendar.beginInit();
        calendar.setCurrentView(CalendarView.Timetable);
        calendar.setTheme(ThemeType.Light);
        calendar.setCustomDraw(CustomDrawElements.TimetableItem);
      
        for(int i = 1; i < 7; i++)
            calendar.getTimetableSettings().getDates().add(DateTime.today().addDays(i));
            
        calendar.getTimetableSettings().setItemOffset(30);
        calendar.getTimetableSettings().setShowItemSpans(false);
        calendar.getTimetableSettings().setSnapInterval(Duration.fromMinutes(1));
        calendar.getTimetableSettings().setVisibleColumns(7);
       
       
        calendar.endInit();

        Container container = this.getContentPane();
        BorderLayout borderLayout = new BorderLayout();
        setTitle("Clinic Appointment Management System Timetable Calendar");
        container.setLayout(borderLayout);
        container.setSize(1000,800);
       
        container.setVisible(true);
        container.add(calendar);
        //when the mouse is dragged across a column between a certain time, a box will be created to illustrate a timeslot
        calendar.setEnableDragCreate(true);
         
    }
  

Screenshot__178_.png ( 90 KB | 45 Downloads )
Screenshot__178_.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: How to save AwtCalendar
Reply #1 - Feb 27th, 2023 at 1:08pm
Print Post  
Hi,

You can save to a file using Schedule.saveTo method, e.g. this is from Clipboard sample project from distribution (https://mindfusion.eu/JPlannerTrial.zip) -

Code
Select All
calendar.getSchedule().saveTo(
    fileChooser.getSelectedFile().getAbsolutePath(), ContentType.Xml); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint