Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to Align Timeline's DatePicker?

    I have a Timeline, center aligned in a VLayout, as desired.

    Except for the DatePicker component in the header. Screenshot attached.

    How to access and/or align the DatePicker item?

    SGWT v8.3p_2013-02-11/PowerEdition Deployment (built 2013-02-11)
    Attached Files

    #2
    A few ideas

    Try these two methods:
    setAlign() : http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/Canvas.html#setAlign(com.smartgwt.client.types.Alignment)

    setLayoutAlign() : http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/Canvas.html#setLayoutAlign(com.smartgwt.client.types.Alignment)

    Comment


      #3
      Thanks but the issue is not general alignment of components within layouts, as described at http://www.smartclient.com/smartgwt/showcase/#layout_center_align.

      The issue is how to access the methods (e.g., setAlign(), setStyleName()) of a generated composite-component child(?)* within an explicitly created parent* component.

      Using the SmartClient Developer Console "Watch" tab, I think I've identified the issue: The "ControlsBar" components are contained within an HLayout, which appears to have an alignment of LEFT (or TOP, this usually confuses me). (see attached screenshots). This is where I'm halted in ignorance about what to do next.

      What I'd prefer is a method on a silver platter from Isomorphic, like "Calendar.setControlsBarAlign(Alignment.CENTER)" that Timeline would inherit. I've looked, but all I see is "setShowControlsBar(Boolean)".

      Absent that, I'd like a general explanation of how to access generated subcomponents like this. Is there something analogous to Forms/FormItems, where I can do something like DynamicForm.getItem("ControlsBar").setShowTitle(false) etc.

      * And while I'm asking for general explanations, I'm not exactly clear on the differences between children vs items vs members vs peers, et al. Am I using the terms correctly here?

      Demo code:
      Code:
      package com.smartgwt.sample.client;
      
      import java.util.Date;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.types.Alignment;
      import com.smartgwt.client.widgets.Canvas;
      import com.smartgwt.client.widgets.calendar.Timeline;
      
      public class Demo_CalendarDatePickerAlign implements EntryPoint {
      
      	@SuppressWarnings("deprecation")
      	public void onModuleLoad() {
      
      		Date startDate = new Date();
      		startDate.setHours(0);
      		startDate.setMinutes(0);
      		startDate.setSeconds(0);
      
      		Date endDate = new Date();
      		endDate.setDate(endDate.getDate() + 19);
      		endDate.setHours(23);
      		endDate.setMinutes(59);
      		endDate.setSeconds(59);
      
      		Timeline timeline = new Timeline();
      		timeline.setStartDate(startDate);
      		timeline.setEndDate(endDate);
      
      		// the "ControlsBar" is what I'm trying to Center Align, to the Center of the Timeline
      		// timeline.setShowControlsBar(false);
      
      		// Timeline Alignment settings have no effect on ControlsBar
      		// timeline.setAlign(Alignment.CENTER);
      		// timeline.setAlign(Alignment.LEFT);
      		// timeline.setAlign(Alignment.RIGHT);
      		// timeline.setLayoutAlign(Alignment.CENTER);
      		// timeline.setLayoutAlign(Alignment.LEFT);
      		// timeline.setLayoutAlign(Alignment.RIGHT);
      		// timeline.setStyleName("normalTest"); // Futzed with CSS alignment, no luck
      
      		timeline.draw();
      
      		Canvas canvas = new Canvas();
      		canvas.setWidth("50%"); // right border will be center screen
      		canvas.setBorder("1px solid Red");
      
      		canvas.draw();
      
      	}
      }
      Attached Files

      Comment

      Working...
      X