@Override
  public void setComponentValues(BaseModelObject baseModelObject) {
    for (PropertyObjectDefinition property : definitions) {
      if (propertyFields.containsKey(property) == true) {
        PropertyField propertyField = propertyFields.get(property);
        StyledLabel propertyLabel = propertyLabels.get(property);

        propertyField.setComponentValue(baseModelObject);
        propertyLabel.setVisible(propertyField.isVisible());
      }
    }

    boolean visible = false;
    for (int i = 0; i < contentPanel.getComponentCount(); i++) {
      Component component = contentPanel.getComponent(i);

      if (component.isVisible() == true) {
        visible = true;
        break;
      }
    }

    setVisible(visible);

    revalidate();

    Dimension preferredSize = contentPanel.getPreferredSize();
    contentPanel.setSize(preferredSize);
    contentPanel.setMinimumSize(preferredSize);
  }
  private JComponent createStyledLabelsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(0, 2, 10, 1));

    // Creates a StyledLabel to warn up so that we don't include class loading time into the
    // performance test.
    // This is the same for all three cases.
    StyledLabel label = new StyledLabel("Bold Italic Underlined");
    // we could pub the creation of StyleRange[] outside the loop.
    // But to make the comparison fair, we kept it inside.
    label.setStyleRanges(
        new StyleRange[] {
          new StyleRange(0, 4, Font.BOLD),
          new StyleRange(5, 6, Font.ITALIC),
          new StyleRange(12, 10, Font.PLAIN, StyleRange.STYLE_UNDERLINED)
        });

    long start = System.currentTimeMillis();
    for (int i = 0; i < COUNT; i++) {
      label = new StyledLabel("Bold Italic Underlined");
      // we could pub the creation of StyleRange[] outside the loop.
      // But to make the comparison fair, we kept it inside.
      label.setStyleRanges(
          new StyleRange[] {
            new StyleRange(0, 4, Font.BOLD),
            new StyleRange(5, 6, Font.ITALIC),
            new StyleRange(12, 10, Font.PLAIN, StyleRange.STYLE_UNDERLINED)
          });
      panel.add(label);
    }
    panel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true),
                " StyledLabel Examples - use " + (System.currentTimeMillis() - start) + " ms ",
                TitledBorder.CENTER,
                TitledBorder.CENTER,
                null,
                Color.RED),
            BorderFactory.createEmptyBorder(6, 4, 4, 4)));
    return panel;
  }
  public TaskDetailPanel() {
    setBorder(new TitledBorder(null, "Detail", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gridBagLayout.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gridBagLayout.columnWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    JPanel panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    GridBagConstraints gbc_panel = new GridBagConstraints();
    gbc_panel.fill = GridBagConstraints.HORIZONTAL;
    gbc_panel.gridwidth = 8;
    gbc_panel.insets = new Insets(0, 0, 5, 5);
    gbc_panel.gridx = 1;
    gbc_panel.gridy = 0;
    add(panel, gbc_panel);

    JideButton btnAdd = new JideButton();
    panel.add(btnAdd);
    btnAdd.setText("+");

    JideButton btnDel = new JideButton();
    btnDel.setText("-");
    panel.add(btnDel);

    StyledLabel stldlblTaskName = new StyledLabel();
    stldlblTaskName.setText("Task Name");
    GridBagConstraints gbc_stldlblTaskName = new GridBagConstraints();
    gbc_stldlblTaskName.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblTaskName.anchor = GridBagConstraints.WEST;
    gbc_stldlblTaskName.gridx = 1;
    gbc_stldlblTaskName.gridy = 1;
    add(stldlblTaskName, gbc_stldlblTaskName);

    txtTask = new JTextField();
    GridBagConstraints gbc_txtTask = new GridBagConstraints();
    gbc_txtTask.gridwidth = 7;
    gbc_txtTask.insets = new Insets(0, 0, 5, 5);
    gbc_txtTask.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtTask.gridx = 2;
    gbc_txtTask.gridy = 1;
    add(txtTask, gbc_txtTask);
    txtTask.setColumns(10);

    StyledLabel stldlblServer = new StyledLabel();
    stldlblServer.setText("Server");
    GridBagConstraints gbc_stldlblServer = new GridBagConstraints();
    gbc_stldlblServer.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblServer.anchor = GridBagConstraints.WEST;
    gbc_stldlblServer.gridx = 1;
    gbc_stldlblServer.gridy = 2;
    add(stldlblServer, gbc_stldlblServer);

    txtServer = new JTextField();
    GridBagConstraints gbc_txtServer = new GridBagConstraints();
    gbc_txtServer.gridwidth = 7;
    gbc_txtServer.insets = new Insets(0, 0, 5, 5);
    gbc_txtServer.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtServer.gridx = 2;
    gbc_txtServer.gridy = 2;
    add(txtServer, gbc_txtServer);
    txtServer.setColumns(10);

    StyledLabel stldlblUser = new StyledLabel();
    stldlblUser.setText("User");
    GridBagConstraints gbc_stldlblUser = new GridBagConstraints();
    gbc_stldlblUser.anchor = GridBagConstraints.WEST;
    gbc_stldlblUser.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblUser.gridx = 1;
    gbc_stldlblUser.gridy = 3;
    add(stldlblUser, gbc_stldlblUser);

    txtUser = new JTextField();
    GridBagConstraints gbc_txtUser = new GridBagConstraints();
    gbc_txtUser.gridwidth = 7;
    gbc_txtUser.insets = new Insets(0, 0, 5, 5);
    gbc_txtUser.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtUser.gridx = 2;
    gbc_txtUser.gridy = 3;
    add(txtUser, gbc_txtUser);
    txtUser.setColumns(10);

    StyledLabel stldlblPassword = new StyledLabel();
    stldlblPassword.setText("Password");
    GridBagConstraints gbc_stldlblPassword = new GridBagConstraints();
    gbc_stldlblPassword.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblPassword.anchor = GridBagConstraints.WEST;
    gbc_stldlblPassword.gridx = 1;
    gbc_stldlblPassword.gridy = 4;
    add(stldlblPassword, gbc_stldlblPassword);

    txtPwd = new JPasswordField();
    GridBagConstraints gbc_txtPwd = new GridBagConstraints();
    gbc_txtPwd.gridwidth = 7;
    gbc_txtPwd.insets = new Insets(0, 0, 5, 5);
    gbc_txtPwd.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPwd.gridx = 2;
    gbc_txtPwd.gridy = 4;
    add(txtPwd, gbc_txtPwd);

    StyledLabel stldlblStart = new StyledLabel();
    stldlblStart.setText("Start");
    GridBagConstraints gbc_stldlblStart = new GridBagConstraints();
    gbc_stldlblStart.anchor = GridBagConstraints.WEST;
    gbc_stldlblStart.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblStart.gridx = 1;
    gbc_stldlblStart.gridy = 5;
    add(stldlblStart, gbc_stldlblStart);

    DateSpinner txtTime = new DateSpinner();
    GridBagConstraints gbc_txtTime = new GridBagConstraints();
    gbc_txtTime.gridwidth = 7;
    gbc_txtTime.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtTime.insets = new Insets(0, 0, 5, 5);
    gbc_txtTime.anchor = GridBagConstraints.NORTH;
    gbc_txtTime.gridx = 2;
    gbc_txtTime.gridy = 5;
    add(txtTime, gbc_txtTime);

    StyledLabel stldlblRepeat = new StyledLabel();
    stldlblRepeat.setText("Repeat");
    GridBagConstraints gbc_stldlblRepeat = new GridBagConstraints();
    gbc_stldlblRepeat.anchor = GridBagConstraints.WEST;
    gbc_stldlblRepeat.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblRepeat.gridx = 1;
    gbc_stldlblRepeat.gridy = 6;
    add(stldlblRepeat, gbc_stldlblRepeat);

    JComboBox txtRepeat = new JComboBox();
    txtRepeat.setModel(
        new DefaultComboBoxModel(new String[] {"Now", "Daily", "Weekly", "Monthly"}));
    GridBagConstraints gbc_txtRepeat = new GridBagConstraints();
    gbc_txtRepeat.gridwidth = 7;
    gbc_txtRepeat.insets = new Insets(0, 0, 5, 5);
    gbc_txtRepeat.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtRepeat.gridx = 2;
    gbc_txtRepeat.gridy = 6;
    add(txtRepeat, gbc_txtRepeat);

    StyledLabel stldlblOn = new StyledLabel();
    stldlblOn.setText("on");
    GridBagConstraints gbc_stldlblOn = new GridBagConstraints();
    gbc_stldlblOn.anchor = GridBagConstraints.WEST;
    gbc_stldlblOn.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblOn.gridx = 1;
    gbc_stldlblOn.gridy = 7;
    add(stldlblOn, gbc_stldlblOn);

    JideToggleButton btnSun = new JideToggleButton();
    btnSun.setText("S");
    GridBagConstraints gbc_btnSun = new GridBagConstraints();
    gbc_btnSun.insets = new Insets(0, 0, 5, 5);
    gbc_btnSun.gridx = 2;
    gbc_btnSun.gridy = 7;
    add(btnSun, gbc_btnSun);

    JideToggleButton btnMon = new JideToggleButton();
    btnMon.setText("M");
    GridBagConstraints gbc_btnMon = new GridBagConstraints();
    gbc_btnMon.insets = new Insets(0, 0, 5, 5);
    gbc_btnMon.gridx = 3;
    gbc_btnMon.gridy = 7;
    add(btnMon, gbc_btnMon);

    JideToggleButton btnTue = new JideToggleButton();
    btnTue.setText("T");
    GridBagConstraints gbc_btnTue = new GridBagConstraints();
    gbc_btnTue.insets = new Insets(0, 0, 5, 5);
    gbc_btnTue.gridx = 4;
    gbc_btnTue.gridy = 7;
    add(btnTue, gbc_btnTue);

    JideToggleButton btnWed = new JideToggleButton();
    btnWed.setText("W");
    GridBagConstraints gbc_btnWed = new GridBagConstraints();
    gbc_btnWed.insets = new Insets(0, 0, 5, 5);
    gbc_btnWed.gridx = 5;
    gbc_btnWed.gridy = 7;
    add(btnWed, gbc_btnWed);

    JideToggleButton btnThu = new JideToggleButton();
    btnThu.setText("T");
    GridBagConstraints gbc_btnThu = new GridBagConstraints();
    gbc_btnThu.insets = new Insets(0, 0, 5, 5);
    gbc_btnThu.gridx = 6;
    gbc_btnThu.gridy = 7;
    add(btnThu, gbc_btnThu);

    JideToggleButton btnFri = new JideToggleButton();
    btnFri.setText("F");
    GridBagConstraints gbc_btnFri = new GridBagConstraints();
    gbc_btnFri.insets = new Insets(0, 0, 5, 5);
    gbc_btnFri.gridx = 7;
    gbc_btnFri.gridy = 7;
    add(btnFri, gbc_btnFri);

    JideToggleButton btnSat = new JideToggleButton();
    btnSat.setText("S");
    GridBagConstraints gbc_btnSat = new GridBagConstraints();
    gbc_btnSat.insets = new Insets(0, 0, 5, 5);
    gbc_btnSat.gridx = 8;
    gbc_btnSat.gridy = 7;
    add(btnSat, gbc_btnSat);

    StyledLabel stldlblDestination = new StyledLabel();
    stldlblDestination.setText("Destination");
    GridBagConstraints gbc_stldlblDestination = new GridBagConstraints();
    gbc_stldlblDestination.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblDestination.anchor = GridBagConstraints.WEST;
    gbc_stldlblDestination.gridx = 1;
    gbc_stldlblDestination.gridy = 8;
    add(stldlblDestination, gbc_stldlblDestination);

    txtDes = new JTextField();
    GridBagConstraints gbc_txtDes = new GridBagConstraints();
    gbc_txtDes.gridwidth = 7;
    gbc_txtDes.insets = new Insets(0, 0, 5, 5);
    gbc_txtDes.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtDes.gridx = 2;
    gbc_txtDes.gridy = 8;
    add(txtDes, gbc_txtDes);
    txtDes.setColumns(10);

    StyledLabel stldlblRemotePath = new StyledLabel();
    stldlblRemotePath.setText("Remote Path");
    GridBagConstraints gbc_stldlblRemotePath = new GridBagConstraints();
    gbc_stldlblRemotePath.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblRemotePath.anchor = GridBagConstraints.WEST;
    gbc_stldlblRemotePath.gridx = 1;
    gbc_stldlblRemotePath.gridy = 9;
    add(stldlblRemotePath, gbc_stldlblRemotePath);

    txtRemote = new JTextField();
    GridBagConstraints gbc_txtRemote = new GridBagConstraints();
    gbc_txtRemote.gridwidth = 7;
    gbc_txtRemote.insets = new Insets(0, 0, 5, 5);
    gbc_txtRemote.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtRemote.gridx = 2;
    gbc_txtRemote.gridy = 9;
    add(txtRemote, gbc_txtRemote);
    txtRemote.setColumns(10);

    StyledLabel stldlblFilePattern = new StyledLabel();
    stldlblFilePattern.setText("File Pattern");
    stldlblFilePattern.setToolTipText("");
    GridBagConstraints gbc_stldlblFilePattern = new GridBagConstraints();
    gbc_stldlblFilePattern.insets = new Insets(0, 0, 5, 5);
    gbc_stldlblFilePattern.anchor = GridBagConstraints.WEST;
    gbc_stldlblFilePattern.gridx = 1;
    gbc_stldlblFilePattern.gridy = 10;
    add(stldlblFilePattern, gbc_stldlblFilePattern);

    txtPattern = new JTextField();
    GridBagConstraints gbc_txtPattern = new GridBagConstraints();
    gbc_txtPattern.gridwidth = 7;
    gbc_txtPattern.insets = new Insets(0, 0, 5, 5);
    gbc_txtPattern.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPattern.gridx = 2;
    gbc_txtPattern.gridy = 10;
    add(txtPattern, gbc_txtPattern);
    txtPattern.setColumns(10);
  }